畢竟我找到了解決辦法。這個錯誤的原因很簡單。由magento存儲的折扣金額已簽名,這意味着它有負號。該文件的應用程序/設計/前端/ [yourfrontend]/[yourtheme] /template/checkout/total/default.phtml(這是其中所述的量是在屏幕上寫入)包含以下代碼:
<tr>
<th colspan="<?php echo $this->getColspan(); ?>" style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->escapeHtml($this->getTotal()->getTitle()); ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</th>
<td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</td>
問題是formatPrice()
函數和負面參數。一個簡單的解決方案是abs()
php函數。行
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
更改爲
<?php echo $this->helper('checkout')->formatPrice(abs($this->getTotal()->getValue())) ?>
在這裏,我們走了,問題就解決了。
我希望有幫助。