有许多页面需要客户登录才能查看。我如何为购物车页面/index.php?route=checkout/cart
答案 0 :(得分:1)
我认为您的意思是,如果他们的购物车页面正确无误,您是否想让客户登录?如果是这样,这就是你如何做到的。打开/catalog/controller/checkout/cart.php
并找到此行
public function index() {
在此行下方,添加以下代码
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('checkout/cart', '', 'SSL');
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
答案 1 :(得分:0)
对于2.xx,您需要添加response->redirect()
而不是redirect()
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('checkout/cart', '', 'SSL');
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
}