Reputation: 419
Can some configuration in the admin panel (or elsewhere) prevent a model rewrite from running?
This is the rewrite declaration in the module's config.xml:
<global>
<models>
<cataloginventory>
<rewrite>
<stock_item>My_Mod_CatalogInventory_Model_Stock_Item</stock_item>
</rewrite>
</cataloginventory>
</models>
</global>
The module is active - this is certain because other module code is running.
I overwrote the checkQuoteItemQty method from Mage_CatalogInventory_Model_Stock_Item, but it's checkQuoteItemQty from the parent class that is running, no idea why...
class My_Mod_CatalogInventory_Model_Stock_Item extends Mage_CatalogInventory_Model_Stock_Item
{
public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0)
{
// this code is not running...
exit('hello there');
Upvotes: 1
Views: 511
Reputation: 166086
Step 1 to debugging any rewrite — attempt to manually instantiate an object from the class yourself, and ensure that your class is the one used.
$object = Mage::getModel('cataloginventory/stock_item');
var_dump(get_class($object));
If the above doesn't output My_Mod_CatalogInventory_Model_Stock_Item
, check that your config.xml
is correct, that your Item.php
file is in the right folder, and finally, jump to the getGroupedClassName
method and add enough debugging code to determine why Magento isn't seeing your rewrite.
Upvotes: 5