Post by Webbo » Mon Feb 23, 2015 2:48 am

I have an issue with OC 2.0.1.1

When you are on a product page, and add to cart, the button shows loading... then goes back to Add to Cart, but does not add the product to the mini cart on the header.

The add to Cart works on the Category pages and the Home page, but not on the product page.

I tried removing the php.ini file as mentioned in previous topic, but this didn't work for me

Any ideas what could be causing this.... please

New member

Posts

Joined
Sun Oct 10, 2010 12:31 am

Post by yuno » Mon Feb 23, 2015 12:39 pm

review the code of the product.tpl

Code: Select all

<button type="button" onclick="cart.add(...)....
make sure this file exist
opencart-2.0.1.1\catalog\view\javascript\common.js

Code: Select all

var cart = {
	'add': function(product_id, quantity) {.....

OpenCart®
PHP Developer.
更多中文教學在 OpenCart香港官方網站 !
QQ: 2039574815


Active Member

Posts

Joined
Tue Feb 11, 2014 9:24 am

Post by Webbo » Mon Feb 23, 2015 5:50 pm

Thank you, but it has the script you mentioned

// Cart add remove functions
var cart = {
'add': function(product_id, quantity) {
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
dataType: 'json',
beforeSend: function() {
$('#cart > button').button('loading');
},
success: function(json) {
$('.alert, .text-danger').remove();

$('#cart > button').button('reset');

if (json['redirect']) {
location = json['redirect'];
}

if (json['success']) {
$('#content').parent().before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');

$('#cart-total').html(json['total']);

$('html, body').animate({ scrollTop: 0 }, 'slow');

$('#cart > ul').load('index.php?route=common/cart/info ul li');
}
}
});
},

New member

Posts

Joined
Sun Oct 10, 2010 12:31 am

Post by yuno » Thu Feb 26, 2015 3:54 pm

<button type="button" onclick="cart.add(...)....
can you find above code in product.tpl?

OpenCart®
PHP Developer.
更多中文教學在 OpenCart香港官方網站 !
QQ: 2039574815


Active Member

Posts

Joined
Tue Feb 11, 2014 9:24 am

Post by stoiacs » Thu Jun 18, 2015 5:15 am

In the catalog/view/theme/dragee/template/product/product.tpl file there is a missing part when sending the ajax query:

Code: Select all

data: $('#product input[type=\'text\'], #product ...
should be

Code: Select all

data: $('#product input[type=\'number\'], #product input[type=\'text\'], #product ...
Now it is working for me.
There is nothing to do with the onclick event.

Newbie

Posts

Joined
Thu Jun 18, 2015 5:12 am

Post by ahmadm » Fri Oct 30, 2015 2:44 am

Hello I have a problem and that is the shopping cart button on the product page does not work buy other
but buttons on the main page is true...
And when I do click on this button will only be displayed for a moment Loading But nothing happens Anyone
who can help me?
http://www.soghatenab.com/%D8%B3%D9%88% ... -birjand--
Thank you
ahmad.mohammadi.a@gmail.com

Newbie

Posts

Joined
Fri Oct 30, 2015 2:42 am

Post by viethemes » Fri Oct 30, 2015 10:08 pm

ahmadm wrote:Hello I have a problem and that is the shopping cart button on the product page does not work buy other
but buttons on the main page is true...
And when I do click on this button will only be displayed for a moment Loading But nothing happens Anyone
who can help me?
http://www.soghatenab.com/%D8%B3%D9%88% ... -birjand--
Thank you
ahmad.mohammadi.a@gmail.com
Is the problem fixed? I can add product to cart at the product page.

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by rale » Tue Nov 21, 2017 9:52 pm

I also have problem with add to cart but on home page. That worked fine before. If someone know what need to do just say. Check this on home page www.nadohvatruke.rs

Newbie

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by IP_CAM » Wed Nov 22, 2017 12:22 am

Image

Attachments

2_error_messages.jpg

2_error_messages.jpg (161.03 KiB) Viewed 1190 times


For Sale: Top URL's, including OpenCart V-Pro installed, like seen here:
http://www.bigmax.ch - http://www.ipcam.li - http://www.opencart.li
For Information + URL's offered, please contact me at: jti@jacob.ch
I am NOT available for Custom Support in existing OC Installations!
My Github Repositories: https://github.com/IP-CAM
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by rale » Wed Nov 22, 2017 5:39 pm

Oh , ok IP, thank you.

Newbie

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by rale » Wed Nov 22, 2017 6:51 pm

Tell me what need to do to fix?

Newbie

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by Lonewolf@123 » Fri Jan 12, 2018 4:01 pm

I installed revo theme on opencart 3.0.2.0 and after that add to cart button not working on product page but works fine on home page and other pages just not on product page

Newbie

Posts

Joined
Sat Oct 28, 2017 1:45 am
Who is online

Users browsing this forum: Google [Bot] and 21 guests