Magento Display Cross-Selling products on product detail page
Some time we need to display cross sell products on product page, you can use the code below to display
cross sell products.
[php]
<?php if($_crossSellProducts = $_product->getCrossSellProducts()): ?>
<div class="topproducts_containter">
<div class="topsellerTitle">TOP <?php echo strtoupper(Mage::getModel(‘catalog/layer’)->getCurrentCategory()->getName()); ?> PRODUCTS</div>
<?php foreach ($_crossSellProducts as $_item): ?>
<?php $_item = Mage::getModel(‘catalog/product’)->load($_item->getId()); ?>
<div class="col-sx-12 col-sm-2 items">
<div class="img">
<a class="product-image" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>">
<img src="<?php echo $this->helper(‘catalog/image’)->init($_item, ‘small_image’)->resize(100, 150); ?>" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" />
</a>
</div>
<div class="name">
<a href="<?php echo $_item->getProductUrl() ?>">
<?php echo $this->htmlEscape($_item->getName()) ?>
</a>
</div>
<div class="price">
<?php echo $this->getPriceHtml($_item, true) ?>
</div>
</div>
<?php endforeach; ?>
<div class="clearer"></div>
</div>
<?php endif; ?>
[/php]