http://www.jxtgroup.com/top-10-magento-17-extensions-2013_3914633.html
Thursday, 23 July 2015
Wednesday, 22 July 2015
How to get current product all assigned categoires on product page only and Product page side bar
<?php
$currentCatIds = $_product->getCategoryIds();
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToSelect('name')
->addAttributeToSelect('url')
->addAttributeToFilter('entity_id', $currentCatIds)
->addIsActiveFilter();
?>
<div class="other-category" style="display:none;">
<span class="text-title">Other areas:</span>
<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>
</div>
=========================================================================
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<?php
$currentCatIds = $_product->getCategoryIds();
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToSelect('name')
->addAttributeToSelect('url')
->addAttributeToFilter('entity_id', $currentCatIds)
->addIsActiveFilter();
?>
<div class="other-category" style="display:none;">
<span class="text-title">Other areas:</span>
<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>
</div>
$currentCatIds = $_product->getCategoryIds();
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToSelect('name')
->addAttributeToSelect('url')
->addAttributeToFilter('entity_id', $currentCatIds)
->addIsActiveFilter();
?>
<div class="other-category" style="display:none;">
<span class="text-title">Other areas:</span>
<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>
</div>
=========================================================================
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<?php
$currentCatIds = $_product->getCategoryIds();
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToSelect('name')
->addAttributeToSelect('url')
->addAttributeToFilter('entity_id', $currentCatIds)
->addIsActiveFilter();
?>
<div class="other-category" style="display:none;">
<span class="text-title">Other areas:</span>
<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>
</div>
How to get current product all assigned categoires anywhere
<?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 }?>
How to find current page is product page in magneto
<?php
if(Mage::registry('current_product')) {
//do something related to product
}?>
if(Mage::registry('current_product')) {
//do something related to product
}?>
Subscribe to:
Posts (Atom)