我正在使用OpenCart v.1.4.9.3而我正在尝试跳过第2步 - >
index.php?route=checkout/guest_step_2
我是否需要修改控制器?
p / s:这款opencart仅供发送查询,无需付款或评论,我尽量减少所有步骤。
答案 0 :(得分:2)
虽然可以跳过运费,但跳过付款是另一回事。您将不得不使用Cash On Delivery等付款方式,然后在guest_step_2中设置会话付款类型。 这是该页面帖子的代码,因此您只需要删除帖子,并设置付款代码(在货到付款方式中,它是“鳕鱼”) 所以
if (($this->request->server['REQUEST_METHOD'] == 'POST') && !isset($this->request->post['coupon']) && $this->validate()) {
if (isset($this->request->post['shipping_method'])) {
$shipping = explode('.', $this->request->post['shipping_method']);
$this->session->data['shipping_method'] = $this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
}
$this->session->data['payment_method'] = $this->session->data['payment_methods'][$this->request->post['payment_method']];
$this->session->data['comment'] = $this->request->post['comment'];
$this->redirect(HTTPS_SERVER . 'index.php?route=checkout/guest_step_3');
}
变为
if (isset($this->request->post['shipping_method'])) {
$shipping = explode('.', $this->request->post['shipping_method']);
$this->session->data['shipping_method'] = $this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
}
$this->session->data['payment_method'] = $this->session->data['payment_methods']['cod'];
$this->session->data['comment'] = ''; // Make comment empty
$this->redirect(HTTPS_SERVER . 'index.php?route=checkout/guest_step_3');
您还需要在此行下方移动
$this->session->data['payment_methods'] = $method_data;
注意这只是一个概念,我没有机会为你测试它,但理论上它会起作用。你也可以摆脱这段代码,虽然我把它留在上面
if (isset($this->request->post['shipping_method'])) {
$shipping = explode('.', $this->request->post['shipping_method']);
$this->session->data['shipping_method'] = $this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
}