简体   繁体   中英

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

Hide or Show Particular Product By Customer or Customer Group in Listing Page (magento 1.9)

I add the Back order Products those product only visible the particular customer. How to i do in magento 1.9? Plz help me.

You can observe catalog_product_collection_apply_limitations_after event, assuming you have a product attribute to filter according your desired logic

So, in your observer...

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));
}

Feel free to join https://magento.stackexchange.com/questions & post more details about what you want

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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