Magento多种不同的制造商

时间:2012-11-20 16:40:04

标签: php magento magento-1.7

我有magento 1.7运行多店铺,我需要为不同的商店展示不同的品牌/制造商

目前我使用此代码:

<?php
$product = Mage::getModel('catalog/product');
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter('attribute_code', 'manufacturer');
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
?>

<?php foreach ($manufacturers as $manufacturer): ?>
<a href="/manufacturer/<?php echo $manufacturer['label'] ?>"> <?php echo $manufacturer['label'] ?> </a>
<?php endforeach; ?>

在前端显示制造商,但它在所有站点中显示相同的品牌。

我怎么能告诉magento在不同的网站上展示不同的品牌?

非常感谢你!

2 个答案:

答案 0 :(得分:0)

尝试

$attribute->getSource()->setStoreId($yourStoreId);
$manufacturers = $attribute->getSource()->getAllOptions(false);

答案 1 :(得分:0)

检查属性“manufacturer”的范围是否设置为“store view”