如何在 prestashop 1.6.1 上删除交付运输步骤? [英] How to remove delivery shipping step on prestashop 1.6.1?

查看:41
本文介绍了如何在 prestashop 1.6.1 上删除交付运输步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 prestashop 的新手,我在删除送货步骤时遇到了很大的麻烦,因为我只销售虚拟产品.我使用的是 prestashop 1.6.1.

I'm new to prestashop and I'm having major trouble removing the delivery shipping step because I only sell virtual products. I am using prestashop 1.6.1.

我知道我必须修改 order-carrier.tpl 文件并在这里​​和那里关注了几个帖子,但无法正确完成.

I know I have to modify order-carrier.tpl file and have followed several posts here and there but couldn't get it done right.

你们中有人对如何做到这一点有任何实际想法吗?

Does any of you have any actual idea on how to do this ?

推荐答案

Bonjour,这就是我所做的

覆盖 AdminOrderPreferencesController 并添加一个布尔配置字段来切换此功能

Bonjour, here is what i did

Override AdminOrderPreferencesController and add a boolean configuration field to toggle this functionnality

$this->fields_options = array(
    [...]
    'PS_ORDER_PROCESS_BYPASS_SHIPPING' => array(
        'title' => $this->l('Bypass shipping step'),
        'hint' => $this->l('Do not show shipping step in order process.'),
        'validation' => 'isBool',
        'cast' => 'intval',
        'type' => 'bool'
    )
);

您现在可以在 Backoffice 的 Preferences > Orders

You can now find a toggle button in Backoffice under Preferences > Orders


覆盖 OrderController 并在 init() 方法中添加一个 if 以将当前步骤设置为 payment step 如果控制器在交付步骤


Override OrderController and add an if in init() method to set the current step to payment step if the controller inits itself on delivery step

public function init()
{
    global $orderTotal;

    parent::init();

    $this->step = (int)Tools::getValue('step');

    // HERE IT IS
    if((bool)Configuration::get('PS_ORDER_PROCESS_BYPASS_SHIPPING') && $this->step == self::STEP_DELIVERY){
        $this->step = self::STEP_PAYMENT;
    }

    if (!$this->nbProducts) {
        $this->step = -1;
    }

也在initContent() 方法中绕过付款步骤的CGV 检查验证.
如果你不这样做,CGV 将永远不会被检查,它会在交付步骤重定向你,你会告诉他他实际上是在付款步骤,他会检查再次为CGV,他会做同样的重定向......你就陷入了无限循环

Also bypass the CGV checking verification on payment step in initContent() method.
If you don't, CGV will never be checked, it will redirect you on delivery step, you will tell him that he is in fact on payment step, he will check for CGV again, he will do the same redirection ... and you are in an infinite loop

case OrderController::STEP_PAYMENT:
    $cgv = Tools::getValue('cgv') || $this->context->cookie->check_cgv;

    if (
        !(bool)Configuration::get('PS_ORDER_PROCESS_BYPASS_SHIPPING') && // HERE IT IS
        $is_advanced_payment_api === false && Configuration::get('PS_CONDITIONS')
        && (!Validate::isBool($cgv) || $cgv == false)
    ) {
        Tools::redirect('index.php?controller=order&step=2');
    }

将配置参数传递给视图修改显示

Pass the configuration parameter to the view to modify display

$this->context->smarty->assign('bypass_shipping_step', (bool)Configuration::get('PS_ORDER_PROCESS_BYPASS_SHIPPING'));

在您的观点中,您是否使用一些 if
order-steps.tpl 中,您可以在第四个 li 周围添加 {if not $bypass_shipping_step}...{/if} 以隐藏它,并做类似的事情:

And in your views, do you styling stuff with some if
In order-steps.tpl you can add an {if not $bypass_shipping_step}...{/if} around the fourth li to hide it, and do something like :

{if $bypass_shipping_step}
<style>
    ul.step li{
        width:25%;
    }
</style>
{/if}

或者导入一个专用的样式表,这样会更简洁.


希望有帮助.

or import a dedicated stylesheet which would be cleaner.


Hope it helped.

这篇关于如何在 prestashop 1.6.1 上删除交付运输步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆