I used cross sell products to mimic a color swatch on the product page. For reference please see: http://www.businessme.nl/heren-riemen/blauwe-suede-riem (it's dutch, but the picture under the product title is the cross sell product).
I used the following code i found on some forum, and placed this in the view.phtml:
<!-- Cross Sell Color Swatch --> <?php if($_crossSellProducts = $_product->getCrossSellProducts()): ?> <div class="crossSellContainer"> <?php foreach ($_crossSellProducts as $_item): ?> <?php $_item = Mage::getModel('catalog/product')->load($_item->getId()); ?> <ul class="crossSellList"> <li class="listItem"> <a class="crossSellImage" 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> </li> </ul> <?php endforeach; ?> <div class="clear"></div> </div> <?php endif;?> <!-- End cross sell -->
The problem is that this code is also showing products that are currently out of stock and do not want that. Can somebody help me with this?
Do you have System -> Configuration -> Inventory -> Display Out of Stock Products set to yes or no?
Also, did you reindex?
Thank you for your answer. "show out of stock products" is set to No and i already tried reindexing and have cleared the cache.
What happens if you switch it to the standard unaltered base theme from Magento. Same issue?
Do you have any unique customizations?
I really haven't used Cross Sell products untill now. So i haven't made any changes in the template or the base files.
I just tried switching to the default magento theme, but there aren't any cross sell product showing at all.