Skip to main content

Posts

Showing posts with the label Magento

How to point Magento multi websites to domains

Backend configurations Add secure and unsecure domain urls for websites Add default domain url default config Index.php changes You need edit index.php file as follows switch($_SERVER['HTTP_HOST']) {     case ' domain.co.uk ':     case 'www. domain.co.uk ':         $mageRunCode = 'base';         $mageRunType = 'website';     break;     case ' domain.eu ':     case 'www. domain.eu ':         $mageRunCode = 'euwebsite';         $mageRunType = 'website';     break; } Comment following lines if you have /* Run store or run website */ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';   Point main domain by adding your hosting server dns in domain registrar                 It will take some time to resolve DNS settings. Use intodns.com to check dns of a domain.   Then you need to poin

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());