note 108070 deleted from function.debug-backtrace by danbrown

From: Date: Tue, 27 Mar 2012 15:56:42 +0000
Subject: note 108070 deleted from function.debug-backtrace by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186867@lists.php.net to get a copy of this message
Note Submitter: joyview at gmail dot com ---- <?php class Domore_Matrix_Model_Option extends Mage_Catalog_Model_Product_Option { public function getPrice($flag=false) { if ($this->getTitle()=='Size') { // dirty simple hack :) to get first attribute of caller function getOptionPrice($optionValue, $basePrice) // it is usefull to not rewrite Mage_Catalog_Model_Product_Option_Type_Default by placing it to local folder // it's not possible to rewrite Mage_Catalog_Model_Product_Option_Type_Default by config.xml // it is another way - by rewriting autoloader (like Aitoc) but I think it's even more confusing // so future magento versions will be supported // questions? Alexandr Martynov (joyview@gmail.com) $caller = debug_backtrace(); $optionValue = current($caller[1]['args']); // check if optionValue contains Width & Height if (strpos($optionValue,'Width=')!==false AND strpos($optionValue,'Height=')!==false) { // calculate price with price matrix return 100; } } return parent::getPrice($flag); } }

« previous php.notes (#186867) next »