Still have problem with ship by weight...

greenspun.com : LUSENET : S-Mart Shopping Cart : One Thread

Hi everyone.

I have the script up and running and working great. The only problem I am having is "ship by weight". It works fine on html generated pages but is incorrect on emails.

here's a description:if customer enters a quantity of 3 for item A and presses "buy me" the shipping will be figured on the total weight of 3 item A's throughout the generated pages all the way through the "you have successfully ordered" page. but, when the emails are received it will show qty of 3 item A's but will show the shipping price as if only 1 item A was ordered.

As a test, I tried leaving the quantity of item A set to one, but pressed "buy me" 3 times. The generated html pages are all correct (even though it makes a new row in the cart for each item A) and the shipping is still figured correctly. Also, the shipping by weight is figured correctly on the emails as well.

This would be OK except the store I'm setting up will always sell multiple quantities of items and i can't try to explain to the customers online that they have to press "buy me" 10 times if they want 10 item A's.

Please, has anyone figured anything else out about this problem? I have had an online store that has been waiting to open for over a month because of this one small bug! My customer is getting slightly P.O.'d. Please Help!! Thanks.

-- Marc Burnell (efxweb@efxweb.com), February 23, 1998

Answers

Hello Marc,

There are two things to fix in the shipping by weight routines (that I have found), that should solve your problem.

The shopping cart (sub list_items) calculates the shipping by weight correctly, while the email routines do not. You need to make the email routines calculate the $totalweight variable in the same way that the list_items routine does. Here's what to change...

  1. For send_order and send_verify, change calculation of totalweight to use the method in list_items. The proper method should be this...

    $totalweight = ($weight*$itemquant) + $totalweight;

  2. In send_verify, add $totalweight to the 2nd line of the routine, to ensure that this variable gets initialized to zero...

    my($totalquant,$totalprice,$taxtotal,$totalweight) = 0;



-- Bob Orr (borr@ourteam.com), March 01, 1998.

Hi Bob,

Thanks for your help. Worked perfectly!

-- Marc Burnell (efxweb@efxweb.com), March 02, 1998.


Moderation questions? read the FAQ