ShippingByWeightAndCountry method does not correctly filter on shipping country

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 anni tempo fa
version: NopCommerce 1.20

Continuation of unresolved issues in:
https://www.nopcommerce.com/Boards/Topic.aspx?TopicID=1889

I am getting unwanted shipping methods offered on the cart for destination countries,. at $0.00 price!

My setup is as follows:

Configuration.Global Settings.Units.Bae Weight Unit=Kg
Product.SKU Variant.Weight=12

Shipping Settings:
- Shipping Country of Origin = Australia

Shipping Calculator Configuration:
-----------------------------------------------------------------------------------------------
Country,       Method,                  From Kg,      To Kg,          Charge Amount/Kg
-----------------------------------------------------------------------------------------------
USA,            AusPost-Intl,            0.0,             2.0,              10
Australia,     AusPost-Registered,  0.0,             0.25,            39
Australia,     AusPost-Registered,  0.26,            0.5,             23
Australia,     AusPost-Registered,  0.51,            1.0,             17
Australia,     AusPost-Registered,  1.01,            2.0,              9
.....
Australia,     AusPost-Registered,  10.01,            15.0,          2.3

When Customer Billing+Shipping address is=Australia

The following 2 errors occur (I assume they are errors or am I setting something up incorrectly),
1. Shipping Method AusPost-Int'l is for USA Only, not Australia, and should not appear
2. Shipping Method weight range is incorrect 0-2.0Kg,m yet product weight is 15Kg, price shows as "( .00 Excl Tax)"

Can someone please advise me where I can review the code that
a. checks the shipping method country to user shipping country
b. checks that the shipping method weight range matches the product weight

Any help would be appreciated.
14 anni tempo fa
I'm having the same issue.  This shipping module isn't much good if it shows all shipping methods whether added to this rate computation or not.

Wish I could help - surely someone knows which line of code to quickly change.
14 anni tempo fa
Looks like the code is wrong in the project:

Nop.Shipping.ShippingByWeightAndCountry

the file:

ShippingByWeightAndCountryComputationMethod.cs

At line 99 it gets all shipping methods:

ShippingMethodCollection shippingMethods = ShippingMethodManager.GetAllShippingMethods();


We don't want all shipping methods - only the ones configured in the rate computation i.e. can be found in the table Nop_ShippingByWeightAndCountry, such as in this query:

SELECT DISTINCT ShippingMethodID, CountryID
FROM         Nop_ShippingByWeightAndCountry
WHERE     (CountryID = @Country)

where @Country is the int value for the shipping address country

I can work on a fix but my coding isn't pretty - can the Nop Team rectify this quickly and prettier?
14 anni tempo fa
Probably 101 ways to fix this but here's a simple and quick way which seems to work.

Find the project, Nop.Shipping.ShippingByWeightAndCountry

In the file:

ShippingByWeightAndCountryComputationMethod.cs

Find this line (about 105):

shippingOptions.Add(shippingOption);


Before it, add this line of code:

if (shippingOption.Rate != 0)


Recompile and upload the new dll/files to your host.  That's it.  Seems to work and also works if the item has free shipping selected.

If you also amend the line (about 55):

shippingTotal = shippingByWeightAndCountry.ShippingChargeAmount * weight;


to this:

shippingTotal = shippingByWeightAndCountry.ShippingChargeAmount;


then you have also got a fixed price for the weight range rather than the 'price per kg'.

Let me know how you get on.
14 anni tempo fa
diggers, thanks for the fix. The bug is still present in version 1.6 released today.

I don't see how this could be by design. If you have an item which should be shipped freight, lesser shipping options shouldn't show up at a price of $0 when the item is above the weight ranges.
14 anni tempo fa
I agree - if this is by design then it is by very poor design.  

I've raised another post in the Bug Report thread - http://nopcommerce.com/boards/t/3753/15-bug-in-shipping-by-weight-country.aspx

but the team are adamant it is by design.  I don't think they have really looked at this otherwise they may change their minds.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.