In product detail page the following code is written to display the cross-sell product which are set from the admin side..
<?php echo $this->getChildHtml('crosssell'); ?>
But it is not showing anything although there are cross sell products present in the admin side and the cross-sell products are instock.
I looked into its respective block i.e.
app/core/code/Mage/Catalog/Block/Product/List/Crosssell.php
and the function where the product collection is formed is as follows..
protected function _prepareData()
{
$product = Mage::registry('product');
/* @var $product Mage_Catalog_Model_Product */
$this->_itemCollection = $product->getCrossSellProductCollection()
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->setPositionOrder()
->addStoreFilter();
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
$this->_itemCollection->load();
foreach ($this->_itemCollection as $product) {
$product->setDoNotUseCategoryId(true);
}
return $this;
}
I got nothing related to cross sell product while doing var_dump($product)
.
So how to get the cross sell product in the product collection.
Thanks.