1

For something that's pretty basic this seems overly complicated! I'm working on updating a computer store from Ubercart to Drupal Commerce. Computers can be custom built so there are multiple options to choose. If I have to create a SKU for each variation I will go absolutely crazy!

So I've tried:

  • bundling modules - but they doesn't allow you to choose options

  • commerce pricing attributes - but it doesn't seem to work anymore "The "hunziker" approach to Drupal Commerce is not supported nor recommended by the creators of Drupal Commerce. Thus, any problems you might have with the modules is "by design" unfortunately." - Commerce Attribute price is not updating in cart

  • Commerce Customizable Products - seems the most promising but after following the "pizza store" video multiple times even with a clean install - everything works A-OK till the rules. When I get to the part where I am adding in the rules, I can add in the "Entity has field" part properly, but when I add the loop, I don't have the option for just "commerce-line-item:field-foo". It ends the commerce-line-item:field-foo with a colon and wants you to pick more. no matter what combination I try I end up with a rule error about lists: "Error: The data type of the configured argument does not match the parameter's list requirement".

I'm absolutely going nuts with this!! It shouldn't be this hard... should it?

The process I'm following for Customizable products is as follows (adding an Antivirus choice to a custom computer content type):

  1. Install Customizable Products

  2. Add a custom line item Store > Configuration > Create New Line Item Type called “Custom Computers”

  3. Create a Taxonomy, called "Computer Antivirus"

  4. Add price field to taxonomy (with currency) called "Price" – Field Type “Price” > Currency CDN

  5. Add a few taxonomy terms with prices

  6. Add a Taxonomy term reference field "Computer Antivirus" to custom line item type, Store > Configuration > Line Item Types > Custom Computers

• Manage Fields

• Add new field “Antivirus” – Term Reference – Checkboxes

• Choose “Computer Antivirus” Taxonomy Vocabulary

• Include this field on Add to Cart Forms…

  1. Set up products to use new line type. Configure the display of the add to cart form on the custom product type to use the custom line item type

• Structure > Content Types

• Choose Manage Display on the Content type you need to change

• Edit the Product – Add to Cart form > Choose the Line item type “Custom Computer”

• SAVE!!!

  1. The custom options will now appear below the product

  2. Change the price

• Create a Pricing rule

• Store > Configuration > Product Pricing Rules

• Add new Rule named “Antivirus Rule”

• Add a condition: Entity has field - Data Selector: commerce-line-item - Value: field_antivirus

HERES WHERE THE PROBLEM IS - Add a Loop:- Data Selector: commerce-line-item:field-antivirus - Current List Item: change name

• Add an action to the loop: - Commerce line item: Add an amount to the unit price - Amount Value: switch to data selection: pizza-topping: field-price:amount - Price Component Type: Fee - Value: Round the half up

I've been working with this about 4 weeks now with no solution. Can anyone shed some light on whats wrong?

  • 1
    at 6:26 of the video, in line items, did you set your term reference field to unlimited values? – No Sssweat Feb 18 '16 at 7:56
  • so what's the problem with your rule? be more specific. You only listed the steps you did. – No Sssweat Feb 18 '16 at 8:09
  • Hi No Ssssweat, in the points above my steps I mention the problem with the rule "When I get to the part where I am adding in the rules, I can add in the "Entity has field" part properly, but when I add the loop, I don't have the option for just "commerce-line-item:field-foo". It ends the commerce-line-item:field-foo with a colon and wants you to pick more. no matter what combination I try I end up with a rule error about lists: "Error: The data type of the configured argument does not match the parameter's list requirement". – everaftergraphics Feb 18 '16 at 16:19
  • Oh and no - I didn't set the term reference field to unlimited values because I only want them to pick one value from the list – everaftergraphics Feb 18 '16 at 16:20
  • 1
    You're the BEST!!!! Marking it as the answer!!! THANK YOU SO MUCH!!! – everaftergraphics Feb 18 '16 at 16:26
3

Oh and no - I didn't set the term reference field to unlimited values because I only want them to pick one value from the list

I believe that is the problem... either you make it unlimited; even though, you will use it once

OR leave it at 1, but don't use a loop, just add action (for Amount Value data selection use commerce-line-item:field-price:amount)

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.