![]() |
ajax add to cart button
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 |
Re: ajax add to cart button
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'); |
Re: ajax add to cart button
is there a way to activate this via an onclick event instead?
|
Re: ajax add to cart button
Your welcome. :-)
Assuming your form is named orderform try this: <a href="javascript:void(0);" onclick="!ajax.widgets.add2cart(orderform)">Add To Cart</a> |
Re: ajax add to cart button
Quote:
That didn't work. my form is called orderform too. |
Re: ajax add to cart button
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... |
Re: ajax add to cart button
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? |
Re: ajax add to cart button
**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** |
Re: ajax add to cart button
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. |
Re: ajax add to cart button
I am having a similar issue. What class where you missing?
|
All times are GMT -8. The time now is 04:24 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.