My all out of stock products are not shown at front.

However, I would like to show some selected out of stock products in front.

I have a custom attribute called show_out_of_stock_product and is yes/no type.

I want to show only those out of stock products that are set show_out_of_stock_product to yes.

I have tried to do it through observer using catalog_product_collection_load_before event, but no luck so far.

My approach was:

    $layer = Mage::getSingleton('catalog/layer');
    $category = $layer->getCurrentCategory();

    $products = Mage::getModel('catalog/product')

    $showOutCollection = $products
        ->addAttributeToFilter('out_stock_show_product', true)

Is it possible to add this $showOutCollection to the category with all other products.

  • Can you print $products and $showOutCollection ? collections are got ot not?? – Ajay Patel Mar 18 '16 at 4:06
  • Yes, I can confirm collection is set and can print them. – Adarsh Khatri Mar 18 '16 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.