Post by pandey78 » Wed Mar 21, 2012 1:08 am

I am using opencart 1.5.2.1

When user clicks on "add to cart button", a small notification appears on the top stating the product is added to the cart.

What i am looking for is : when user clicks the "add to cart" button, he/she should be redirected to yourdomain/index.php?route=checkout/cart as most of my users skip the small notification and keep on clicking the "add to cart" button.

I modified the home/catalog/controller/checkout/cart.php at line 540


if (!$json) {
$this->cart->add($this->request->post['product_id'], $quantity, $option);

$json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
$json['redirect'] = str_replace('&', '&', $this->url->link('checkout/cart'));
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['payment_method']);
unset($this->session->data['payment_methods']);


ADDED : $json['redirect'] = str_replace('&', '&', $this->url->link('checkout/cart'));
Now the user is redirected to checkout/cart from Home page and from category page. BUT if the user goes to product description page and clicks "add to cart" button there, it does not redirect to the checkout/cart page.

PLEASE HELP ME TO FIND A SOLUTION FOR IT.

YOU CAN MAIL ME AT ONLINETEACHERS[AT]YAHOO.CO.IN

Newbie

Posts

Joined
Wed Mar 21, 2012 12:46 am

Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am

Post by gogoweb » Wed Jun 21, 2017 10:01 pm

Just wanted to add here two extensions that can help for OpenCart 2+

With this one you can configure where the customer can go after they click Add to Cart -- cart or checkout page.
https://www.opencart.com/index.php?rout ... 20checkout

With this one you can add products and discounts to cart via link and also share your cart with a simple link.
https://www.opencart.com/index.php?rout ... n_id=31009

:)

All mods | OpenCart Bulk Related Products Ultimate Edition |GeoIP hide Prices / no add to cart by country| CSS override | Direct link to checkout / skip add to cart / buy now link | AUTO pilot - reward & purchase points


New member

Posts

Joined
Sat Oct 18, 2014 6:45 pm

Who is online

Users browsing this forum: No registered users and 95 guests