Php 类别视图页面的magento属性列表
我正在尝试列出catalog/category/view.phtml文件的属性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
如何使用此功能?首先获取当前图层集合的“获取列表”属性
$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>