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):
I have no clue if this is the same, but I tried with no luck. 
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" />

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
Inside this function, scroll down until you see
Just replace with
That should be it.
For products page, open catalog\view\theme\default\template\product\product.tpl
find
Scroll below until you find the same code as in common.js file i.e
and replace with
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.
In catalog/view/javascript/common.js
Search for
Code: Select all
function addToCart(product_id, quantity) {
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');
}
Code: Select all
if (json['success']) {
window.location='index.php?route=checkout/cart';
}
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',
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
..............
Code: Select all
if (json['success']) {
window.location='index.php?route=checkout/cart';
}
Well, the modification mentioned here is working out very well for us.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.
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.
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.
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.
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.
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.
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.uksitebuilder wrote: ↑Wed Aug 03, 2011 4:53 pmreplace with:Code: Select all
if (json['success']) { window.location='index.php?route=checkout/cart'; }
Who is online
Users browsing this forum: No registered users and 74 guests