Hi,
i'm using the Ubercart ajax cart module but there's a problem that seems to be theme related. On the product page it works great: ajax pop up message and product gets added to cart. However, on an individual products page, the add to cart button doesn't produce the pop up message but instead reloads page with product added to shopping cart.
I contacted the developers of the module and after some seaching they found out it's theme related:
UC Ajax Cart tries to find Ubercart Add to cart button based on ajax-cart-submit-form class (it's added with a form alter at uc_ajax_cart_alter_cart_form function). In Aqua Prosper, Add to cart buttons from individual product pages do not have this class.
The module locates Add to Cart button with this selector:
form.ajax-cart-submit-form input.ajax-cart-submit-form-button
It works just fine with the Galand theme.
Is there a way i can manually add it? If so, where and how?
Comments
Comment #1
Luki_be commentedNo takers??
Comment #2
sheena_d commentedLuc,
On a fresh install of Acquia prosper, I am getting the same classes on the add-to-cart buttons on the Ubercart catalog pages and on the individual product pages. However, I am not sure what the desired behavior is of Ajax Driven Cart, so I do not know if it is working properly.
The only thing that Fusion does to the add-to-cart button on product pages is to bundle it into a variable on the node template (same as we do with other UC variables) which makes things a bit easier to use. The only bit of code in Fusion that relates to the add-to-cart button is:
$vars['fusion_uc_add_to_cart'] = drupal_render($node->content['add_to_cart']);
Which should not have any adverse effect relating to a class added to that form item by another module.
There is no way to edit the attributes of a form item (such as the classes of the submit button) except by a hook_form_alter function within a module, if that form was built using the Drupal FAPI. I'm not sure how the add-to-cart form is created in Ubercart, but all the rendering of the form items should be completed before that information is passed to the node preprocess function.
Hope this helps.
Sheena
Comment #3
Luki_be commentedHere's the class i get on the buttons:
Products page where eveything works:
Individual product page:
If you want to see it action:
http://www.dzinelabs.com/projects/drupal/products
just click on the buy now button.
And it seems theme related because using the Galand theme, everything works just fine ...
Comment #4
sheena_d commentedLuc,
I just realized that there are multiple "ajax cart" modules for Ubercart. Can you be specific as to which module you are using, the version, and the configuration steps necessary to re-create the issue, so that I may test?
Thanks,
Sheena
Comment #5
Luki_be commentedMy pleasure Sheena,
Module i'm using:
Ubercart ajax cart (http://drupal.org/project/uc_ajax_cart)
version: 6.x-2.0-rc2
Issue with response from developer:
http://drupal.org/node/1210766
Configuration of the module is straight forward but there is an option to assign a special class but that didn't sort any effect for me.
Comment #6
sheena_d commentedThanks, Luc. I'll look into this asap and let you know what I find.
Comment #7
Luki_be commentedAwesome,
looking forward to it.
Comment #8
sheena_d commentedLuc,
Ok, I took a look at your issue in the Ajax Cart thread, and the information about what actually happens for you on your site would have been very helpful to me earlier :) Everything works fine for me on a clean install of Prosper and Ajax Cart, but the fact that your page is refreshing rather than the modal loading tells me that this is very likely related to an old issue with the Google Analytics module. Are you using that module? Check out this issue: http://drupal.org/node/1057914#comment-4076714
Let me know if that sounds like it could be your issue.
Thanks,
Sheena
Comment #9
Luki_be commentedSheena,
now i'm not using that module. Sorry to bring bad news ;-)
Comment #10
sheena_d commentedWhat do you mean by "now"? Were you using it at one point and are no longer using it? What other modules do you have installed that may be altering the product pages, forms, or using ajax or modal windows?
The fact that I could not replicate this issue on a fresh install of Acquia Prosper and Ubercart suggests that there is something else going on in your site. Have you made any changes or customizations to template.php, node-product.tpl.php or any javascript in your copy of Acquia Prosper?
Comment #11
Luki_be commented'now' should be 'no' ... my mistake
About the modules installed, do you want me to list them all??? I'm not a coder so i don't know what module alters product pages etc...
I did made some customizations to template.php (see http://chalcedony.co.nz/gemsofwisdom/ubercart-2-display-stock-available):
But i don't think there's a problem with it.
The only thing i can think of is that i upgraded to Aqua 6.x-1.1 ...
Comment #12
sheena_d commentedThis function alters the add to cart button on product pages. Try removing that entire function (don't forget to clear cache) and let me know if the issue is resolved.
Comment #13
Luki_be commentedYeah !!! Problem solved sheena :-)
Ofcourse, removing the function means the stock isn't displayed anymore for a product ... something so basic that seems to be impossible with ubercart :-(
Anyways,
tnx a bunch :-)
Comment #14
sheena_d commented