質問

I am displaying all the products from the subcategories of the parent category. I want to exclude the product of the specific subcategory from that parent category product listing page. ex. I have parent category as fruits and its subcategories as mango banana orange i want to display only mango and banana products on the fruits category page not orange products

役に立ちましたか?

解決

You can solve this in 2 ways. First one, You can simply un select the product which are not to be displayed in the Fruits page through Manage Product->[required product]->Categories.Here select the Mango and unselect Orange.

And the next one, You can get the Product Collection and through Mage::getModel(catalog/category) you can get the IDs Of all the top categories and child Categories. Asusal the product which is not to be displayed contains the top category ID and its own ID. Here you can give the ID as statically and remove them.

他のヒント

You can add restrictions by category id. Check your category ids and add one if.

     $arrayOfCatToBeExc = array(1,3,4); 
     // for example id of your categories  and write one if to check  
     if(in_array($_product->getCategory(),$arrayOfCatToBeExc){
     continue;
     }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top