Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • 'is_in_stock' or inventory filter in product collection in magento

    • 0
    • 0
    • 0
    • 0
    • 2
    • 0
    • 0
    • 0
    • 10.7k
    Comment on it

    Below code will return you the products of a category that have status 'Enable' , Visibility 'catalog,search' and Stock Availability ' In stock'.

    $productDetails    = Mage::getModel('catalog/category')->load($cat_id)
    $productDetails -> addAttributeToFilter('visibility', array('in' => array(4) ));
    $productDetails -> addAttributeToFilter('status', array('in' => array(1) ));

 2 Comment(s)

  • We have recently updated one of our extension for Magento designed to improve magento product filters. Now you can filter products at catalog and search results pages by stock

  • i was having a complex script that i needed to extract all the configurable products filtered by colors and get the size for each one but only those with stock.
    This did the trick,,

    Thank you
Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: