Skip to main content

Posts

Showing posts from 2013

How to create tar by excluding directories in centos Linux

I had a problem to compress files in my webserver. Because my images and backup folders were too large. Then I thought to exclude those directories and create a tar file. I have used --exclude option which matches patterns. First I have used following command to exclude images and backup folder. tar -cvf "new_tar_cha_2013-11-26.tar.gz" .  --exclude "path/to/backup/backup/*" --exclude "images/*" > error_tar_cha.log It excluded backup folder correctly. But It excluded all the images folders inside my directory. Because it matches the pattern . My solution was, I renamed to root images folder to different name - "images-cha1" and excluded it. It fixed my problem. tar -cvf "new_tar_cha_2013-11-26.tar.gz" .  --exclude "path/to/backup/backup/*" --exclude "images-cha1/*" > error_tar_cha.log I think this will be helpful for others also. Thanks

PHP :: How to request Webservice using PHP CURL

I had a problem when requesting webservice. My solution as follows.         $url = " https://path_to_service.asp " ; //setting the curl parameters.   $headers = array ( "Content-type: text/xml;charset=\"utf-8\"" ,     "Accept: text/xml" , "Cache-Control: no-cache" ,   "Pragma: no-cache" ,   "SOAPAction: \"run\""   );   try { $ch = curl_init ();   curl_setopt ( $ch , CURLOPT_URL , $url ); curl_setopt ( $ch , CURLOPT_POST , 1 );     // send xml request to a server   curl_setopt ( $ch , CURLOPT_SSL_VERIFYHOST , 0 );   curl_setopt ( $ch , CURLOPT_SSL_VERIFYPEER , 0 ); curl_setopt ( $ch , CURLOPT_POSTFIELDS , $xmlRequest );   curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , 1 ); c

Joomla 2.5 :: Redirects Error 500 (Internal server Error) page when loging with invalid username and password

I faced this issue when migrating my local joomla 2.5 installation to test server. It works fine when logging with correct username and passwords. Then I have checked in error_log and found issue. PHP Warning:  fopen(path_to_log/logs/error.php): failed to open stream: No such file or directory in  new_server_path/libraries/joomla/log/loggers/formattedtext.php on line 248 Then I have checked in back end and changed path to log folder as follows.

Magento :: Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct()

I got this fatal error when I'm going to print shipment. There are two solutions given by community. First Solution: Comment out __construct and __destruct methods in lib/Zend/Pdf/FileParserDataSource.php as follows //    abstract public function __construct();     /**      * Object destructor. Closes the data source.      *      * May also perform cleanup tasks such as deleting temporary files.      */ //    abstract public function __destruct(); Second Solution: simply change the constructor function of lib/Zend/Pdf/FileParserDataSource.php         abstract public function __construct(); TO     abstract public function __construct($filePath);

Magento :: How to update products' attributes correctly without affecting tier prices

I use following code to update magento products without effecting tier prices. Because my earlier code cleared all tier prices after run code. Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);     $id = Mage::getModel('catalog/product')->getIdBySku($prod_sku);     $product = Mage::getModel('catalog/product')->load($id);     if ($product) {       $product->setBarcode($bar_code);       if(! $product->save()){                 $productId = $product->getId();                 echo "product_Id :: ".$productId." - Product sku :: ".$product->getSku()."<br />";             }else{                 echo "not saved";             }      }

Magento :: Inline Translations - How to edit text field using in line translations

To enable inline translations, go to System -> Configurations Go to Advanced section Enable inline translation for front end Refresh page and see dashed boxes to change text as follows Click on the highlighted icon in above images. Following window will appear. Change and submit.

Magento : Password encryption for customer data import

I had to transfer k-ecommerce customer data to magento. I created csv file according to magento customer data upload csv that I got from data profile -> export customer profile. But there was a problem to encrypt password to match with magento. I googled and found this. I will share with others for their reference. Thanks Edward // Change the paths according to your environment require_once 'app/Mage.php'; umask(0); $app = Mage::app('default'); // Instantiate the core encryption model $obj = Mage::getModel('core/encryption'); // Instantiate the core helper $helper = Mage::helper('core'); //Set the encryptions helper $obj->setHelper($helper); // Get the password's hash $enc_pwd = $obj->getHash($pwd, 2); // To validate password, use this. It will return 1 if it is correct echo $obj->validateHash($pwd, $enc_pwd);

Magento - Dataflow - Profiles : How to check failed products in import all product

I have created CSV file and run profile. Some products failed due to image not found issue. I wanted to find out which products have failed in the process. I googled but not found a solution. Finally I used firebug and found failed row number as follows

Magento - Tier Prices on Cart page

Add following after $_item = $this->getItem() ; in checkout/cart/item/default.phtml $_tierPricing = $this->getLayout()->createBlock('catalog/product_view', 'product.tierprices', array( 'product_id' => $_item->getProductId())); $_tierPricing->setTemplate('catalog/product/view/tierprices.phtml'); To print price info: <?php echo $_tierPricing->getTierPriceHtml();?> OR If you want retrieve tier prices for any other purposes, just for show discounts etc. Use followings. $custom = Mage::getModel('catalog/product')->load($_item->getProductId());  var_dump($custom->getTierPrice());