Display notice for products of specific categories in cart?
I want some help with mage开发者_如何学运维nto! All i want to do is to display a note or a warning (regarding shipping or a simple note) under the condition that if the cart contains any product lets say from category 4 or 6 or 8 etc..
Any help would be appreciated! Thanks.
Regards.
$cart = Mage::getModel('checkout/cart');
$quote = $cart->getQuote();
foreach($quote->getAllItems() as $item){
$product = Mage::getModel('catalog/product')->load($item->getProductId());
foreach($product->getCategoryIds() as $cat_id){
if($cat_id == 6||...) {
... do your stuff
}
}
}
Hope that helps
精彩评论