javascript - How to pass variable into the Data.php in Magento? -
so working on \app\code\core\mage\checkout\helper\data.php @ moment. , trying call variable doesn't seem it's working.
update 1 have been able pass variable method this, need declare product id manually, there allows method product id base on product added cart?
$_productid = mage::registry('current_product')->getid();
is not working in case.
my test below:
public function formatprice($price) { $_productid = 463089; // need call current product enter id manually $_product = mage::getmodel('catalog/product')->load($_productid); $oldprice = $_product->getfinalprice(); //should original product price return $this->getquote()->getstore()->formatprice($oldprice); }
the result after refresh page :
everything turns 670
many thanks
you're "working on \app\code\core\mage\checkout\helper\data.php", first problem. never edit magento core.
assuming move own event observer modify data, loading product id static variable set 463089
, doing nothing calculate new price, displaying products price.
from code makes perfect sense price remain same since manually setting product pull price from.
it number of reasons why quantity of item not changing price. might have other core edits may have made.
Comments
Post a Comment