Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento 无法显示折扣金额_Magento - Fatal编程技术网

Magento 无法显示折扣金额

Magento 无法显示折扣金额,magento,Magento,在Magento中,我根据创建了一个模块 但我无法显示折扣金额(参见此) 似乎在fetch函数中,$address->addTotal()无法显示折扣金额。可能是什么问题?请帮忙 function fetch(Mage_Sales_Model_Quote_Address $address) { //code... ... .... $address->addTotal(array( 'code' => 'Discount', 'title' =>

在Magento中,我根据创建了一个模块

但我无法显示折扣金额(参见此)

似乎在fetch函数中,
$address->addTotal()
无法显示折扣金额。可能是什么问题?请帮忙

function fetch(Mage_Sales_Model_Quote_Address $address) {
//code...
 ...
 ....
 $address->addTotal(array(
      'code' => 'Discount',
      'title' => 'Discount',
       'value' => $amt
        //'value' => '18' hardocded the amount, still not working
 ));

 //code...
 .....
 return $address;
}
所以工作代码是

function fetch(Mage_Sales_Model_Quote_Address $address) {
    //code...
     ...
     ....
     $address->addTotal(array(
          'code' => 'discount',
          'title' => 'discount',
           'value' => $amt
            //'value' => '18' hardocded the amount, still not working
     ));

     //code...
     .....
     return $address;
    }

请先估计运费,然后它应该显示它不依赖于运费,但我也尝试了你的方式,但没有工作。我想你忘了返回$address;没有返回$address。我也试过退回$this。检查一下这个也希望这个能帮助你