Showing posts with label cross cell product magento. Show all posts
Showing posts with label cross cell product magento. Show all posts

Wednesday 27 November 2013

get cross cell product collection magento

$cart = Mage::getModel('checkout/cart')->getQuote();
$productid = array();
$crossc = array();
foreach ($cart->getAllItems() as $item) {
    $productid[] = $item->getProduct()->getId();
foreach($item->getProduct()->getCrossSellProducts() as $crosscell){
$crossc[] = $crosscell['entity_id'];
}
}
$crossce = array_diff($crossc, $productid);
$collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('*');
$collection->addIdFilter($crossce);
$collection->setPageSize(4);