masimplo
masimplo

Reputation: 3774

Drupal Commerce Ajax cart with added fields

Sorry for the really bad title but wasn't sure how to describe my problem in 10 words. I have drupal commerce and have made a view that displays the cart contents on top of the checkout page. Quantity is a text field so it is editable and I have an update button. Unfortunately when I press the update button, naturally the whole checkout page tries to submit. Is there a way to intercept the update button and just refresh the cart with ajax? Moreover, if I can do that, I want a number of text fields (as many as the quantity number entered) to appear underneath the cart so the user can enter different values on each of them (each referring to the products about to be bought).

Upvotes: 0

Views: 2778

Answers (2)

Kit
Kit

Reputation: 11

Drupal Commerce Cart does this - sort of.. http://drupal.org/project/dc_cart_ajax

It works fine on the cart page, though I too am trying to combine these pages to cut down on the 'checkout steps'. Though it is the same view as the /cart page and I get an ajax refresh indicator it doesn't actually update the cart on the checkout page.

There is a issue related to that, you can subscribe: http://drupal.org/node/1443470

Upvotes: 1

naitan
naitan

Reputation: 1155

You can disable the Shopping cart contents using the checkout settings. Modify the Shopping Cart View to add a block display and add modify the contextual filter by providing default value using PHP:

if (arg(0) == 'checkout') return arg(1);
else return null;

Add the new Shopping cart block dispplay only on the checkout page and here you go.

Upvotes: 0

Related Questions