# Quantity not updating

Thread began 6/12/2014 7:30 pm by dDog | Last modified 6/13/2014 1:11 pm by Jason Byrnes | 545 views | 3 replies |

## 6/12/2014 7:30 pm  |  #1 dDog

### Quantity not updating

I have tried to correct this and have read numerous threads, but have not had any success. When a product is added to the cart, the proper price is displayed, but if the quantity is changed, neither the "Total" or "Grand Total" prices change. The calculations seem correct.

[php]
\$itmObj->TotalPrice = \$itmObj->ProductPrice + \$itmObj->OptionPriceIncrement * \$itmObj->Quantity;//c
[php]

To reproduce the problem, add an item to the cart and change the quantity and update.
https://onlinesafetysource.com/products_Detail.php?ProductID=2255

I've attached the files cart.php and URScart_PHP.php
Any assistance is greatly appreciated.

## 6/13/2014 10:53 am  |  #2 Jason ByrnesWebAssist

the total price calculation should have parenthesis around the Price and price increment addition:
([ProductPrice] + [OptionPriceIncrement]) * [Quantity]

\$itmObj->TotalPrice = (\$itmObj->ProductPrice + \$itmObj->OptionPriceIncrement) * \$itmObj->Quantity;//c

your original expresion was:

[ProductPrice] + [OptionPriceIncrement] * [Quantity]

lets use dummy numbers for an example:
276 + 0 * 2

the math order of operations is to evaluate parenthesis first, then multiply, divide, add, subtract.

so the multiplication is done first:
0 * 2 = 0

then addition is done using that result:
276 + 0 = 276

([ProductPrice] + [OptionPriceIncrement]) * [Quantity]

or:
(276 + 0) * 2

we tell it to do the addition first:
276 + 0 = 276

the multiply the result by the quantity:
276 * 2 = 552

see this page for an order of operations calculator.

## 6/13/2014 12:38 pm  |  #3 dDog

Thank you, it worked. When my kids ask "Dad, why do I need to learn algebra?" I'll say "So you won't waste the valuable time of our good friends at Webassist." That's what my dad would have said.

LOL.

you're welcome.

## Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

## Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

## Everything else!

Close Window

### Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

Layout

Ease of use

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Window

## We were unable to retrieve the attached file

Close Window

### Attach and remove files

• Text Formatting
• Insert Element
• Block Formatting
• Cancel
Close Window

Close Window

#### This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --