Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 CODE: Calculate shipping
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hakkatil
VP-CART New User

109 Posts

Posted - June 18 2002 :  17:01:41  Show Profile  Reply with Quote
At our company we have two different shipping needs.
First is for USA customers and the second is for international customers.

we offer for USA customers:
free shipping if they spent $75.00 or up
Free HAT and shipping if they spent $125.00 or up
Free T-shirt and shipping if they spent $200.00 or up
Free Leather Jacket and shipping if they spent $500.00 or up
We also have a monthly specials, like 2 or 3 products for less money. Specials are not included for the
above deal.

for International customers:
between 1-3 items, the shipping is $13.00
between 4-6 items, the shipping is $16.00
between 7-10 items, the shipping is $18.00
between 11-12 items, the shipping is $21.00
between 13-15 items, the shipping is $23.00

The trick here is that making the country, required field on shopcustomerform.asp and check all variations
of US abbreviations (like US, USA, united states, united states of america, North America, so on). The
others will be international orders. This worked for our company almost 2 years now. it might work for you
as well. This is simple and effective calculation.
I was lazy to play with shopshippingcalc.asp. If you'd like you can play around with this this file already included in VPASP.

We used shopformatorder.asp and changed Sub FormatShipping (total). It is simple and effective. There are
only 2 main variable that is involved. Miktar and Total . Total is calculated by VPASP. But we must calculate miktar which is used for quantity. It calculates how many items are ordered. For us it is necessary for international
customers.

In addition to change Sub FormatShipping (total), we must add the line

miktar=miktar+quantity in

' VPASP version 3.0 or 3.50
Sub FormatDetails

'VPASP version 4.0
Sub FormatItemDetails ' inside the do loop and just before the


Items.MoveNext
Loop



At the beginning of page define miktar, otherwise you will get an error.

Dim miktar

we used VPasp 3 and 3.50 versions for this purpose and now using version 4.0.

for VPASP 3.0 and 3.50
just replace formatshipping (total) sub with this new one. You can change numbers as you like.

Note: If you'd like to test this, go to this page http://208.17.144.14/testsite/default.asp. I created a test side. Also you can find many features and buttons that you might like. There are all free. I hope this can help you.


Sub FormatShipping (total)
dim shipcost,Free
dim eight '1-3 Items
dim thirteen '4-6 Items
dim sixteen '7-10 Items
dim eighteen '11-12 Items
dim twentyone '13-15 Items
dim twentythree '16-18 Items
dim us
dim usa
dim united
dim unitedstate
dim empty1

empty1=""
us="US"
usa="USA"
united="UNITED STATES"
unitedstate="UNITED STATES OF AMERICA"
Free=0.00
shipcost=5.00
eight=8.00
thirteen=13.00
sixteen=16.00
eighteen=18.00
twentyone=21.00
twentythree=23.00

if strocountry=empty1 or ucase(strocountry)=us or ucase(strocountry)=usa or ucase(strocountry)=united or
ucase(strocountry)=unitedstate then
if strocountry=empty1 then
Session("strocountry")=usa
end if
if isnull(shipcost) then exit sub
if Total<74 then
DisplayRow shipcost
Total=Total+shipcost
else
DisplayRow Free
shipcost=0.00
Total=Total+shipcost
end if
else
if miktar <4 then
DisplayRow eight
Total = Total + eight
end if
if miktar > 3 and miktar < 7 then
DisplayRow thirteen
Total = Total + thirteen
end if
if miktar > 6 and miktar < 11 then
DisplayRow sixteen
Total = Total + sixteen
end if
if miktar > 10 and miktar < 13 then
DisplayRow eighteen
Total = Total + eighteen
end if
if miktar > 12 and miktar < 16 then
DisplayRow twentyone
Total = Total + twentyone
end if
if miktar > 15 then
DisplayRow twentythree
Total = Total + twentythree
end if
end if
end sub

for VPASP 4.0 version

Sub FormatShipping (total)
dim shipcost,Free
dim eight '1-3 Items
dim thirteen '4-6 Items
dim sixteen '7-10 Items
dim eighteen '11-12 Items
dim twentyone '13-15 Items
dim twentythree '16-18 Items
dim us
dim usa
dim united
dim unitedstate
dim empty1

empty1=""
us="US"
usa="USA"
united="UNITED STATES"
unitedstate="UNITED STATES OF AMERICA"
Free=0.00
shipcost=5.00
eight=8.00
thirteen=13.00
sixteen=16.00
eighteen=18.00
twentyone=21.00
twentythree=23.00
'shipcost=curoshipcost
if isnull(shipcost) then exit sub
if shipcost<>"" then
If shipcost> 0 then
' DisplayRow LangProductShippingCost, shipcost, strodualshipping
'############
if strocountry=empty1 or ucase(strocountry)=us or ucase(strocountry)=usa or
ucase(strocountry)=united or ucase(strocountry)=unitedstate then
if strocountry=empty1 then
Session("strocountry")=usa
end if
'if catid<>10 then
if isnull(shipcost) then exit sub
if Total<74 then
shipcost=5
DisplayRow LangProductShippingCost, shipcost, strodualshipping
else
shipcost=0
DisplayRow LangProductShippingCost, shipcost, strodualshipping
end if
' else
' DisplayRow free
' Total=Total+0
'end if
else
if miktar <4 then
shipcost=shipcost+eight
DisplayRow LangProductShippingCost, shipcost, strodualshipping
end if
if miktar > 3 and miktar < 7 then
shipcost=shipcost+thirteen
DisplayRow LangProductShippingCost, shipcost, strodualshipping
end if
if miktar > 6 and miktar < 11 then
shipcost=shipcost+sixteen
DisplayRow LangProductShippingCost, shipcost, strodualshipping
end if
if miktar > 10 and miktar < 13 then
shipcost=shipcost+eighteen
DisplayRow LangProductShippingCost, shipcost, strodualshipping
end if
if miktar > 12 and miktar < 16 then
shipcost=shipcost+twentyone
DisplayRow LangProductShippingCost, shipcost, strodualshipping
end if
if miktar > 15 then
shipcost=shipcost+twentythree
DisplayRow LangProductShippingCost, shipcost, strodualshipping
end if
end if
'#########
ForDualtotal=Fordualtotal+strodualshipping
end if
end if
end sub

Edited by - hakkatil on June 18 2002 17:02:24

Edited by - hakkatil on June 18 2002 17:05:46
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00