I would like to change the “Continue Shopping” button on the shopping cart to point back to the referring page rather than the common/home page. The referring page is outside of Opencart. I found a file (/catalog/controller/checkout/cart.php which has an entry near the top of the file:
'href' => $this->url->link('common/home’),
Is this the entry that should be modified? If so, what should I change it to? I would like the customer to return to the product page (outside of Opencart) on which they clicked the “Add to Cart” button.
In catalog/controller/checkout/cart.php file,
find:
Code: Select all
$product_id = (int)$this->request->post['product_id'];
Code: Select all
$this->session->data['product_id'] = (int)$product_id;
Code: Select all
$data['continue'] = $this->url->link('common/home');
Code: Select all
if (!empty($this->session->data['product_id'])) {
$data['continue'] = $this->url->link('product/product', 'product_id=' . (int)$this->session->data['product_id']);
} else {
$data['continue'] = $this->url->link('common/home');
}
Code: Select all
$this->load->model('catalog/manufacturer');
Code: Select all
if (!empty($this->session->data['product_id'])) {
unset ($this->session->data['product_id']);
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Just to be sure. Will this work for a product listing that is outside of the Opencart system? And sorry, yes I am using Opencart 3.0.2.0 - but only for its cart and checkout. The Add to Button on a product page is not in Opencart.

Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
https://www.opencart.com/index.php?rout ... n_id=11443
So, for example, the call to opencart from a product page (outside of opencart) is made using:
http://www.mysite.com/index.php?route=c ... quantity=1
Does this change anything in your analysis?
Thank you so much for your input and advice.
I changed
$data['continue'] = $this->url->link('common/home’);
to
$data['continue'] = "javascript:history.back()";
It seems to work OK. Is there any downside to this implementation?
Well, the downside is, that you're talking about an expensive Custom Mod,is there any downside to this implementation
and this means, that nobody else would be able to know about it's doings.
It would therefore be much better, to contact the Seller, I assume, to get
your matters solved, commercial Extensions are not part of this here..
just figured...

Ernie
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
It would change something, yes. The product_id and the quantity must be parameted as a POST request. Not as a GET request when using any API toward the OC cart.So, for example, the call to opencart from a product page (outside of opencart) is made using:
http://www.mysite.com/index.php?route=c ... quantity=1
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Hello!straightlight wrote: ↑Sat Mar 17, 2018 6:43 amNo OC version posted. However, it can be done. Followed is for v3.0.2.0 release:
In catalog/controller/checkout/cart.php file,
find:
add below:Code: Select all
$product_id = (int)$this->request->post['product_id'];
Then, find:Code: Select all
$this->session->data['product_id'] = (int)$product_id;
replace with:Code: Select all
$data['continue'] = $this->url->link('common/home');
Then, in catalog/controller/product/product.php file, find:Code: Select all
if (!empty($this->session->data['product_id'])) { $data['continue'] = $this->url->link('product/product', 'product_id=' . (int)$this->session->data['product_id']); } else { $data['continue'] = $this->url->link('common/home'); }
add below:Code: Select all
$this->load->model('catalog/manufacturer');
This should resolved the issue.Code: Select all
if (!empty($this->session->data['product_id'])) { unset ($this->session->data['product_id']); }
I've modified the 2 php files, but the "continue shopping" still redirects me to common/home.
I cleared all cache, but I'm using Journal 3 theme. I don't see why, but this could be the problem maybe?
Thanks for the help!!
Users browsing this forum: No registered users and 2 guests