重定向到 Opencart 主页
Redirecting to main page Opencart
点击Opencart页面中的商品后,会再次重定向到主页,而不是产品描述页面。我还在 URL 上添加了产品页面的手动路由 index.php?route=product/product&product_id=795 但仍然面临同样的问题。我还发现这个页面一次又一次地调用,直到它给出错误 "This page isn't working"。请帮我解决这个问题。
你需要像这样传递一个额外的变量。
index.php?route=product/product&product_id=795&redirect=home
现在转到 catalog/controller/product/product.php
并将下面给出的代码粘贴到索引方法中。像这样。
public function index() {
if (isset($this->request->get['redirect'])) {
$this->redirect($this->url->link('common/home', '', 'SSL'));
}
或
如果您想在没有客户 url.then 的情况下动态更改它,请转到
catalog/controller/product/category.php
并找到此代码。
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
并替换为
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url.'&redirect=home')
和catalog/controller/product/product.php
将如上所示。
点击Opencart页面中的商品后,会再次重定向到主页,而不是产品描述页面。我还在 URL 上添加了产品页面的手动路由 index.php?route=product/product&product_id=795 但仍然面临同样的问题。我还发现这个页面一次又一次地调用,直到它给出错误 "This page isn't working"。请帮我解决这个问题。
你需要像这样传递一个额外的变量。
index.php?route=product/product&product_id=795&redirect=home
现在转到 catalog/controller/product/product.php
并将下面给出的代码粘贴到索引方法中。像这样。
public function index() {
if (isset($this->request->get['redirect'])) {
$this->redirect($this->url->link('common/home', '', 'SSL'));
}
或 如果您想在没有客户 url.then 的情况下动态更改它,请转到
catalog/controller/product/category.php
并找到此代码。
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
并替换为
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url.'&redirect=home')
和catalog/controller/product/product.php
将如上所示。