| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
ajax add to cart button | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() Hi,
I'm trying to redevelop a skin for a shop and I wanted to change the add to cart buttons. My issue is regarding the ajax add to cart which now doesn't work even though I'm using the original code. Does anyone know how to initiate the javascript via an onclick even on an input/a ? Thanks
__________________
X-Cart 4.3.1 X-Cart 4.5.4 |
|||||||
#2
|
|||||||||
|
|||||||||
![]() In my experience, the button has to be inside <div class="details">
If you remove the button from this div it will cease to function Its due to this line of ajax.add2cart.js: // Get box this.box = this.form.parents().filter('.details,.product-cell');
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#3
|
|||||||
|
|||||||
![]() is there a way to activate this via an onclick event instead?
__________________
X-Cart 4.3.1 X-Cart 4.5.4 |
|||||||
#4
|
|||||||||
|
|||||||||
![]() Your welcome.
![]() Assuming your form is named orderform try this: <a href="javascript:void(0);" onclick="!ajax.widgets.add2cart(orderform)">Add To Cart</a>
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#5
|
|||||||
|
|||||||
![]() Quote:
That didn't work. my form is called orderform too.
__________________
X-Cart 4.3.1 X-Cart 4.5.4 |
|||||||
#6
|
|||||||||
|
|||||||||
![]() Well, here is a link to it working, perhaps you can inspect the source and see what is different. http://trainingpen.com/manufacturers_carousel/product.php?productid=17551 (Look right below the description)
If you provide a link to your page...
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#7
|
|||||||
|
|||||||
![]() Your site is still using that horrible <button><span><span> mess...
I'm trying to use an input or anchor for this. All that should be required is the javascript that passes the information to the ajax cart and open up the popup box; surely that's a function somewhere?
__________________
X-Cart 4.3.1 X-Cart 4.5.4 |
|||||||
#8
|
|||||||||
|
|||||||||
![]() **Edited**
Yes, it is a function somewhere. In /common_files/js/ajax.add2cart.js on line 51: PHP Code:
Now, in order to further demonstrate, I have updated (temporarily!) my test site to display exactly what you want in full working order. There is a simple link with onclick to add to cart. Works with Qty and options just fine. http://trainingpen.com/manufacturers_carousel/product.php?productid=17551 **Edited**
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#9
|
|||||||
|
|||||||
![]() Quote:
Thanks very much. I have finally succeeded! I was missing a class which the javascript was looking for! **Edited** My next question is, how do I make the javascript reset... the standard buttons go "Add to Cart" -> "Added" -> "Add More to Cart" I understand the button text is via smarty and javascript but I cannot reclick the link after I've clicked it once.
__________________
X-Cart 4.3.1 X-Cart 4.5.4 |
|||||||
#10
|
|||||||
|
|||||||
![]() I am having a similar issue. What class where you missing?
__________________
x-cart 4.5 |
|||||||
|
|||
X-Cart forums © 2001-2020
|