php Prestashop 1.7,在运输承运人步骤之前隐藏运输价格(始终显示免费)

dpiehjr4  于 2023-10-15  发布在  PHP
关注(0)|答案(1)|浏览(111)

使用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;

问候

trnvg8h3

trnvg8h31#

您可以创建一个主题并修改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**执行相同的操作
Good luck:)

相关问题