Post by phungk » Fri Jun 10, 2011 7:33 am

Hey can anyone help me out here?

I want to disable the ajax checkout in opencart 1.5.

I want the user to go straight to checkout when they add to cart.

Any help would be greatly appreciated!

O0
Last edited by i2Paq on Fri Jun 10, 2011 1:22 pm, edited 2 times in total.
Reason: Please use [version] TAG in subject!

Newbie

Posts

Joined
Fri Jun 10, 2011 7:28 am

Post by Qphoria » Fri Jun 10, 2011 7:35 am

ajax checkout? You mean ajax add to cart? THere should be a setting in the main settings

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by phungk » Fri Jun 10, 2011 7:36 am

Yes, I mean the ajax add to cart... I have looked all over the admin dashboard for it and I can't find the option to turn it off.

Newbie

Posts

Joined
Fri Jun 10, 2011 7:28 am

Post by guntis.e » Wed Jun 22, 2011 3:37 pm

I also cannot find it anymore in 1.5. It was in Cart module in 1.4.x. Now there is no such module- the cart is in the header.

The reason why i am looking to remove the ajax is - I have added modified the header.tpl to show icon instead of text and the text display as tooltip:

Code: Select all

<a title="<?php echo $text_cart; ?>: <?php echo $text_items; ?>"><span id="cart_total"><img alt="<?php echo $text_cart; ?>" src="catalog/view/theme/partneris/image/cart_7dots2.png"/></span></a>
The problem is that after adding a product via ajax - this is changed back to the default and the icon is dissapeared, still the tooltip stays with the old cart information:

Code: Select all

<a><span id="cart_total"><?php echo $text_items; ?></span></a>
I see the solution by removing the ajax add to cart, but cannot find it.
Another option would be to chang the callback function, but i do not know where to find it.

I am using 1.5.0.5

Guntis
Image Partneris.lv - opencart web site development and support


Active Member

Posts

Joined
Fri Jan 28, 2011 4:20 am

Post by oleg » Thu Jul 14, 2011 5:35 am

Hi, this is my first post :) anyways, today I've spent an hour or so to find a solution on how to redirect a client to the cart page when pressed "add to cart".

I'm using 1.5.0.5v, there is no way to do it from the admin panel like in earlier versions.

I have seen different php based solutions that haven't worked for me, so I came with my own javascript based solution.

The idea is very simple. You just have to append a redirect command to onclick event.

instead of

Code: Select all

<a class="button" onclick="addToCart('73');">
use

Code: Select all

<a class="button" onclick="addToCart('73');window.location='index.php?route=checkout/cart';">
or (not tested yet) if there are no onclick event, just add one with the redirect, or just add the redirect at the end of the addToCart function

Working on hebrew rtl opencart 1.5.0.5v http://automoto.co.il


Newbie

Posts

Joined
Thu Jul 14, 2011 4:50 am
Location - Israel

Post by oleg » Thu Jul 14, 2011 9:53 pm

There is a little problem with this method. Sometimes the redirect works faster than the ajax add to cart code, it does add a product to cart, but when you get to the carts page you don't see the product until you refresh. To solve this you can use setTimeout().

add to common.js function

Code: Select all

function RedirectToCart(){
	window.location='index.php?route=checkout/cart';
}
and instead of

Code: Select all

<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button">
use

Code: Select all

<a onclick="addToCart('<?php echo $product['product_id']; ?>');setTimeout('RedirectToCart()',2000);" class="button">

Working on hebrew rtl opencart 1.5.0.5v http://automoto.co.il


Newbie

Posts

Joined
Thu Jul 14, 2011 4:50 am
Location - Israel

Post by tickledpink » Thu Jul 21, 2011 8:01 am

There is a little problem with the latest code, it works BUT when there are required fields it still directs them to the cart, just empty instead of giving them an error code on the product page. Any idea how to fix that?

Newbie

Posts

Joined
Thu Jul 21, 2011 4:34 am

Post by kgkaraoke » Fri Sep 07, 2012 2:31 pm

oleg wrote:Hi, this is my first post :) anyways, today I've spent an hour or so to find a solution on how to redirect a client to the cart page when pressed "add to cart".

I'm using 1.5.0.5v, there is no way to do it from the admin panel like in earlier versions.

I have seen different php based solutions that haven't worked for me, so I came with my own javascript based solution.

The idea is very simple. You just have to append a redirect command to onclick event.

instead of

Code: Select all

<a class="button" onclick="addToCart('73');">
use

Code: Select all

<a class="button" onclick="addToCart('73');window.location='index.php?route=checkout/cart';">
or (not tested yet) if there are no onclick event, just add one with the redirect, or just add the redirect at the end of the addToCart function
If you haven't tested your code yet, then why in heaven's name do you post it?

New member

Posts

Joined
Fri Oct 29, 2010 9:06 am
Who is online

Users browsing this forum: Amazon [Bot] and 19 guests