Skip to content

Commit

Permalink
Fixed Mage_Catalog_Model_Product_Status::addSaleableFilterToCollectio…
Browse files Browse the repository at this point in the history
…n() does nothing
  • Loading branch information
fballiano committed Sep 26, 2022
1 parent a5286c9 commit ecf4611
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ protected function _prepareCollection()
->setStore($this->getStore())
->addAttributeToSelect($attributes)
->addAttributeToSelect('sku')
->addAttributeToSelect('gift_message_available')
->addStoreFilter()
->addAttributeToFilter('type_id', array_keys(
Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray()
))
->addAttributeToSelect('gift_message_available');

Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);

$this->setCollection($collection);
return parent::_prepareCollection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ protected function _prepareCollection()
->addAttributeToSelect('attribute_set_id')
->addAttributeToFilter('type_id', ['in' => $this->getAllowedSelectionTypes()])
->addFilterByRequiredOptions()
->addStoreFilter();
->addStoreFilter()
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);

if ($products = $this->_getProducts()) {
$collection->addIdFilter($this->_getProducts(), true);
Expand All @@ -79,8 +80,6 @@ protected function _prepareCollection()
$this->setEmptyText($this->__('Please enter search conditions to view products.'));
}

Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);

$this->setCollection($collection);

return parent::_prepareCollection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ protected function _prepareData()
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addAttributeToSort('position', 'asc')
->addStoreFilter()
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
->addMinimalPrice()

->joinTable('bundle/option', 'parent_id=entity_id', ['option_id' => 'option_id'])
->joinTable('bundle/selection', 'option_id=option_id', ['product_id' => 'product_id'], '{{table}}.product_id='.$this->getProduct()->getId());

Expand All @@ -52,7 +52,6 @@ protected function _prepareData()
$collection->addIdFilter(Mage::getSingleton('checkout/cart')->getProductIds(), true);
}

Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
$collection->getSelect()->group('entity_id');

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Checkout/Block/Cart/Crosssell.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ protected function _getCollection()
->getProductCollection()
->setStoreId(Mage::app()->getStore()->getId())
->addStoreFilter()
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
->setPageSize($this->_maxItemCount);
$this->_addProductAttributesAndPrices($collection);

Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Tag/Block/Product/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ protected function _getProductCollection()
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addTagFilter($this->getTag()->getId())
->addStoreFilter(Mage::app()->getStore()->getId())
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
->addMinimalPrice()
->addUrlRewrite()
->setActiveFilter();
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_productCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection(
$this->_productCollection
);
Expand Down

0 comments on commit ecf4611

Please sign in to comment.