Post by chockm » Wed Mar 21, 2012 9:13 pm

Hi, I'm using 1.5.2.1 is there any way to do this for this version... can someone help me and let me know exactly what do to.

Thanks!

Newbie

Posts

Joined
Sun Mar 04, 2012 5:27 am

Post by ahmedtaufiq » Mon Apr 02, 2012 11:21 pm

It works perfectly with v1.5.1.3. After this fix, i became the die hard fan of yours.

Newbie

Posts

Joined
Thu Mar 29, 2012 4:45 am

Post by duzoxin » Thu May 03, 2012 1:33 am

Don't mean to bump an old thread, but 1.5.2.1 has changed the button from <a> to <input>

From products.tpl (only want the product page to redirect):

Code: Select all

<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />
I have no clue if this is the same, but I tried with no luck. ???

Newbie

Posts

Joined
Wed May 02, 2012 7:26 am

Post by jhample » Fri Jun 22, 2012 5:39 am

Have the very same issue / request for Version 1.5.1.3. The code referenced by "uksitebuilder" does not exist in Version 1.5.1.3. Can I get the code fix for this version??? Same exact idea. THANKS!

Newbie

Posts

Joined
Wed Oct 19, 2011 2:06 am

Post by STN » Mon Aug 27, 2012 1:42 am

The code posted by uksitebuilder still works for any v1.5.x . Here are some pointers to help you better find the required code.

In catalog/view/javascript/common.js

Search for

Code: Select all

function addToCart(product_id, quantity) {
Inside this function, scroll down until you see

Code: Select all

			if (json['success']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
				$('.success').fadeIn('slow');
				
				$('#cart-total').html(json['total']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow'); 
			}	
Just replace with

Code: Select all

			if (json['success']) {
				window.location='index.php?route=checkout/cart';
			}	
That should be it.

For products page, open catalog\view\theme\default\template\product\product.tpl

find

Code: Select all

$('#button-cart').bind('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
Scroll below until you find the same code as in common.js file i.e

Code: Select all

if (json['success']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
.....etc
..............
and replace with

Code: Select all

			if (json['success']) {
				window.location='index.php?route=checkout/cart';
			}	
That should make it work like a charm. All credits and thanks goes to uksitebuilder, i am just posting pointers for people who can't find it.

Game Trainers


STN
New member

Posts

Joined
Fri Jul 01, 2011 6:45 am


Post by kgkaraoke » Fri Aug 31, 2012 8:51 am

darrengould wrote:Did it work because I just tried it and couldn't get it to work for me

Using V1.5.1

Still don't know why showing the cart isn't an option as I prefer it that way and always will.

At least some people expect to see what they have ordered when they click on a button to add to cart.

If others prefer it this way fine but make it a choice thing. Just another bit of OC that appears to be faltering.

I seriously would have left OC ages ago if I hadn't spent so much on mods.
Well, the modification mentioned here is working out very well for us.

In all fairness to Daniel, the fact that one is a highly creative developer of shopping cart software does not necessarily mean that the person is aware of all the intricacies of the shopping experience, which falls into the sphere of human engineering. It appears quite plausible to me that it simply never occurred to him to make this a configurable option.

Be happy though, that OpenCart is so easy to modify.

New member

Posts

Joined
Fri Oct 29, 2010 9:06 am

Post by dod_moshe » Sun Mar 10, 2013 7:48 pm

Hi!

This does works as charm on any product, BUT! on products that contains OPTIONS, this simply does NOTHING!
no add to card, and no redirect.


Any ideas?\
Thnks

Newbie

Posts

Joined
Sun Mar 10, 2013 7:47 pm

Post by SabinVI » Mon Mar 11, 2013 2:03 am

Have you tried this free extension? It is what I use:

http://www.opencart.com/index.php?route ... on_id=4526

It is a single VQmod file. On my custom theme, I did have to modify one of the files as suggested in the instructions, but if you are on the default theme, the VQmod alone should do it for you.

Newbie

Posts

Joined
Mon Mar 11, 2013 1:44 am

Post by supernova-mkt » Thu May 16, 2013 1:15 am

Hi, dod_moshe
I'm begginer in opencart and I have few knowledge in PHP, but I have large experience in CMS like Joomla!.
I had the same problem when the product has options.
Personaly I believe that options must come before cart-button, so I changed the "product.tpl" and, I don't know why, "magically" this solved the problem .

Best Regards and thanks for all members that contribute with us, beginners.

Newbie

Posts

Joined
Thu May 16, 2013 12:58 am

Post by vodafone » Tue Dec 10, 2013 10:38 pm

Hello, can you halp me create redirect "Add to Cart button to my website"?

Thanks.

Newbie

Posts

Joined
Tue Dec 10, 2013 10:30 pm

Post by RideTheWave » Thu Jun 22, 2017 11:22 am

uksitebuilder wrote:
Wed Aug 03, 2011 4:53 pm
replace with:

Code: Select all

			if (json['success']) {
				window.location='index.php?route=checkout/cart'; 
			}	
Thanks for this. Still a useful thread 6 years later. I just wanted to note that when I used the above line in the product.tpl file, it wasn't exactly working with SEO url's enabled. It would direct the visitor to: mydomain.com/category-name/subcategory-name/index.php?route=checkout/cart which obviously doesn't go to the cart url. So instead I just put the absolute url and it's working fine.

New member

Posts

Joined
Fri May 19, 2017 8:29 am
Who is online

Users browsing this forum: No registered users and 98 guests