Magento Exclude Out Of Stock From Front Page


Magento Exclude Out Of Stock From Front Page: In you are working with magento you often need to exclude the out of stock products from front page. Many times we want to show the in stock items. It depends upon our need. Here we are going to explain the syntax and method to exclude the items from the front page that are out of stock.


Magento Exclude Out Of Stock From Front Page

Here is syntax to exclude out of stock products and show only in stock items.

Magento Exclude Out Of Stock From Front Page



<?php if (($products = $this->getProductCollection()) && $products->getSize()){
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
}
?>

The above method will filter the in stock items and exclude the out of stock items.


Advertisements

Add Comment

📖 Read More