Question

i'm trying to list attributes catalog/category/view.phtml file

http://i.stack.imgur.com/P57vH.jpg

How can i do this feature?

Was it helpful?

Solution

First to get current layer collection the get list attribute

$CurrentLayer=Mage::getSingleton('catalog/layer');

        $attributes = $CurrentLayer->getFilterableAttributes();

        foreach ($attributes as $attribute) {
            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 = $this->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();

            foreach($result->getItems() as $option) {
                echo $option->getLabel().'<br/>';
                echo $option->getValue();
            }
        }

Hope i will be working

OTHER TIPS

@Amit Bera

Sorry, my english very bad.

i solved the problem view.php

public function getAllManu()
{
  $product = Mage::getModel('catalog/product');
  $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
              ->setEntityTypeFilter($product->getResource()->getTypeId())
              ->addFieldToFilter('attribute_code', 'product_properties');
  $attribute = $attributes->getFirstItem()->setEntity($product->getResource());
  $product_properties = $attribute->getSource()->getAllOptions(false);
  return $product_properties;


}

view.phtml

<select class="form-control" onchange="if (this.value) window.location.href=this.value">
                <option>Select</option>
                <?php foreach ($this->getAllManu() as $product_properties): ?>
                <option value="<?php Mage::getURL() ?>catalogsearch/advanced/result/?product_properties[]=<?php echo $product_properties['value'] ?>"><?php echo $product_properties['label'] ?></option>
                <?php endforeach; ?>
            </select>

Thank you for your help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top