Jump to content

Calculate product price dynamically based on user's input


Recommended Posts

Hello, I would like to achieve something like this (1.7.7):

Product has a static price set: e.g. 30 € (price is set per one gram)
Product has a static gram to size ratio set: e.g. 1 mm equals 0.046 grams

The user chooses the size on the product page (e.g. 45 mm), the product price should be updated with the formula:
[static_price]*[static_ratio]*[user_defined_size]
30*0.046*45 = 62.10 €

I found various robust modules for dynamic pricing, but it seems like an overkill to be honest. On the other hand I am kind of stuck. I am able to override the product price in Product class, but I don't know how to change it dynamically based on user's input, so that prices will remain correct in cart/checkout as well.

Any ideas? Thank you very much.

Link to comment
Share on other sites

And why so complicated when you know the price for 1 mm?
Set the price to 1.38 and on the Prices tab enter the value 1.38 per 1 mm.
Then the customer will only add a value of 45.

When I'm at the computer, I'll give you a picture of how to do it.

obrazek.thumb.png.39359e0024005cf9859df5d6c82616b8.png

Edited by Guest (see edit history)
Link to comment
Share on other sites

This actually might work, thank you very much for the tip.

However, I will probably still have to go with custom calculation formulas. The product I am talking about are rings and they are always sold in par (for man, for woman), each have different price per unit (mm in this case).

The user needs to input both ring diameters on the product page and than sees the final price for both rings.

I'm thinking of creating a Product pack, but I'm not sure whether it is not overcomplicated for such a task (I don't need two products in pack, I really just need duplicated unit price fields at this point and display the SUM of them on frontend).

Link to comment
Share on other sites

So you will have to reach for a more complex solution, because your requirement is not an easy solution.
You should have given your example in the first question.

Another possible solution is to create attributes for women and men,
There are standardized dimensions of rings.

Eg.

obrazek.png.12395b1150119575b80f0952f5c02982.png

obrazek.png.cd8c0d39e90c63946ee9c568ef788382.png

obrazek.thumb.png.643f0fec92078a16af6ef483bac3baa6.png

Edited by Guest (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...