Vote up!
Vote down!

Calculating Price

In my web site I will sell printing product such as business cards, posters,,,

Business cards have four type of attribute:
size = {2x3in, 2x3.5, 1.75}
Paper={14 pt, 16 pt, 18 pt}
color= {Color front-noback, Color front, B&W back, Color Front & Back}
Quantity= {250, 500, 1000, 5000}

For each of those attributes price changes.
I decide to add size and paper as product type field.
And color and quantity as line items.
So using product display, price changes when size and paper options got changed, for color and quantity I had problem!
Final price should be as following:
Final price = product *(coefficient of selected color)*(Coefficient of Selected Quantity)

1) using rules, to calculate the price
cone side : It will requires to create many rules for each different options

2) a custom module I don't know where to start for this one ?!

What would be the best option and how ? (hook_commerce_price_field_calculation_options)

Thanks guys for this great module

Asked by: Narek
on January 18, 2013

1 Answer

Vote up!
Vote down!

I'm sure it's possible to create a rule (or set of rules) that calculates this, but I'd say that, at that point, you're fighting against the way Drupal Commerce was designed to work.

Why wouldn't you create all four variables (size, paper, color, quantity) as attributes? With that method, the price should be calculated correctly and displayed to the user on the product page.

I've not used this module before, but Commerce Bulk Product Creation may be helpful in automatically creating a large number of products from those variables.

Answer by: scottrouse
Posted: Jan 20, 2013