簡體   English   中英

在“總計”框中顯示“運費文字”-結帳

[英]Display 'Shipping text' in Grand Totals box - checkout

如果尚未計算出運費,我想在'Subtotal'總計”框中的'Subtotal'行下方顯示一句話( 要增加額外的運費 )。

這只是為了通知客戶還有額外的運輸費用,這些費用也將在以后的(結帳)階段添加到他們的訂單中。

如果沒有計算運費,我可以做一個IF..ELSE來顯示此文本,如果已經計算出運費,則顯示帶有運費說明的運費。

有什么想法可以修改模板/核心文件嗎?

提前致謝

編輯:總計框從此行位於checkout / cart.phtml中

   <?php echo $this->getChildHtml('totals'); ?>

檢查totals.phtml我得到以下信息,

    <table id="shopping-cart-totals-table">
    <col />
    <col width="1" />
    <tfoot>
        <?php echo $this->renderTotals('footer'); ?>
    </tfoot>
    <tbody>
        <?php echo $this->renderTotals(); ?>
    </tbody>
    </table>

我檢查了顯示SubTotal,Shipping(計算時)和GrandTotal的核心文件

應用/代碼/核心/法師/銷售/型號/報價/地址/總計/Subtotal.php

  public function fetch(Mage_Sales_Model_Quote_Address $address)
  {
    $address->addTotal(array(
        'code'  => $this->getCode(),
        'title' => Mage::helper('sales')->__('Subtotal'),
        'value' => $address->getSubtotal()
    ));
    return $this;
  }

應用/代碼/核心/法師/銷售/型號/報價/地址/總計/Shipping.php

  public function fetch(Mage_Sales_Model_Quote_Address $address)
  {
    $amount = $address->getShippingAmount();
    if ($amount != 0 || $address->getShippingDescription()) {
        $title = Mage::helper('sales')->__('Shipping & Handling');
        if ($address->getShippingDescription()) {
            $title .= ' (' . $address->getShippingDescription() . ')';
        }
        $address->addTotal(array(
            'code' => $this->getCode(),
            'title' => $title,
            'value' => $address->getShippingAmount()
        ));
    }
    return $this;
  }

但是我不確定這些文件中的任何一個是否需要編輯或其他文件。 此后我無法繼續進行,因此需要此后的外部幫助。

使用Subtotal.php文件,我添加了另一個IF條件,並更改了如下代碼:

 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
    $amount = $address->getShippingAmount();
    /* MY MODIFIED CODE */
    if($amount == 0)
    {

            $address->addTotal(array(
            'code' => $this->getCode(),
            'title' => Mage::helper('sales')->__('Subtotal <br/><span style="font-size:12px;color:#A4A5A7;">(Additional Shipping cost to be added)</span>'),
            'value' => $address->getSubtotal()
        ));
    }
    /* --------------- */
    else {
        $title = Mage::helper('sales')->__('Subtotal');
        $address->addTotal(array(
            'code' => $this->getCode(),
            'title' => $title,
            'value' => $address->getSubtotal()
        ));
    }
    return $this;
 }

在小計行完全正確之后,這會添加一行“要增加的附加運輸成本”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM