如何在prestashop的结帐页面中隐藏发货和账单地址的更新按钮

时间:2016-11-26 17:32:44

标签: smarty prestashop prestashop-1.6

enter image description here

我希望在prestashop的结帐页面上隐藏“更新”按钮和“选择送货地址选项”。我需要编辑哪个文件才能执行此操作?

3 个答案:

答案 0 :(得分:1)

你有两种方法来隐藏这些按钮。

第一名:CSS
编辑放置在模板文件夹中的addresses.css,我想这是您案例中的默认模板,因此该文件为prestashop/themes/default-bootstrap/css/addresses.css。添加以下代码:

/* 
 * We have to add #order (or #order-opc) selector to avoid to hide buttons 
 * in addresses page that is in my account area 
*/
/* This is for 5 step checkout */
#order .address li.address_update {
    display: none;
}
#order #id_address_delivery {
    display: none;
}

/* This is for one page checkout (opc) */
#order-opc .address li.address_update {
    display: none;
}
#order-opc #id_address_delivery {
    display: none;
}

第二名:Smarty / TPL
修改模板的order-address.tpl(如果您有5步结算),否则order-opc.tpl,在您的情况下prestashop/themes/default-bootstrap/order-address.tplprestashop/themes/default-bootstrap/order-opc.tpl

搜索此选择:

<select name="id_address_delivery" id="id_address_delivery" class="address_select form-control">
    {foreach from=$addresses key=k item=address}
        <option value="{$address.id_address|intval}"{if $address.id_address == $cart->id_address_delivery} selected="selected"{/if}>{$address.alias|escape:'html':'UTF-8'}</option>
    {/foreach}
</select>

并评论它(how to comment in smarty

在文件底部注释这两行代码:

{*{capture}<a class="button button-small btn btn-default" href="{$smarty.capture.addressUrlAdd}" title="{l s='Update' js=1}"><span>{l s='Update' js=1}<i class="icon-chevron-right right"></i></span></a>{/capture}*}
{*{addJsDefL name=liUpdate}{$smarty.capture.default|@addcslashes:'\''}{/addJsDefL}*}

我想有第三种方式,使用JS,但我认为它没用。 干杯;)

答案 1 :(得分:0)

我希望在交货地址和发票地址相等时隐藏更新地址按钮,而在它们不同时显示它。请问有解决办法吗?谢谢

我尝试在ordre-address.tpl中添加以下内容:

{* ADDED IF TO REMOVE EDIT BUTTONS IF ONLY 1 ADDRESS *}
{if $cart->id_address_invoice == $cart->id_address_delivery}
{capture}<a class="button button-small btn btn-default" style="display:none;" href="{$smarty.capture.addressUrlAdd}" title="{l s='Edit Address' js=1}"><span>{l s='Edit Address' js=1}<i class="fa fa-chevron-right right"></i></span></a>{/capture} 
{else}
{capture}<a class="button button-small btn btn-default" href="{$smarty.capture.addressUrlAdd}" title="{l s='Edit Address' js=1}"><span>{l s='Edit Address' js=1}<i class="fa fa-chevron-right right"></i></span></a>{/capture}
{/if}
{* END ADDED IF *}

这将隐藏两个按钮,但是在更改复选框状态页面时需要刷新以显示按钮状态。我尝试在整个页面重新加载时刷新Javascript,但这会删除复选框状态

JQuery中是否有针对此的修复程序?

答案 2 :(得分:-1)

在主题文件夹中查找order-address.tpl。

祝你好运。