2012-10-17 78 views
1

我有一個magento 1.7.0.2安裝。我使用優惠券創建了購物價格購物車規則。一切都很好,只是在magento(購物車,結帳,...)中顯示的折扣金額是一個極值。我發現極值是2^64(18 446 744 073 709 550 520)。規則的配置無關緊要,顯示的折扣始終是2^64。Magento優惠券顯示極值折扣

cart total example

小計優良,航運是細的小計施加折扣(10%)後的這些的總和爲11669.(10961)的結果爲9864. 9864 + 708 = 10573是可接受的結果。所以一切都是完美的,除了顯示的折扣。

我不知道哪裏出了問題。我找不到相關文件。請幫忙。

非常感謝, 伊什特萬

回答

2

畢竟我找到了解決辦法。這個錯誤的原因很簡單。由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())) ?> 

在這裏,我們走了,問題就解決了。

我希望有幫助。