简体   繁体   English

重定向到Opencart主页

[英]Redirecting to main page Opencart

After clicking on the item in the Opencart page, it will again redirect to the main page instead of the product description page. 单击Opencart页面中的项目后,它将再次重定向到主页而不是产品描述页面。 I have also added the manual route of the product page on URL as index.php?route=product/product&product_id=795 but still facing the same problem. 我还在URL上将产品页面的手动路由添加为index.php?route = product / product&product_product = id795,但是仍然遇到相同的问题。 I have also found that this page calls again and again till it gives error as "This page isn't working". 我还发现,该页面会反复调用,直到出现错误提示为“此页面无法正常工作”为止。 Please help me with this. 请帮我解决一下这个。

You need to pass one extra variable something like this. 您需要传递一个额外的变量,像这样。

index.php?route=product/product&product_id=795&redirect=home

Now to go to catalog/controller/product/product.php and paste the given below code inside the index method. 现在转到catalog/controller/product/product.php并将下面给出的代码粘贴到index方法中。 something like this. 这样的事情。

public function index() {
     if (isset($this->request->get['redirect'])) {
            $this->redirect($this->url->link('common/home', '', 'SSL'));
        }

OR if you want to change it dynamically with out custome url.then go to 或者,如果您想在没有自定义网址的情况下进行动态更改,请转到

catalog/controller/product/category.php and find this code. catalog/controller/product/category.php并找到此代码。

'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)

And replace with 并替换为

'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url.'&redirect=home')

And catalog/controller/product/product.php will be as given above. catalog/controller/product/product.php将如上所述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM