I rewrite the class Mage_Sales_Model_Order_Item with these codes in mu config.xml of shopby module
<sales>
<rewrite>
<order_item>Amasty_Shopby_Model_Mostordered</order_item>
</rewrite>
</sales>
and these code is in my mostordered.php in the shopby model folder
class Amasty_Shopby_Model_Mostordered extends Mage_Sales_Model_Order_Item{
protected function _beforeSave()
{
die(var_dump($this->getData('order_id')));
return parent::_beforeSave();
}
}
the code shown in above doesn't work but when i write the die in _beforeSave in item.php in the
sales/model/order/item.php it works and it means my rewrite way is wrong in somewhere
protected function _beforeSave()
{
die('something');
parent::_beforeSave();
if (!$this->getOrderId() && $this->getOrder()) {
$this->setOrderId($this->getOrder()->getId());
}
if ($this->getParentItem()) {
$this->setParentItemId($this->getParentItem()->getId());
}
return $this;
}
my only goal is to change the _beforesave method of this php folder where was i mistaking?
update: i found another module that rewrite the same class as i want.so i think because of this my code doesn't work.what is the way to duplicate rewritng?