E-Commerce Shipping Problem

1. Senior Member
Join Date
Dec 1969
Posts
152

## E-Commerce Shipping Problem

Ive been developing a very flexible e-comm application.<BR>And the shipping section of this is giving me trouble.<BR>Here is my process and my problem.<BR><BR>Shipping is to be calculated on the cart page. This is calculated by pulling a number from the database for each product in the users cart. The field in the db that the shipping amount is pulled from is called "fldShp".<BR>So lets say that a user has 2 products in his/her shopping cart.<BR>The first products shipping is \$1.75 and the other is \$2.00<BR>These two numbers need to be added togather. This seems overly simple.<BR>But! My problem is looping through the recordset and adding these togather. So far ive tried counting observations then multiplying the shipping number by the last observation (in this case would be 2). This works fine for products that have the same amount of shipping, but for products that differ in shipping will only be multiplied by 2. Therefore just increasing it to two, three, four, etc.. times the original shipping price.<BR><BR>If tried all sorts of simple arithmatic. Nothing seems to work correctly. Any help would be very much appreciated.<BR><BR>I will post code if needed.<BR><BR>Thanks<BR>--Nathan

2. Junior Member
Join Date
Dec 1969
Posts
18

## RE: E-Commerce Shipping Problem

To what ever I understand from your problem. I suggest you <BR>Why dont you temporarily store all the purchases made by one<BR>of the customer in an dynamic array and then add up all these using the array. hope this helps you..

3. ND Guest

## RE: E-Commerce Shipping Problem

If I understand your question correctly, one of these options should work: (though unless you are saving the user&#039s shopping cart in a database, you shouldn&#039t need to create a recordset... query strings and dictionary object work pretty well for smaller websites, if your website isn&#039t small, try one of the following)<BR><BR>1). For RecordSets with Do While... MoveNext<BR><BR>Dim intShip<BR>Do While NOT objRS.EOF<BR><BR> intShip = intShip + Ccur(objRS("shippingCharge"))<BR>objRS.MoveNext<BR >Loop<BR><BR>OR<BR><BR>2). Load the RecordSet into an array using GetRow... once in an Array, the information is very easy to modify.<BR><BR>Hope this helps!<BR>God Bless

4. peterjl@austec.net.au Guest

## why not just a plain old SQL group by query?

EG:<BR><BR>Select cartid, sum(fldshp) from cartTable group by cartid where cartid = currentcartid<BR><BR>I realise this is a little simplified for your example but hope it gives your the idea. You would probably need to do a join between the carttable and the products table via the product code, and then introduce the grouping. <BR><BR>The easiest way to generate the appropriate syntax for the query would be to import the tables into an Access DB and use the query designer.

5. peterjl@austec.net.au Guest

## why not just a plain old SQL group by query?

EG:<BR><BR>Select cartid, sum(fldshp) from cartTable group by cartid where cartid = currentcartid<BR><BR>I realise this is a little simplified for your example but hope it gives your the idea. You would probably need to do a join between the carttable and the products table via the product code, and then introduce the grouping. <BR><BR>The easiest way to generate the appropriate syntax for the query would be to import the tables into an Access DB and use the query designer.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•