Custom Image Attribute generates error when no image is set Magento
Ensure that Placeholder image for the new image attribute is uploaded from admin panel
System > Configuration > Catalog > Catalog > Product image placeholders
Category image from category id flat catalog enabled Magento
<?php $Category = Mage::getModel(‘catalog/category’)->load($categoryId); ?>
<?php echo $this->getImageUrl($Category) ?>
Allow Guests to Write Reviews magento
Go to system -> configuration and click on the option “Catalog” (sidebar menu) under the main category “CATALOG” . Then set the field value “Allow Guests to Write Reviews” to yes so that guest can post reviews .
Product count from category id Magento
Mage::getModel('catalog/category')->load($categoryId)->getProductCount();
Include a block in sidebar - Magento
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/left_nav.phtml" />
</reference>
Please create file with the given name "left_nav.phtml " and put it in the corresponding location
eg : /app/design/frontend/your_package/yourtheme/template/catalog/navigation/left_nav.phtml Magento version upgrade to 1.6.x
NOTE : Follow below given steps at your own risk .
1) Make sure that you have taken the backup of the latest site and database . This is must .
2) Download the latest magento package
wget http://www.magentocommerce.com/downloads/assets/1.6.0.0/magento-1.6.0.0.tar.gz
tar xvfz magento-1.6.0.0.tar.gz
3) Go to the terminal and change the directory to the location where the current magento site is running
4) Remove all the cache files $ rm -rf var/cache/*
5) Remov the folder downloader $ rm -rf downloader
6) Copy the folder “downloader” from the latest package to the current site $ cp -a magento/downloader
7) Move the file “ mage” from the latest package to teh current site $ cp magento/mage
8) Chnage the permision $ chmod 550 ./mage
9) Run the following commands
$ ./mage mage-setup .
$ ./mage sync --force
$ ./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
$ rm -rf var/cache/* var/session/*
$ rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
$ chmod 755 mage
$ php shell/indexer.php reindexall
$ ./mage upgrade-all --force
10) Copy all the file from latest package to the current site except the theme folder that the current site use
$ cp -Rf magento/* .
11) point the browser to the site url
This may take more time . so be patient. You might get a browser error when the upgrade is being done . never mind :) It normal .
12) Thats all !!!
How to Get the Base Url for a specific Magento Store
<?php
$store_id = $this->helper('core')->getStoreId();
$logoURL=Mage::app()->getStore($store_id)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
?>
Magento Admin login failing in chrome browser
Edit the page app\code\local\Mage\Core\Model\Session\Abstract\Varien.php
Search for the code
if (isset($cookieParams['domain'])) {
$cookieParams['domain'] = $cookie->getDomain();
}
and replace with
if (isset($cookieParams['domain']) && !in_array("127.0.0.1", self::getValidatorData())) {
$cookieParams['domain'] = $cookie->getDomain();
}
Get product attribute value product listing page Magento
1) Ensure that “Used in Product Listing” of the attribute is set to “yes”
2) Then use the code ?php echo $_helper->productAttribute($_product, $_product->getAttricuteCode(), attricutecode) ?>
Category image from category id Magento
<?php $Category = Mage::getModel('catalog/category')->load($categoryId); ?>
<?php echo $Category ->getImageUrl() ?>
