Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > ECommerce Shipping Charge by Zone/country/zipcode View modes: 
User avatar
Member
Member
gan_kim_heng-hotmail - 3/1/2012 12:32:30 AM
   
ECommerce Shipping Charge by Zone/country/zipcode
I need to implement a shipping cost that can based on zone or country/zip-code.

i saw something in this post:
http://devnet.kentico.com/Forums/f47/fp14/t14865/ECommerce-Shipping-Charge.aspx

and i changed to:


public class POSLAJUShippingOptionInfoProvider : ShippingOptionInfoProvider
{
protected override double CalculateShippingInternal(ShoppingCartInfo cart)
{
if (UPS)
{
return base.CalculateShippingInternal(cart);
}
else
{
// custom shipping calculation here
...
}
}
}


on top of that, I created 3/4 tables:
1) zone table (Zone1, Zone2, ...)
2) zone-country relationship table (for external courier; Malaysia in Zone1, USA in Zone4, etc)
3) zone-zipcode relationship table (for internal courier; 00000~00010 in Zone1, 10000~11000 in Zone2)
4) new/extend the "COM_ShippingCost" table to store zone-ID, and country/zipcode flag (
eg :
shippingOptionID=4, ZoneID=1, MinWeight=500g, CostValue=$10;
shippingOptionID=4, ZoneID=1, MinWeight=1000g, CostValue=$15;
shippingOptionID=4, ZoneID=2, MinWeight=500g, CostValue=$20;
shippingOptionID=4, ZoneID=2, MinWeight=1000g, CostValue=$25;
)

with this query (if external courier, based on country):

string queryText = "Select cscz.ShippingCostID, cscz.ShippingCostMinWeight, cscz.ShippingCostValue " +
" from dbo.CMS_Zone cz with (nolock) " +
"inner join dbo.CMS_ZoneCountryShipping czcs with (nolock) on cz.ZoneID = czcs.ZoneID " +
"inner join Kentico_Ecomm.dbo.COM_ShippingOption cso with (nolock) on czcs.ShippingOptionID = cso.ShippingOptionID " +
"inner join Kentico_Ecomm.dbo.CMS_Country cc with (nolock) on cc.CountryID = czcs.CountryID " +
"INNER JOIN dbo.COM_ShippingCostZone cscz with (nolock) on czcs.ZoneID = cscz.ShippingCostZoneID " +
" AND czcs.ShippingOptionID = cscz.ShippingCostShippingOptionID " +
"where czcs.CountryID = " + address.AddressCountryID +
" AND ShippingCostMinWeight <= " + cart.TotalItemsWeight +
" AND ShippingCostShippingOptionID = " + cart.ShippingOptionInfoObj.ShippingOptionID +
" ORDER BY ShippingCostMinWeight DESC";


thus I need to customize/sub-class this CMS-Desk module to perform the configuration.

~\CMSModules\Ecommerce\Pages\Tools\Configuration\ShippingOptions\ShippingOption_Edit_ShippingCosts_Edit.aspx.cs


How to override this class elegantly:


namespace CMS.Ecommerce
{
// Summary:
// ShippingCostInfo data container class.
public class ShippingCostInfo : SynchronizedInfo<ShippingCostInfo>
...

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 3/15/2012 9:46:39 PM
   
RE:ECommerce Shipping Charge by Zone/country/zipcode
Hi,

Am I understanding correctly that you're looking for a way to add custom columns to the ShippingCostInfo? That would be possible by marking the object's class (in CMS_Class) with 'ClassShowAsSystemTable' to true and then adding the fields in Site manager -> Development-> System tables.

Or how do you want to extend it?

Regards,
Zdenek

User avatar
Member
Member
gan_kim_heng-hotmail - 3/16/2012 9:09:07 AM
   
RE:ECommerce Shipping Charge by Zone/country/zipcode
adding the fields in Site manager -> Development-> System tables.


can it be done thru back-end?

Some tables need to be extended; while some are new. FOr those new tables, i need to allow a user interaction with it CMSDesk>ECommerce>Configuration.
However I am facing some problems, where:
http://devnet.kentico.com/Forums/f55/fp2/t27275/Create-a-new-module-in-Site-Module-for-CMS-Desk.aspx

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 3/27/2012 4:17:22 AM
   
RE:ECommerce Shipping Charge by Zone/country/zipcode
Hi,

As for the question on doing it thru back-end... If we speak about the same thing - Site manager, then yes, it can be done thru back-end... I thought I've expressed it with the path in the site manager... but that's okay... some more info can be found at devnet.kentico.com/docs/6_0/devguide/system_tables_overview.htm

The UniGrid is the right control for UI integration of your custom tables... I see in the other thread that you've made some progress,... have you resolved your issues?

Please let me know if I can be of any further assistance.
Regards,
Zdenek