0

I am creating a product where you can buy a shirt in custom quantities (3 smalls, 1 large, 4 mediums). The user types in the quantity, as well as select various product variations. Then by rules I calculate the price based on a fields I made called small_price, medium_price etc. So it would pull the users quantity input for each field and multiply accordingly e.g. small_price*small_quantity + medium_price*medium_quanitity. This is all working well, however it is currently implemented on the product level and not product display.

What I am trying to do is have the rule multiply a field from the product display by a field in the product variation. However the product display field is not available to me in rules. I have seen a couple of short hand answers on here about writing a custom rule but is there anyone who could explain it to me a little more in depth?

Thanks!

1 Answer 1

0

I generally recommend any information required for the pricing / fulfillment of a product to be stored on the product itself. I can see where you might need to do so based on information in the display, though (e.g. discounting products in a particular category).

In that case, you can't traverse from the line item / product to its display mode via the standard Rules data selector. Instead you need to use the appropriate action to load the node that references the product in question. Then you'll need to pass the line item and that node to a Rules component where you can use additional conditions to bring field data from the display node into scope (e.g. "Entity has field") and use the line item unit price manipulation actions on the line item to affect the pricing.

1
  • Sorry for the delay, so for me to implement this I would have to write a custom module? And if so can you point me in the direction of how I would start? Apr 16, 2014 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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