2

I am using Drupal 7.14, Commerce 7.x 1.3 and Views 7.x 3.3. I want to have a drop down list on my product display form (or content display form) containing, say:

Full Price, no coach required - £ 200 Full Price, Glasgow coach - £ 230 Full Price, Edinburgh coach - £ 230 Full Price, Liverpool coach - £220 ....

and I want, when an item on the list is selected, the displayed price to change to the indicated value and, of course, this to be passed to the cart.

How can I do that.

1

You can do this using the Rules module: http://drupal.org/project/rules/. That should already be up and running if you're using Drupal Commerce.

So just go to admin/config/workflow/rules and add a new rule that looks something like this:

  1. Event: Calculating the sell price of a product
  2. Condition: Entity has field: [commerce-line-item], Field:
  3. Action: Set the unit price to a specific amount; Parameter: [commerce_line_item]; Value: can either select another field to base this on or do a hard-coded value; Leave Price component type and Price rounding mode to their defaults
  4. Test!

Let me know if this ends up working for you

  • Thanks so much, Boriana, for your very quick reply. Will try out your suggestions and get back to you. – Brian O'Gorman Jun 27 '12 at 16:20
  • Have go to the setting of the Action, but I don't know how to do this. Have defined an additional field in the product type (booking_type) which is a drop down list with allowed values (key|value) How can I specify this as the value? – Brian O'Gorman Jun 27 '12 at 18:29
  • Under the 'Amount' section of that action, try expanding the 'Data selectors' section, and you'll see all the fields that you can use. Just copy and paste the one that matches your drop down list... but if your drop down list contains text (vs. an Amount), that won't work very well. Test it out. – Boriana Ditcheva Jun 28 '12 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.