繁体   English   中英

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

[英]Hide or Show Product By Customer or Customer Group in Listing Page (magento 1.9)

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

我添加了“回购产品”,这些产品仅对特定客户可见。 我在magento 1.9中怎么做? 请帮我。

您可以观察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,并发布有关所需内容的更多详细信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM