0

我正在使用 OpenCart v. 1.4.9.3,我正在尝试跳过第 2 步 ->

index.php?route=checkout/guest_step_2 

我需要修改控制器吗?

p/s:这个 opencart 只用于发送查询,不需要付款或评论,我尽量减少所有步骤。

4

1 回答 1

2

虽然可以跳过运输,但跳过付款完全是另一回事。您将不得不使用货到付款之类的支付类型,然后在 guest_step_2 中设置会话支付类型。这是该页面的帖子代码,因此您只需删除帖子,并设置付款代码(在货到付款方式中,它是“cod”)所以

    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]];
    }
于 2011-11-10T11:43:29.650 回答