我是预商店的新手,因为我只销售虚拟产品,所以很难移除发货步骤。我正在使用prestashop 1.6.1。
我知道我必须修改order-carrier.tpl文件,并在这里和那里跟踪了几个帖子,但是没能把它做好。
你们中有谁对如何做到这一点有任何实际的想法吗?
发布于 2016-10-24 14:59:31
Bonjour,我就是这么做的
重写AdminOrderPreferencesController并添加一个布尔配置字段以切换此功能
$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下找到一个切换按钮
覆盖OrderController,并在init()方法中添加一个if,以将当前步骤设置为支付步骤,如果控制器在交付步骤上处于自身状态
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,他会做同样的重定向。你在一个无限的循环中
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');
}将配置参数传递到视图以修改显示。
$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}来隐藏它,并执行如下操作:
{if $bypass_shipping_step}
<style>
ul.step li{
width:25%;
}
</style>
{/if}或者导入一个更干净的专用样式表。
希望能帮上忙。
发布于 2015-09-10 12:51:23
在购物-cart.tpl中,删除对Order-Traer.tpl的调用。如果没有使用一个分页method,则必须在Tools::redirect('index.php?controller=order&step=2');中将所有重定向更改为步骤2(运输方法选择),将步骤3 Tools::redirect(‘index.php?controller=order&step=2’);重定向到Tools::redirect('index.php?controller=order&step=3');。
https://stackoverflow.com/questions/32475736
复制相似问题