1
Answers
Vote up!
0
Vote down!

Product princing rules and product fields (not inline item fields)

I want to calculate the price of a product that depends weight and height.

In Products, I have two fields: price_cm_width and price_cm_height.
In Line item, I have other two fields: cm_width and cm_height.

The idea is put on the unit price:
price_cm_width * cm_width + price_cm_height * cm_height

For this, my steps were:
1. Store -> Configuration -> Product Pricing Rules.
2. Click "Add a pricing rule".
3. Put a rule a name.
4. Click "Add condition".
5. Select "Entity -> Entity has field".
6. Data selector: commerce-line-item
7. Select field: field_price_cm_width
8. The same for field_price_cm_height, field_cm_width and field_cm_height (steps 4 to 7).
9. Click "Add action".
10. Select "Data -> Calculate a value"
11. The data selector should be: commerce-line-item:field-price-cm-width but not displayed. However, commerce-line-item:field-cm-width and commerce-line-item:field-cm-heigth appears.

Why Product fields do not appear? Is there any solution for this problem?
Thank you.

Asked by: ces
on March 21, 2013

Comments

Before step 7 or edit step 6 to load:
- Select Field : commerce_product
Then add condition
- Select "Entity -> Entity has field".
- Data selector: commerce-line-item:commerce_product
After that
- Select field-> 'your_field';

The key is commerce_product needed to load before you can select field that attached to product type

- sibiru on March 22, 2013