Hi,
Is there a support for ajax in ubercart?
Can I add products to the cart without page reload?
If there isn't it could be very usefull and shouldn't be too hard to implement 
Thanks
|
UbercartOne cart to rule them all... |
|
| Donate to Ubercart | Affiliates | ||
Add to cart using ajax
Submitted by dolittle on Wed, 03/12/2008 - 05:27
Hi, Is there a support for ajax in ubercart? Can I add products to the cart without page reload? If there isn't it could be very usefull and shouldn't be too hard to implement Thanks
Go for it. How can I do it with hook_form_alter()? What I had in mind is two pages left and right using the panel module. The right page will be the cart and the left the catalog. User will be able to browse the catalog with ajax and to add to cart using ajax. The cart in the right page will be updated when the user add products. I'll appericiate if you cuold give me a direction. Thanks hi doolittle...any progress with this? I too would like to have an ajax add to cart, but, I don't know how to create the form alter module Ryan mentioned. Doesn't the uc_aac module do this or get you close? http://www.ubercart.org/contrib/2010 Well I guess technically, there is still a full page reload from what I can see. I've got my test site setup with uc_aac and no redirect set for the Cart settings and that automatically updates the cart when the add to cart button is pressed. This still does a page reload, but stays on the same page. From what I can see without really digging into the code (I'm still familiarizing myself with Drupal and Ubercart) is that either Ubercart's behavior needs to be changed so it doesn't do a page reload when adding to the cart and just let AJAX and JavaScript do the work or, and this is where I don't know what can and can't be done, a module needs to be created that overrides the core default behavior so that the redirect doesn't reload the page, or it just doesn't redirect at all. Personally, from looking at the Cart settings, the way I read it is if you set the redirect to <none> it should do just that, no redirect, thus no page reload. Maybe add another option of <same> where it does do a redirect and reload to the same page so that the <none> setting does what it insinuates "Enter <none> for no redirect." Ryan, if you're still following this thread, could you post an example or a link to an example of using hook_form_alter()? I've only just started digging into the Developer's guide, but I'm no programmer, just a hack, tech geek. I guess I just don't understand. If I or someone creates a new module, would they be overwriting some of the behavior of the uc_cart module? Would they need to specify new functions for uc_cart_form_alter and uc_cart_add_item? Well after doing a bit more digging, I think I'm understanding a little more. A new module that would actually be pretty small and just and pretty much have a "uc_cart_ajax_form_alter" function that would be watching for "add to cart" and not do a redirect? I think I've got more reading of the code, documentation and some testing to do.... Here's how I imagine it'd get done. - Create a custom module, call it UC_ajax_cart or something. <?phpI think this would work, but it's untested. You would also need to add a That's just my scattershot thoughts on the thing, anyway. I create a module for an ajax cart. Please try and give feedback.
|
|
Joined: 01/30/2008