I’ve built a modified search form on top of Magento’s advanced search module.
I’ve found a few tutorials like this one showing how to hide/remove Out of Stock products from Magento’s advanced search results, but I want to implement a checkbox on the form which allows customers to choose whether or not they want to include Out of Stock products in their results.
I’m at the point where I’m determined to find a solution, and I think I may need to add a filter or something to this variable:
<?php $_productCollection=$this->getLoadedProductCollection() ?>
<?php if(!$_productCollection->count()): ?>
This code is at the top of the advanced search module’s corresponding .phtml layout file (list-as.phtml), and I know it’s grabbing the products for the search results.
Am I on the right track, or do I need to focus on the files mentioned in the linked tutorial above? I’m hoping someone has done something like this before within Magento. Thanks for any help/guidance guys.
I’d think that something like the following would work (assuming $show_oos is a boolean flag for if a user wants out of stock items shown):