Author |
Topic  |
|
jack208
VP-CART New User

Malaysia
116 Posts |
Posted - November 25 2015 : 05:36:20
|
Hi, I''ve a piece of customized codes for WeightRange shipping that works okay in VPASP 7.0 but is now broken in VPCart 8.0
Our weightrange shipping goes like this - First 2 kg, RM28 - If heavier than 2 kg, it''s RM28 + (RM10 per kg)
Meaning if we ship 3.2 kg, the shipping charge is RM28 + RM10x2 = RM48
Instead of setting up the Shipping Methods table to have a record for every kilo, what we did are - create one record for 0-2000 gm, base cost = $28, extra cost = $0 (this handles the first 2 kg, RM28 use case) - create a 2nd record for 2000-999999, base cost = $28, extra cost = $10
For use case with shipping weight 2 kg or less, it works fine now.
However for shipping weight > 2 kg, I''ve amended the LocateShippingWeightRange sub in shopshippingcalc.asp to do the incremental multiples. Here''s the code (in VPASP 7.0)
if totalweight >= lowweight and Totalweight < highweight then ShipCost = rsitems("ShipBaseCost") Extraweight = totalweight - Lowweight extraprice = rsitems("shipextracost") AddPrice = 0 if not isnull(Extraprice) then if Extraweight>0 then '' BGC 110103 & 151125 Amended to calculate shipping per KG ExtraWeight = csng((ExtraWeight+500)/1000) ''-- end change AddPrice = ExtraWeight * ExtraPrice end if end if TotalPrice = ShipCost + AddPrice rsitems.close set rsitems = nothing SetSess "smprice", TotalPrice exit sub end if
I replicated the same code into shopshippingcalc.asp in VPCart 8.0 and it was not working. It just picked up RM38 for me (instead of RM48).
After reading thru the shopshippingcalc.asp codes, I think we know where the issue lies. It''s in the GetShippingDatabase sub, where there''s another logic to calculate WeightRange shipping cost.
''701 - 2012.05.14 - Bug Fix: Shipping dropdowns does not show shipbasecost if shipping methods is using range if ucase(GetConfigvalue("xShippingCalc")) = "WEIGHTRANGE" OR ucase(GetConfigvalue("xShippingCalc")) = "PRICERANGE" OR ucase(GetConfigvalue
("xShippingCalc")) = "QUANTITYRANGE" then ''702 - 2012.10.11 - Bug Fix: Display wrong pirce if using pricerange, weightrange and quantityrange TempPrice = rsship("shipbasecost") if not isnull(rsship("shipextracost")) then if trim(rsship("shipextracost")) <> "" then if cdbl(rsship("shipextracost")) > 0 then TempPrice = cdbl(TempPrice) + cdbl(rsship("shipextracost")) end if end if end if else TempPrice = rsship("smprice") end if
I need to replicate our customized calculation logic into the codes above.. ie. to have the system add incremental of RM10 per KG. To do that I''ll need to know the TotalWeight of the order.
If there''s a variable that holds the TotalWeight of the order, I can include my logic into the above since the other variables are available from the rsship record.
Can I also know where (which ASP file) is the sub GetRangeShipping located?
Thanks |
|
jack208
VP-CART New User

Malaysia
116 Posts |
Posted - November 25 2015 : 12:38:35
|
Have been going back-n-forth on the codes in shopshippingcalc.asp and god... the codes are everywhere. biz logic replicated in more than one places, it''s so difficult trying to understand the codes. :S |
 |
|
jack208
VP-CART New User

Malaysia
116 Posts |
Posted - November 25 2015 : 15:27:12
|
oh... Cam, in case you are reading this - and it sounds like I''m complaining, no I''m not. :P I was just frustrated and thinking out loud (you know how it is when we pour thru a code trying to fix some stuff).
Overall we love this new version (have been using VPASP since ver 6.0) and it has helped us grow one of our businesses over the years. We just can''t wait to release VPCart 8.0 on our site. But first let me fix this shipping issue. grrr... |
 |
|
jack208
VP-CART New User

Malaysia
116 Posts |
Posted - November 25 2015 : 16:03:42
|
Okay, I think I''ve roughly sorted this matter. The place to insert the same code to do the incremental calculation for the shipping charges would be in GetShippingDB. Tested and looks to be working so far.
|
 |
|
|
Topic  |
|