[英]List manufacturers with products in category in Magento?
我正在嘗試(通過鏈接)列出所有制造商的特定類別的產品。 這有效:
$category = 56;
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();
$manufacturers = array();
foreach ($attributes as $attribute) {
if ($attribute->getAttributeCode() == 'manufacturer') {
$filterBlockName = 'catalog/layer_filter_attribute';
$result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
foreach($result->getItems() as $option) {
echo '<li><a href="'.$this->getUrl('').'bats.html?manufacturer=' .$option->getValue().'">'.$option->getLabel().'</a></li>';
}
}
}
但是當我進入制造商類別頁面之一時,屬性鏈接消失。 我假設是因為它使用了分層導航模型。
無論如何,不使用分層導航模型就可以獲得特定類別的制造商列表嗎?
您好,我認為您創建了新的自定義模塊並覆蓋了從catalog.xml到xml布局的xml標簽。
/app/design/frontend/base/default/layout/catalog.xml
調用參考名稱為left / right / content的制造模塊
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.