开发者

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?


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.


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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜