Include Geo and Exclude Geo problem in shipping method

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Include Geo and Exclude Geo problem in shipping method

Abhishake Agarwal
Hi,

I have to display shipping method depending on shipping address country.

There are 2 types of shipping method one for local (specific to that country
e.g. US) and other for international (e.g. Not US but all other countries).

To implement this I have used "Include Geo" (e.g. Include Geo = US, for
local shipping method)  and "Exclude Geo" (e.g. US for international
shipping method) field.

E.g. "1st shipping method" (local only "US")              : include Geo =
"United States" and Exclude Geo = ""
       "2nd shipping method" (international not US)       : include Geo=""
and Exclude Geo="United States"

Please let me know whether I am configuring it correctly according to above
requirement.

Now when I assign any country  to "Include Geo" or "Exclude Geo" shipping
method does not get displayed in checkout page,

When I tried debugging it, I found
"component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh"
has:
    *
    shippingEstWpr = new ShippingEstimateWrapper(dispatcher, shoppingCart,
0);
    context.put("shippingEstWpr", shippingEstWpr);
    context.put("carrierShipmentMethodList",
shippingEstWpr.getShippingMethods());*

Now ShippingEstimateWrapper constructor internally calls:

 *ProductStoreWorker.getAvailableStoreShippingMethods(delegator,
productStoreId,shippingAddress, shippableItemSizes, shippableItemFeatures,
shippableWeight, shippableTotal);
*
Inside getAvailableStoreShippingMethods:

*String includeGeoId = method.getString("includeGeoId");
                String excludeGeoId = method.getString("excludeGeoId");
                if ((includeGeoId != null && includeGeoId.length() > 0) ||
(excludeGeoId != null && excludeGeoId.length() > 0)) {
                    if (shippingAddress == null) {
                        returnShippingMethods.remove(method);
                        //Debug.logInfo("Removed shipping method due to
empty shipping adresss (may not have been selected yet)", module);
                        continue;
                    }
                }*

above code removes shipping method if shipping address is null and shipping
method has Exclude Geo or Include Geo

shipping address is null because shipping contactMechId is not set in
shoppingCart Object

Please let me know if this is a bug and what is the better way to set
shipping ContactMechId without effecting other functionality.

Thanks and Regards,
Abhishake
Reply | Threaded
Open this post in threaded view
|

Re: Include Geo and Exclude Geo problem in shipping method

Jacques Le Roux
Administrator
Which version or revision are you using ?

Jacques

From: "Abhishake Agarwal" <[hidden email]>

> Hi,
>
> I have to display shipping method depending on shipping address country.
>
> There are 2 types of shipping method one for local (specific to that country
> e.g. US) and other for international (e.g. Not US but all other countries).
>
> To implement this I have used "Include Geo" (e.g. Include Geo = US, for
> local shipping method)  and "Exclude Geo" (e.g. US for international
> shipping method) field.
>
> E.g. "1st shipping method" (local only "US")              : include Geo =
> "United States" and Exclude Geo = ""
>       "2nd shipping method" (international not US)       : include Geo=""
> and Exclude Geo="United States"
>
> Please let me know whether I am configuring it correctly according to above
> requirement.
>
> Now when I assign any country  to "Include Geo" or "Exclude Geo" shipping
> method does not get displayed in checkout page,
>
> When I tried debugging it, I found
> "component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh"
> has:
>    *
>    shippingEstWpr = new ShippingEstimateWrapper(dispatcher, shoppingCart,
> 0);
>    context.put("shippingEstWpr", shippingEstWpr);
>    context.put("carrierShipmentMethodList",
> shippingEstWpr.getShippingMethods());*
>
> Now ShippingEstimateWrapper constructor internally calls:
>
> *ProductStoreWorker.getAvailableStoreShippingMethods(delegator,
> productStoreId,shippingAddress, shippableItemSizes, shippableItemFeatures,
> shippableWeight, shippableTotal);
> *
> Inside getAvailableStoreShippingMethods:
>
> *String includeGeoId = method.getString("includeGeoId");
>                String excludeGeoId = method.getString("excludeGeoId");
>                if ((includeGeoId != null && includeGeoId.length() > 0) ||
> (excludeGeoId != null && excludeGeoId.length() > 0)) {
>                    if (shippingAddress == null) {
>                        returnShippingMethods.remove(method);
>                        //Debug.logInfo("Removed shipping method due to
> empty shipping adresss (may not have been selected yet)", module);
>                        continue;
>                    }
>                }*
>
> above code removes shipping method if shipping address is null and shipping
> method has Exclude Geo or Include Geo
>
> shipping address is null because shipping contactMechId is not set in
> shoppingCart Object
>
> Please let me know if this is a bug and what is the better way to set
> shipping ContactMechId without effecting other functionality.
>
> Thanks and Regards,
> Abhishake
>