Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 类别视图页面的magento属性列表_Php_Magento_Attributes - Fatal编程技术网

Php 类别视图页面的magento属性列表

Php 类别视图页面的magento属性列表,php,magento,attributes,Php,Magento,Attributes,我正在尝试列出catalog/category/view.phtml文件的属性 如何使用此功能?首先获取当前图层集合的“获取列表”属性 $CurrentLayer=Mage::getSingleton('catalog/layer'); $attributes = $CurrentLayer->getFilterableAttributes(); foreach ($attributes as $attribute) { if

我正在尝试列出catalog/category/view.phtml文件的属性


如何使用此功能?

首先获取当前图层集合的“获取列表”属性

$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();
            }
        }
$CurrentLayer=Mage::getSingleton('catalog/layer');
$attributes=$CurrentLayer->getFilterableAttributes();
foreach($attributes作为$attribute){
如果($attribute->getAttributeCode()=='price'){
$filterBlockName='catalog/layer_filter_price';
}elseif($attribute->getBackendType()=='decimal'){
$filterBlockName='catalog/layer_filter_decimal';
}否则{
$filterBlockName='catalog/layer_filter_attribute';
}
$result=$this->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
foreach($result->getItems()作为$option){
echo$option->getLabel()。
; echo$option->getValue(); } }
希望我能工作

@Amit Bera

对不起,我的英语很差

我解决了这个问题 view.php

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>

挑选

感谢您的帮助

是否要筛选可筛选属性???是的,我要按属性筛选产品如何链接此结构?
<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>