<?php
if(Mage::registry('current_product')) {
$_product = Mage::getModel('catalog/product')->load(Mage::registry('current_product')->getId());
$currentCatIds = $_product->getCategoryIds();
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToSelect('name')
->addAttributeToSelect('url')
->addAttributeToFilter('entity_id', $currentCatIds)
->addIsActiveFilter();
?>
<ul class="cate-brad">
<?php $count = sizeof($categoryCollection);
$i = 1;
foreach($categoryCollection as $cat){?>
<li><a href="<?php echo $cat->getUrl(); ?>"><?php echo $cat->getName(); ?></a></li>
<?php if($count==$i){}else{?>
<span class="diveder">|</span>
<?php } $i++; } ?>
</ul>
<?php }?>
if(Mage::registry('current_product')) {
$_product = Mage::getModel('catalog/product')->load(Mage::registry('current_product')->getId());
$currentCatIds = $_product->getCategoryIds();
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToSelect('name')
->addAttributeToSelect('url')
->addAttributeToFilter('entity_id', $currentCatIds)
->addIsActiveFilter();
?>
<ul class="cate-brad">
<?php $count = sizeof($categoryCollection);
$i = 1;
foreach($categoryCollection as $cat){?>
<li><a href="<?php echo $cat->getUrl(); ?>"><?php echo $cat->getName(); ?></a></li>
<?php if($count==$i){}else{?>
<span class="diveder">|</span>
<?php } $i++; } ?>
</ul>
<?php }?>
No comments:
Post a Comment