Update price based on attributes

By | February 7, 2008

Lilotanni asks;

When there are attributes assigned to a product and the attribute has money value to them. I wanted the base price to update automatically before the customer add it to cart.

As in if the base price is $200.00 and the attribute is -$10.00, when the customer chooses -$10.00, the displayed price would changed to $190.00 and so on if there are more attributes. I’ve been trying to do that and have gotten no where. Could you help me out?

Well, you need to use javascript.  I’d have had a go at using jQuery to update the price based on attributes, but even easier – there is already an existing contribution!

Check out http://www.oscommerce.com/community/contributions,1385 – I used the Attrib.Price Update 1.4 version and dropped in the product_info.php page directly.

It worked first time 🙂  Good luck with your osCommerce Store.

2 thoughts on “Update price based on attributes

  1. Matt

    Hey Gary,

    I looked at the mods in the addons sections and they all use some long script to figure out the price update. None of them worked for me because I use radio buttons for attributes. So I made my own…

    I used jquery .get() to grab the info I need and as a bonus I set it up to also update the cost according to the amount you enter in the quantity box.

    So thanks for your post. It got me thinking and it all worked out! Shoot me an email if you want to check out the code 🙂


  2. Gary Post author

    Nice work Matt. Expect an email from me tomorrow (about that other stuff) as I have pretty much cleared my emails backlog, thank goodness.

Leave a Reply

Your email address will not be published.