Know Magento

yet another magento blog

Add Manufacturer block in Magento

To add the Manufacturer block in Magento is very easy. Just follow the steps mentioned bellow.

Create a new template file manufacturer.phtml  in app/design/frontend/default/<your_template>/template/catalog/navigation/
(if you are not able to find catalog or navigation directory in template then please create them in respective order)

Put the following code in  manufacturer.phtml

<ul>
<?php
$collection = Mage::getResourceModel('catalog/product_attribute_collection') ->addFieldToFilter('attribute_code', array('eq'=>'manufacturer'))
->addStoreLabel(Mage::app()->getStore()->getId())
->load();

foreach($collection as $a){
$manufArray = $a->getSource()->getAllOptions(false);
foreach($a->getSource()->getAllOptions(false) as $option)
$manufArray[$option['value']] = $option['label'];
}
asort($manufArray);
foreach($manufArray as $menKey => $menVal)
{
if(is_array($menVal))
{
continue;
}

echo '<li><a href="'.Mage::getURL().'catalogsearch/advanced/result/?manufacturer%5B%5D='.$menKey.'">'.$menVal.'</a></li>';
}
?>
</ul>

Read more of this post

Add Featured Products on Homepage in Magento

Adding featured products in Magento is very easy. Just follow the steps mentioned below.

  • Log in to your Magento Admin end.
  • Go to Catalog > Manage Categories.
  • Select Root Category of your choice. By default only one Root category is available named “Root Catalog”.
  • Now click on Add Subcategory button on left and name new subcategory “Featured” (this name can be anything of your choice).
  • If you do not want to load category on store front-end then Is Active  to No.
  • If you do not want your category to be  appeared in navigation set Include in Navigation Menu to No.
  • After creating the category  you will see the category name and ID on the page title. Note down the ID of your category which is mentioned after ID: label in Category title on page. See the image below for reference.
  • Add few Products in newly created Featured category. Read more of this post

Fatal error: Call to undefined method Mage_Adminhtml_Block_Widget::getrowurl() in Magento

After installing fresh copy of  Magento CE 1.5.1.0-stable I encountered a “Fatel error” when I tried to manage categories in Admin end.

The error was  Fatal error: Call to undefined method Mage_Adminhtml_Block_Widget::getrowurl() in app/code/core/Mage/Adminhtml/Block/Widget/Grid.php on line 1607

After some brain storming and search I was able to fix the error. Following are the steps you have to follow.

  1. Open file app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
  2. Locate function getRowUrl in the file
  3. Change the line from $res = parent::getRowUrl($item);  to $res = parent::getUrl($item);
  4. Save the file

I hope this will save lots of time for many people who are new to Magento