I am retrieving a product collection based on the current category. I need this collection to contain both in and out of stock products, and I also need the pricing data to be displayed correctly.
My store is configured to store product pricing as inclusive of tax, and to show prices as both inclusive and exclusive on the store front.
The code for obtaining the collection is as follows:
$category = Mage::registry('current_category');
$_productCollection = Mage::getModel('catalog/product')->getCollection()
->addCategoryFilter($category)
->addAttributeToSelect(['sku', 'name', 'price'])
->addAttributeToFilter('status', 1)
->addAttributeToSort('jump_number', Varien_Data_Collection::SORT_ORDER_ASC);
The issue with the above is that when loading the price block using the getPriceHtml()
method, both inclusive and exclusive prices are displayed as the inclusive price.
After some research, I found that adding a addFinalPrice()
method to my collection gives me the pricing expected - a correct exclusive and correct inclusive price.
However, if I include the addFinalPrice()
method, my collection no longer contains out of stock products.
Is there a way of returning the correct pricing data and having the collection contain both saleable and out of stock products?