elb elb
elb elb
Offline
Hello everyone,

Can someone help me out with this one please:
When adding a product to the cart i want to go directly to the checkout page instead of the cart page
what is the best way to do this please

thanks in advance
Wednesday, September 21 2016, 04:08 PM
Share this post:
Responses (3)
  • Accepted Answer

    Wednesday, September 21 2016, 05:04 PM - #Permalink
    OK I see, I thought that it's already redirecting to the cart page because you said "go directly to the checkout page instead of the cart page". I will tell you how to achieve it below but please note that this modification will override some of the core files and not update-proof, so you will lose the modifications after an Arastta update. If you want this modification to be update-proof, I can provide you a custom work, so you can ask me.

    So here is how you can manage it:

    Open this file:
    /catalog/controller/checkout/cart.php

    And find this line:
    $this->cart->add($product_id, $quantity, $option, $recurring_id);

    Add this code just below:
    $json['redirect'] = str_replace('&', '&', $this->url->link('checkout/checkout', ''));

    And then open this file:
    /catalog/view/theme/YOUR_THEME/template/product/product.tpl

    and find this line:
    if (json['success']) {
    cart.after('add', json);

    Add the following code just above it:
    if (json['redirect']) {
    location = json['redirect'];
    }

    That's all. But before trying, it's better to refreshing your modifications from Modification page (Extensions > Modification).

    Regards
    The reply is currently minimized Show
  • Accepted Answer

    elb elb
    elb elb
    Offline
    Wednesday, September 21 2016, 04:27 PM - #Permalink
    Thanks for your reply, the idea is to do a modification in the code or to modify an opencart extension that can do so.
    i know that there is no configuration in arastta but i was asking if there is a way to modify some code to realise my goal. Where should i do the modification?

    Thanks
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, September 21 2016, 04:20 PM - #Permalink
    Hello,

    Arastta doesn't redirect the customers after adding a product to the cart. Do you use a 3rd party extension to do that? If so, you need to modify the 3rd party extension itself.

    Arastta, since 1.3, opens a modal window after adding a product to the cart. And there are "View Cart" and "Checkout" links in the modal window.

    Regards.
    The reply is currently minimized Show
Your Reply