AlexA
AlexA

Reputation: 4118

Add products to UberCart Cart with Javascript

Drupal's UberCart is a solution, where you select some product manually and then click "Add to Cart" button. But here goal is a bit different, I may have a custom javascript where user plays with catalog and attributes and selects product with properties in this window.

What would be the technological path to return selected products with properties back from js window to UberCart Cart?

Upvotes: 1

Views: 2138

Answers (3)

Paul
Paul

Reputation: 31

There is a standard Ubercart module: Cart Links. After enabling it you'll be able to use URLs like /cart/add/p111_q5-imonday_special?destination=cart (p - product id, q - quantity).

This is the easiest way to work with UC's cart from JS.

Upvotes: 3

Henrik Opel
Henrik Opel

Reputation: 19441

I'm surprised that they do not offer this already 'out of the box', but searching their site turns up some user contributed attempts on this. Maybe one of those will work for you (or at least serve as a starting point for your own modification)?

It seems that at least one of those contributions turned into an 'official' drupal contribution, so you might want to check out Ubercart ajax cart on drupal.org.

Upvotes: 2

AlexA
AlexA

Reputation: 4118

I can see one solution as of now. To return customized selected products from js window to UberCart page, one could use js to reload parent window with actual Cart page and then, using js, add products as DOM elements to Cart html form. May be it's overcomplicated?

Upvotes: 0

Related Questions