Skip to content

Commit

Permalink
Remove strict typing for Mage_Catalog_Model_Product->setStockItem met…
Browse files Browse the repository at this point in the history
…hod and fix incorrect class instantiated in addStockStatusToProducts. Refs #2066 (#2208)
  • Loading branch information
colinmollenhour committed Jun 9, 2022
1 parent 90fb732 commit 9b539e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/code/core/Mage/Catalog/Model/Product.php
Expand Up @@ -713,10 +713,10 @@ public function hasStockItem()
}

/**
* @param Mage_CatalogInventory_Model_Stock_Item $stockItem
* @param Varien_Object|Mage_CatalogInventory_Model_Stock_Item $stockItem
* @return $this
*/
public function setStockItem(Mage_CatalogInventory_Model_Stock_Item $stockItem)
public function setStockItem($stockItem)
{
$this->_stockItem = $stockItem;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/CatalogInventory/Model/Stock/Status.php
Expand Up @@ -493,7 +493,7 @@ public function addStockStatusToProducts($productCollection, $websiteId = null,

/* back compatible stock item */
foreach ($productCollection as $product) {
$object = new Varien_Object(array('is_in_stock' => $product->getData('is_salable')));
$object = Mage::getModel('cataloginventory/stock_item', ['is_in_stock' => $product->getData('is_salable')]);
$product->setStockItem($object);
}

Expand Down

0 comments on commit 9b539e3

Please sign in to comment.