Category Archives: Magento

List subcategories with product count Magento

<?php
$_helper = $this->helper(‘catalog/output’);
$_subcategories = $blockId = Mage::getModel(‘catalog/layer’)->getCurrentCategory()->getChildrenCategories();
?>
<div class=”block block-layered-nav”>
<div class=”block-content”>
<dl id=”narrow-by-list”>
<?php if(! empty($_subcategories)): ?>
<dt>Category</dt>
<dd>
<ol>
<?php foreach($_subcategories as $subCategory) : ?>

<?php $prodCollection = Mage::getResourceModel(‘catalog/product_collection’)->addCategoryFilter($subCategory); // Magento product collection ?>
<li><a href=”<?php echo $subCategory->getUrl(); ?>”><?php echo $subCategory->getName(); ?></a>
(<?php echo $prodCollection->count(); ?>)</li>
<?php endforeach; ?>
</ol>
<?php endif; ?>
</dd>

</dl>
</div>
</div>

Share

Get manufacturer logo from product id FME Manufacturer magento extensions

<?php
$collection = Mage::getModel(‘manufacturers/manufacturers’)->checkManufacturer($_product ->getId());
foreach ( $collection as $_manufacturer ) :

$x = Mage::helper(‘manufacturers’)->getProductPageLogoWidth();
$y = Mage::helper(‘manufacturers’)->getProductPageLogoHeight();
$color = Mage::helper(‘manufacturers’)->getProductPageLogoBackgroundColor();

if($_manufacturer[“m_logo”] != “”) {
$imgPath = Mage::helper(‘manufacturers’)->getResizedUrl($_manufacturer[“m_logo”],$x,$y,$color);
$_SESSION[“manufactureridentifier”] = $_manufacturer[‘identifier’];
} else {
$imageFile = “manufacturers/files/n/i/no_image_available.jpg”;
$imgPath = Mage::helper(‘manufacturers’)->getResizedUrl($imageFile,$x,$y,$color);
$_SESSION[“manufactureridentifier”] = $_manufacturer[‘identifier’];
}

?>
<a class=”image” href=”<?php echo Mage::helper(‘manufacturers’)->getUrl($_manufacturer[‘identifier’]); ?>” title=”<?php echo $_manufacturer[“m_name”]; ?>”>
<img style=”margin-top:-10px;” src=”<?php echo $imgPath; ?>” alt=”<?php echo $_manufacturer[“m_name”] ?>” >
</a>
<?php if($brandsLinks!=””){ ?>
<br />
<a href=”<?php echo Mage::helper(‘manufacturers’)->getUrl($_manufacturer[‘identifier’]); ?>” title=”<?php echo $_manufacturer[“m_name”]; ?>”><?php echo $this->__($brandsLinks); ?> <?php echo $_manufacturer[“m_name”]; ?></a>
<?php } ?>
<?php endforeach; ?>

Share