is it possible in magento php to invoke the method from parent class rather than from the overridden one,
I have extension overrides (A_CustomOptions_Model_Catalog_Product_Option extends Mage_Catalog_Model_Product_Option) and it overrides the construct method and I have got another extension wants to use the construct of parent class Mage_Catalog_Model_Product_Option
is there a way to do this???
more explanation:
class A_CustomOptions_Model_Catalog_Product_Option extends Mage_Catalog_Model_Product_Option {
protected function _construct() {
parent::_construct();
$this->_init('customoptions/product_option');
}
}
in another extension i'm getting collection for options
public function getOptions($srcId) {
$options = Mage::getModel('catalog/product_option')
->getCollection()
->addTitleToResult(Mage::app()->getStore()->getId())
->addPriceToResult(Mage::app()->getStore()->getId())
->addProductToFilter($srcId)
->addValuesToResult();
return $options;
}
however because this parent class Mage_Catalog_Model_Product_Option is overridden, it doesn't return me the parent options not overridden ones Thanks
yes you can call parent constructor with use of below code
class A_CustomOptions_Model_Catalog_Product_Option extends Mage_Catalog_Model_Product_Option
{
public function __construct()
{
parent::__construct();
}
}
As your updated answer i think override class loaded at the last that might be not work.
hope this will sure work for you in simple OOP concept,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.