-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Category Product Collection shows products out of stock #41
Comments
See also pull request #42 $filters = $observer->getCategoryId(); Use: if ($collection = $observer->getCollection()) {
$filters = $collection->getLimitationFilters(); (In full) public function catalogProductCollectionApplyLimitationsBefore(Varien_Event_Observer $observer) {
$categoryId = $observer->getCategoryId();
if ($collection = $observer->getCollection()) {
$filters = $collection->getLimitationFilters();
if(isset($filters['visibility']) && !Mage::getStoreConfig('cataloginventory/options/show_out_of_stock')) {
$storeId = Mage::app()->getStore()->getId();
$selectFrom = $collection->getSelect()->getPart(Zend_Db_Select::FROM);
if(!isset($selectFrom['stock_status_index'])) {
$collection
->getSelect()
->join(
array(
'stock_status_index' => Mage::getSingleton('core/resource')->getTableName('demac_multilocationinventory/stock_status_index')
),
'e.entity_id = stock_status_index.product_id' .
' AND stock_status_index.qty > 0' .
' AND stock_status_index.is_in_stock = 1' .
' AND stock_status_index.store_id = ' . $storeId,
array()
);
}
}
}
} |
Hello There We are using brand extension in magento 1.9.2.4. We are using this query $products = Mage::getModel('catalog/product')->getCollection();
Please let me know how we can display both product in result page please suggest me how can change query |
When using $_productCollection=$this->getLoadedProductCollection(); inside catalog/product/list.phtml it shows all products (including out of stock). And Mage::getStoreConfig('cataloginventory/options/show_out_of_stock') is false.
I've tried
with no luck.
How can I get it working with this extension?
The text was updated successfully, but these errors were encountered: