close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

wrong weight being calculated

Thread began 8/14/2014 4:32 pm by Christopher West | Last modified 8/14/2014 7:30 pm by Jason Byrnes | 307 views | 9 replies |

Christopher WestCommunity Expert

wrong weight being calculated

Hi after conducting a few tests to make sure the correct shipping cost is added to the order. I foudn that the product weight is calculated wrong. I have attached the checkout.php file. the first occurrence of the weight reference is on line 217.

The idea is to add sun the weight for products, product options and then the quantity.

I was wonder what would be the best way to provide more information on this and/or testing methods (currently I am using <?php echo $DinkyCart->DisplayInfo("TotalWeight"); ?> to display the total weight for reference in my testing.

Are you able to tell from the attached php file if the the page is doing the calculation for ((products+product options) x quantity)

in my ecart object is does state weight quantity (but i wonder if it takes into accoutn for product options? attaching screenshot

The odd thing is even if it doesn't take into account product options weight the maths still doesn't add up correctly.

I give you an example:

I did a test order and manually I added up all the weight that stored in the database the total is : 348g
using <?php echo $DinkyCart->DisplayInfo("TotalWeight"); ?>to display the weight in the cart it calculates as 160g

Here are all the products in my cart (fr quantity I just repeated the products:

(main product) ball bracelet is 40g
(product option) Charm Type Small Diamond is 40g
(product option) Charm Type Small Diamond is 40g
(product option) Charm Type Small Heart is 40g

(main product) Ascending Double Print Large Keyring is 40g
(product option) Ascending Small Charm Heart is 0g
(product option) Ascending Large Charm Diamond is 0g

(main product) Ascending Double Print Large Keyring is 40g
(product option) Ascending Small Charm Heart is 0g
(product option) Ascending Large Charm Diamond is 0g

Silver Cleaning Cloth is 1g
Silver Cleaning Cloth is 1g
Silver Cleaning Cloth is 1g
Pandora Charm Carrier is 40g
Sterling Silver Initial is 40g
Dinky Fingerprint Impression Kit is 5g
Dinky Fingerprint Impression Kit is 5g
Dinky Fingerprint Impression Kit is 5g
Dinky Hand/Footprint/Paw Print Kit is 5g
Dinky Hand/Footprint/Paw Print Kit is 5g


I just dont understand where its getting 160g from?! I mean if you look I have 3 products with a weight of 1g each so the calculation should at least end with either a 3 or a 8 (if you take into account the 5g items)


Chris

Attached Files
paypal-checkout.php
Sign in to reply to this post

Jason ByrnesWebAssist

<?php echo $DinkyCart->DisplayInfo("TotalWeight"); ?>

will retur the TotalWight for the first item

(main product) ball bracelet is 40g
(product option) Charm Type Small Diamond is 40g
(product option) Charm Type Small Diamond is 40g
(product option) Charm Type Small Heart is 40g

40 + 40 + 40 + 40 = 160


to return the Subtotal of the TotalWight column, use:
<?php echo $DinkyCart->TotalColumn("TotalWeight"); ?>

Sign in to reply to this post

Christopher WestCommunity Expert

Hmm that makes sense lol

ok I now got the total weight as 428g (but it should be 348g) if you add all the weights in that list in the first post I wrote. so there is a variance of 80g somewhere.

Sign in to reply to this post

Jason ByrnesWebAssist

Must be a problem in the way the weights are being saved in the add to cart button

to troubleshoot, add the weight binding in the cart display next to the price:
<?php echo $DinkyCart->DisplayInfo("TotalWeight"); ?>

and also add the TotalColumn binding outside the cart display:
<?php echo $DinkyCart->TotalColumn("TotalWeight"); ?>

Sign in to reply to this post

Christopher WestCommunity Expert

here we go I am attaching a screenshot. now im very confused lol

For your reference the main product is the name which is directly in line with the quantity box and the product options are under that.

(I have added the snippet of code you gave me to the product options as well as the main product, but it looks like 160 means the product+product options totals). but taking that into account the total weight should now be 468g and at the bottom where my buttons are it shows 428 but my manual calculation should be 348 lol its so confusing...I was never good at math lol

I'm also attaching the add to cart page. as well as the ecart files that webassist generate in case i have missed something in there.
Chris

Sign in to reply to this post

Jason ByrnesWebAssist

So the weight is being calculated as:
160 + 160 + 3 + 10 + 40 + 40 + 15 = 428


So my guess would be that the lookup you are using in the add to cart to add the weight is not calculating the weight the way you are expecting.

Sign in to reply to this post

Christopher WestCommunity Expert

So how do I fix this? as if I were to look in my database and manually add up all the weights of the products and product options that are in the cart my calculator says 348.

as earlier below are all the products that are in the cart with the corrisponding weights in the database:

(main product) ball bracelet is 40g
(product option) Charm Type Small Diamond is 40g
(product option) Charm Type Small Diamond is 40g
(product option) Charm Type Small Heart is 40g

(main product) Ascending Double Print Large Keyring is 40g
(product option) Ascending Small Charm Heart is 0g
(product option) Ascending Large Charm Diamond is 0g

(main product) Ascending Double Print Large Keyring is 40g
(product option) Ascending Small Charm Heart is 0g
(product option) Ascending Large Charm Diamond is 0g

Silver Cleaning Cloth is 1g
Silver Cleaning Cloth is 1g
Silver Cleaning Cloth is 1g
Pandora Charm Carrier is 40g
Sterling Silver Initial is 40g
Dinky Fingerprint Impression Kit is 5g
Dinky Fingerprint Impression Kit is 5g
Dinky Fingerprint Impression Kit is 5g
Dinky Hand/Footprint/Paw Print Kit is 5g
Dinky Hand/Footprint/Paw Print Kit is 5g

So the calculation should be 348 not 428 :(

In the paypal-cart.php file i provided in previous post. on line 91 the weights calculations start there. I had to use 3 recordsets to account for the different shipping types (beena while cannot remember why).

Sign in to reply to this post

Jason ByrnesWebAssist

you fix it at the add to cart level.

the problem is that when the weight is added to the cart, it is not adding properly.


the screen shot, and this:

(main product) Ascending Double Print Large Keyring is 40g
(product option) Ascending Small Charm Heart is 0g
(product option) Ascending Large Charm Diamond is 0g

(main product) Ascending Double Print Large Keyring is 40g
(product option) Ascending Small Charm Heart is 0g
(product option) Ascending Large Charm Diamond is 0g

do not match up

Sign in to reply to this post

Christopher WestCommunity Expert

Erm....Jason, earlier when I told you I wasn't good at maths?..well I wasn't wrong lol I believe I have solved it lol I was adding all the products as well as product options...what I completely forgot that some product options come included. (basically a customer can add additional charms etc.. to an existing necklace for example). So some products come with options included and some products have options that are completely optional. So the website IS calculating everything as it should...but my stupid brain needs a reboot lol

Thanks for all your help :)

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

You're welcome.

Sign in to reply to this post
loading

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.

Want your website pre-built and hosted?

Close Windowclose

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

rating

Layout

rating

Ease of use

rating

security code refresh image

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 Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

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

Uploading file...