在列表页面中按客户或客户组隐藏或显示产品(magento 1.9)

时间:2018-03-06 10:59:33

标签: php magento-1.9

在列表页面(magento 1.9)中按客户或客户组隐藏或显示特定产品

我添加了Back order Products这些产品仅对特定客户可见。我怎么做magento 1.9? Plz帮助我。

1 个答案:

答案 0 :(得分:0)

您可以观察 catalog_product_collection_apply_limitations_after 事件,假设您有根据所需逻辑过滤的产品属性

所以,在你的观察者......

public function yourmethod($observer){

    // here you have customer object
    $currentUser = Mage::getSingleton('customer/session')->getCustomer();

    // your logic here, so let's say you get
    // $yourFilteredValue for 'your_attribute'
    // based in $currentUser data

    // and then... the filter
    $collection = $observer->getEvent()->getCollection();
    $collection->addAttributeToFilter('your_attribute',array('eq'=> $yourFilteredValue));
}

随时加入https://magento.stackexchange.com/questions&发布有关您想要的更多详情

相关问题