<?php
//echo 'Rahul singh';
$layer = Mage::getModel("catalog/layer");
$category = Mage::getModel("catalog/category")->load(3);
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();
foreach ($attributes as $attribute)
{
echo $attribute->getAttributeCode().'<br />';
if ($attribute->getAttributeCode() == 'price') {
$filterBlockName = 'catalog/layer_filter_price';
} elseif ($attribute->getBackendType() == 'decimal') {
$filterBlockName = 'catalog/layer_filter_decimal';
} else {
$filterBlockName = 'catalog/layer_filter_attribute';
}
$result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
foreach($result->getItems() as $option) {
echo $option->getFrontendLabel();
echo $option->getLabel().'<br/>';
//echo $option->getValue().'<br/>';
}
}
?>
/*for seperate seperate*/
<?php /* For Size*/ ?>
<div class="custom-third-block">
<?php
$attribute_code = "product_size";
$attribute_details = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code);
$options = $attribute_details->getSource()->getAllOptions(false);
echo "<ul class='custom-size'>";
echo "<li class='custom-size-label1'>Size</li>";
foreach($options as $option)
{
$products_combined = Mage::getModel('catalog/category')->load(3)->getProductCollection()->addAttributeToSelect('*')->addAttributeToFilter('status', array('gt' => 0))->addAttributeToFilter('product_size', array('eq' => $option["value"]));
?>
<li class="custom-size-label2 size<?php echo count($products_combined); ?>"><a href="<?php echo Mage::getBaseUrl(); ?>sale.html?product_size=<?php echo $option["value"]?>"><?php echo $option["label"]; ?></a> </li>
<?php
}
?>
</ul>
</div>
<?php /* End size*/ ?>
<?php /* For Categories sale*/ ?>
<div class="custom-first-block">
<?php
$children = Mage::getModel('catalog/category')->load('3')->getChildrenCategories();
echo "<ul class='custom-category'>";
foreach ($children as $category)
{
?>
<li class="custom-category-label">
<a href="<?php echo $category->getUrl(); ?>"><?php echo $category->getName(); ?> </a>
</li>
<?php
}
echo '</ul>';
?>
</div>
<?php /* End Categories sale*/ ?>
Comments
Post a Comment