Tag Archives: PHP

How to add cross-sell to a product – Magento

1) In the Admin Panel, select Catalog > Manage Products.
2) Select the product you wish to configure cross-sell products for by clicking its respective row.
3) Click on  the Cross-sells tab from the left side panel.
4) Click on the button “Reset Filter” and select the products to be listed
5)Once cross-sell products are selected, click Save at the top right of the page.
6) Clear your cache and refresh the product information page to assure that it’s working to your satisfaction.


List category and subcategory on sidebar – Magento

 $obj = new Mage_Catalog_Block_Navigation();
 $store_cats = $obj->getStoreCategories();
 $current_cat = $obj->getCurrentCategory();
 $current_cat = (is_object($current_cat) ? $current_cat->getName() : '');?>
 <?php foreach ($store_cats as $cat)
 { if ($cat->getName() == $current_cat) {
  echo '<li style="padding-left:5px;">
  <a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."
 foreach ($obj->getCurrentChildCategories() as $subcat)
{ echo '<li style="padding-left:15px;">
 <a href="'.$this->getCategoryUrl($subcat).'">'.$subcat->getName()."</a>
 </li>n"; }
 echo "</ul>n</li>n"; }
 { echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."
 </a></li>n"; }}