cancel
Showing results for 
Search instead for 
Did you mean: 

Cross Sell showing product out of stock

Cross Sell showing product out of stock

Hi All,

 

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?

 

Thanks 

4 REPLIES 4

Re: Cross Sell showing product out of stock

Do you have System -> Configuration -> Inventory -> Display Out of Stock Products set to yes or no?

 

Screenshot 2016-02-24 15.46.27.png

 

Also, did you reindex?

-Kris
4x Certified, Blogger @ xgento.com

Re: Cross Sell showing product out of stock

Thank you for your answer. "show out of stock products" is set to No and i already tried reindexing and have cleared the cache.

Re: Cross Sell showing product out of stock

What happens if you switch it to the standard unaltered base theme from Magento. Same issue?

 

Do you have any unique customizations? 

-Kris
4x Certified, Blogger @ xgento.com

Re: Cross Sell showing product out of stock

Hi,

 

 

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.