Magento

How to Add related products in Magento by code / script

To create the related product programmatically in Magento <?phpset_time_limit(0);ini_set(‘memory_limit’,’1024M’);require_once ‘../../app/Mage.php’;Mage::app(); $sku=’12345’;  //some Sku$product = Mage::getModel(‘catalog/product’)->loadByAttribute(‘sku’,$sku); if($product){$sRelatedProducts = “123456,123”;$aRelatedProducts = explode(‘,’,…

Create a Country Drop Down in the Frontend of Magento

<?php$_countries= Mage::getResourceModel(‘directory/country_collection’)                                    ->loadData()                                    ->toOptionArray(false) ?><?php if (count($_countries) > 0): ?>    <select name=”country” id=”country”>        <option value=””>– Please Select –</option>        <?php foreach($_countries as…

Category Navigation Listings in Magento

<div id=”leftnav”><?php $helper = $this->helper(‘catalog/category’) ?><?php $categories = $this->getStoreCategories() ?><?php if (count($categories) > 0): ?><ul id=”leftnav-tree” class=”level0″><?php foreach($categories as $category):…

Get The Root Category In Magento

<?php$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();$_category = Mage::getModel(‘catalog/category’)         ->load($rootCategoryId);// You can then get all of the top level categories using:$_subcategories = $_category->getChildrenCategories();?>

1 7 8 9 39