Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

code in vertnav
 
wasis
Member
 
Total Posts:  44
Joined:  2012-04-16
 

hi guys, i have a problem in magento link script. i want to edit link in vertnav folder (left.phtml and left_subcategory.phtml), but i still don’t understand about the script, this is the script..
..........
<ul style="border-bottom:1px dotted #999; padding:10px 0">
<?php $i = 1;
$childCategories = array();
foreach (Mage::getModel('catalog/category')->load($_category->getId())->getChildrenCategories() as $childCategory):
$productCount = '';
$cat = Mage::getModel('catalog/category')->load($childCategory->getEntityId());
$n = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($cat);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($n);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($n);
$productCount = '<span class="" style="color:#666"> (' . $n->count() . ')</span>';
$childCategories[$childCategory->getName().$productCount] = $childCategory->getUrl();
endforeach;
ksort($childCategories, SORT_STRING);
//print '<pre>';print_r($childCategories);
foreach ($childCategories as $name => $url):
echo '<li><a href="'.$url.'">'.$name .'</a></li>';
if ($i==5) break;
$i++;
endforeach;?>
<li> <a class="gray" href="<?php echo Mage::getModel('catalog/category')->setData($_category->getData())->getUrl(); ?>” title="<?php echo $this->__('More ').$_category->getName() ?>” > <?php echo $this->__('View more >>') ?> </a>
<li>
</ul>
.........
does any body help me, what this script mean and how to edit the link?

 
Magento Community Magento Community
Magento Community
Magento Community
 
prateekgupta
Guru
 
Avatar
Total Posts:  541
Joined:  2010-06-04
India
 

This code is used using magento API and using for loop to fecth the categories and subcategories so yout chnage the link for the items you currently see but you can add new ones and link them

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top