Jump to content

How to update the price by function


Recommended Posts



I added to my shop's product page some additional controls (text boxes) that should affect the price. I added some code to the product.tpl so using new controls I can modify the displayed price ( $('.our_price_display').html ), but would also like to update the price that goes to the cart when product is added. And I got stuck on that. Could anyone briefly explain what need to be done to add this feature to my shop?


Thank you and best regards

Link to comment
Share on other sites

Well just changing the price displayed in your page with javascript wont change the price of the product in your database. Well to modify the price of the product, you need to edit the database. When you do so, it will change price of the product forever. It means if person A does something and the price of the product is changed, person B will see the same modified price. I wont definitely recommend doing this. However there is another solution. What people do in general is whenever they want to personalize the price of the product as a function of something, they define a new combination of product and set the price of this combination to modified new price. Again, when you start doing this, there are lots of complications as you need to play with lots of database tables. There is a module i know of, which does everything you want to do. Have a look at the following link:




If you are developing for some businesses, then i'd recommend buying this module. If you are just experimenting, you can try to implement this as a module. It's an interesting problem.

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...