php - How to filter related.phtml by in-stock products only in magento -
how 1 go filtering magento's related products block show in stock products?
<?php foreach($this->getitems() $_item): ?> <li class="item"> <?php if(!$_item->iscomposite() && $_item->issaleable()): ?> <?php if (!$_item->getrequiredoptions()): ?> <input type="checkbox" class="checkbox related-checkbox" id="related-checkbox<?php echo $_item->getid() ?>" name="related_products[]" value="<?php echo $_item->getid() ?>" /> <?php endif; ?> <?php endif; ?> <div class="product"> <a href="<?php echo $_item->getproducturl() ?>" title="<?php echo $this->htmlescape($_item->getname()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->htmlescape($_item->getname()) ?>" /></a> <div class="product-details"> <p class="product-name"><a href="<?php echo $_item->getproducturl() ?>"><?php echo $this->htmlescape($_item->getname()) ?></a></p> <?php echo $this->getpricehtml($_item, true, '-related') ?> <?php if ($this->helper('wishlist')->isallow()) : ?> <a href="<?php echo $this->getaddtowishlisturl($_item) ?>" class="link-wishlist"><?php echo $this->__('add wishlist') ?></a> <?php endif; ?> </div> </div> </li> <?php endforeach ?>
i've uploaded current iteration of magentos realted.phtml github:
wrap <li>
in <?php if ($_item->issaleable()): ?> . . . <?php endif; ?>
.
Comments
Post a Comment