Php I';我正在尝试向Magento签出添加任意值

Php I';我正在尝试向Magento签出添加任意值,php,magento,checkout,Php,Magento,Checkout,我试图在订单金额中添加任意金额 在此文件中\app\code\core\Mage\Sales\Model\Order\Payment.php 在这个函数中 public function setOrder(Mage_Sales_Model_Order $order) { 我尝试添加这两行 $this->_order->setBaseGrandTotal(29); $this->_order->setGrandTotal(29); 为什么订单金额没有变为29美元 这是

我试图在订单金额中添加任意金额

在此文件中\app\code\core\Mage\Sales\Model\Order\Payment.php

在这个函数中

public function setOrder(Mage_Sales_Model_Order $order)
{
我尝试添加这两行

$this->_order->setBaseGrandTotal(29);

$this->_order->setGrandTotal(29);
为什么订单金额没有变为29美元

这是向订单值添加任意金额的正确方法吗


谢谢

不要因为升级问题而像这样更改核心文件

我建议使用观察员。 您可以通过以下方式侦听事件sales_quote_add_项目并以编程方式更改总计:

$observer->getEvent()->getQuoteItem()->setOriginalCustomPrice([your price]);

$this->\u order->setGrandTotal()+29是的$this->\u order->setGrandTotal(29)应该至少将其设置为29,不是吗?我不知道,该方法是如何定义的?