簡體   English   中英

Prestashop 1.7,在承運商步驟之前隱藏運費(始終顯示免費)

[英]Prestashop 1.7 , Hide Shipping Price (which always shows free) before the Shipping carrier step

使用 Prestashop 1.7.6 我有一個關於免費送貨的問題,眾所周知,它總是顯示免費(因為它在后台運營商中默認選擇),直到它在運營商選擇步驟中被更改。

所以我需要指導的是,我想隱藏運費,直到“運輸方式”步驟結賬。 (或者如果它說“將在下一步計算”)

這是 cartpresenter.php 代碼,我想它需要修改嗎?

if (isset($deliveryOptionList) && count($deliveryOptionList) > 0) {
            foreach ($deliveryOptionList as $option) {
                foreach ($option as $currentCarrier) {
                    if (isset($currentCarrier['is_free']) && $currentCarrier['is_free'] > 0) {
                        $shippingDisplayValue = $this->translator->trans('Free', [], 'Shop.Theme.Checkout');
                        break 2;

最好的祝福

您可以創建主題並修改 smarty 模板:

對於購物車

復制到您的主題並修改/themes/classic/templates/checkout/_partials/cart-detailed-totals.tpl並在第 31 行插入條件並在第 47 行關閉它:

<div class="card-block">
  {foreach from=$cart.subtotals item="subtotal"}
    {if $subtotal && $subtotal.value|count_characters > 0 && $subtotal.type !== 'tax'}
        {if $subtotal.type === 'shipping' && $subtotal.amount > 0} {* line added *}
        <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}">
          <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}">
            {if 'products' == $subtotal.type}
              {$cart.summary_string}
            {else}
              {$subtotal.label}
            {/if}
          </span>
          <span class="value">
            {if 'discount' == $subtotal.type}-&nbsp;{/if}{$subtotal.value}
          </span>
          {if $subtotal.type === 'shipping'}
              <div><small class="value">{hook h='displayCheckoutSubtotalDetails' subtotal=$subtotal}</small></div>
          {/if}
        </div>
     {/if}  {* line added *}
    {/if}
  {/foreach}
</div>

結帳時

對文件/themes/classic/templates/checkout/_partials/cart-summary-subtotals.tpl做同樣的事情

祝你好運:)

暫無
暫無

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

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