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(‘,’,…
Magento
<?php $helper = $this->helper(‘catalog/category’) ?> <?php foreach ($helper->getStoreCategories() as $_category): ?> <a href=”<?php echo Mage::getModel(‘catalog/category’) …
<?php $fieldset->addField(‘country’, ‘select’, array( ‘name’ => ‘country’, ‘label’ => ‘Country’, ‘values’ => Mage::getModel (‘adminhtml/system_config_source_country’) ->toOptionArray(), ));?>
<?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…
<?php$countryList = Mage::getResourceModel (‘directory/country_collection’) ->loadData() ->toOptionArray(false); echo ‘<pre>’; print_r( $countryList); exit(‘</pre>’);?>
<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):…
<?php// $_GET$productId = Mage::app()->getRequest()->getParam(‘product_id’);// The second parameter to getParam allows you to// set a default value //which is returned if…
<?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();?>