Shipping Rates Calculation Issue & Limitations


https://forum.kartris.com/Topic93.aspx
Print Topic | Close Window

By mike - Thu 2 Sep 2010
Hello once again,

I think I may have found another bug, this time in the shipping rates system.

I've set it up so that shipping prices are calculated based on weight, but it seems that the value of the product is being used to work out the shipping, when placing an order, instead!

I've done a little testing, with the following results:

Firstly, these are the rates I was using:
Up to 2 kg              £0.50
Up to 2.5 kg           £1.00
Up to 3 kg              £1.50
Up to 3.5 kg           £2.00
All Higher Orders    £2.50

When I starting varying the product price, this is what I found (in all cases, the actual weight of the product was 0.12 kg):

Price                  Reported Shipping Cost
£0 - £2.49         £0.50
£2.50 - £3.49    £1.50
£3.50 plus         £2.50


Finally, I've also noticed that there's a limitation on how many shipping rates can be added into the system before errors start being reported. Once the ID numbers of shipping rates in the database (tblKartrisShippingRates) exceed 255, it falls over when trying to add more due to a tinyint being used for the data type of the ID number. Was this intentional?

Many thanks in advance as always,
Mike
By Medz - Sun 5 Sep 2010
Hi Mike, again can you try to use this DLL and see if it fixes the issue with the shipping rates? This DLL should also support bigger shipping rates ID so you can safely change the field's data type to 'smallint' if needed.

Regards,

Medz
By mike - Mon 6 Sep 2010
Hi Medz,

I've had a look at it, and the system is now using the product weight instead of the price. However, I've noticed that it's missing out certain shipping rates that aren't whole numbers (e.g. 3.5 kg). What it seems like to me is that the product weights are being rounded to the nearest whole kilogram when calculating the shipping cost.

For instance, if I have the following two shipping rates:
Up to 4 kg   £2.00
Up to 6 kg   £3.00

Here are the shipping costs with these product weights:
4.00 - 4.49 kg   £2.00
4.50 - 6.00 kg   £3.00

4.49 and below could be getting rounded down to 4 (and thus uses the first rate), and 4.50 be getting rounded up to 5 (and thus uses the second rate).

Thanks,
Mike
By Medz - Mon 6 Sep 2010
Ok. I think I found an issue with the stored procedure that pulls out the shipping rates. Please run this query against the database and check if it fixes the issue.

ALTER PROCEDURE [dbo].[spKartrisShippingMethods_Get](@D_ID as int,@Boundary as real,@LANG_ID as int) AS BEGIN SET NOCOUNT ON;SELECT S_ShippingRate, SM_ID, SM_Name, SM_Desc FROM (tblKartrisDestination INNER JOIN tblKartrisShippingRates ON tblKartrisDestination.D_ShippingZoneID = tblKartrisShippingRates.S_ShippingZoneID) INNER JOIN vKartrisTypeShippingMethods ON vKartrisTypeShippingMethods.SM_ID = tblKartrisShippingRates.S_ShippingMethodID WHERE SM_Live = 'true' AND S_Boundary>= @Boundary AND D_ID = @D_ID AND LANG_ID = @LANG_ID ORDER BY SM_OrderByValue ASC, SM_ID ASC, S_Boundary ASC END


This basically changes the 'boundary' parameter datatype from 'decimal' to 'real'.
By mike - Mon 6 Sep 2010
That seems to have done the trick! If I have any further trouble with it, I'll let you know.

Thanks a lot,
Mike