OK, now I'm confused (more than usual ;)) ... why on the earth they did this (maybe they just hate me ;))
While I was looking for the name of event fired when product is in stock status is checked I found this "gem" of the code in Mage_Catalog_Model_Product:
public function isInStock()
{
return $this->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED;
}
WTF?!?
So ... $product->isInStock() will always return TRUE if product is enabled ... WHAT!?! Who put (or left) that stupidity in the code!???
And real stock check is:
/**
* Check is product available for sale
*
* @return bool
*/
public function isSalable()
{
Mage::dispatchEvent('catalog_product_is_salable_before', array(
'product' => $this
));
$salable = $this->isAvailable();
$object = new Varien_Object(array(
'product' => $this,
'is_salable' => $salable
));
Mage::dispatchEvent('catalog_product_is_salable_after', array(
'product' => $this,
'salable' => $object
));
return $object->getIsSalable();
}
And yeah, there is also isSaleable (typo?) alias ... Huh!?
Whenever I look into Magento core code I get ton's of the possible great posts for the The Daily WTF! :D
In the end one can hope that they (and no one else) did not used isInStock method for checking if product is in stock!!!!