• Welcome to KonaKart Community Forum. Please login or sign up.
 

Selective enabling of shipping module based on product

Started by smallitto, July 14, 2007, 05:43:14 am

Previous topic - Next topic

smallitto

Let me start by thanking  all the people involved for this great product. I would like to find out how I can implement selective enabling of shipping modules depending on the product chosen. For example I may have 3 shipping methods at my disposal i.e 1.standard air 2. expedited air 3. surface. However some products may not be eligible for options 1,2 in which case I would like to present the user with only option 3 for such products. Any ideas how I can implement this? Cheers.

paolo

Thank you. We're glad you like it.

This can be implemented within the shipping module itself. The way that it works is that the ShippingMgr calls the getQuote() method on all of the installed Shipping Modules. If any of these modules throws an exception, then they are excluded from the return list. At the moment, most of the modules do a zone check to see whether the shipping address is in a valid zone. If it isn't in a valid zone, then an exception is thrown and the module isn't returned to the UI selection list.

You need to add a product check within your shipping modules. The products being ordered should be available from the Order object passed in as a parameter. You could even maybe store some extra information in one of the product custom fields that tells you which shipping method is valid for that product since this would simplify the decision process within the shipping module. If the shipping module isn't valid for the product, then you should just throw an exception.

We realise that we don't have any tutorials for implementing shipping or payment modules. At the moment we supply the source code which enables you to follow what is going on and to implement your own modules maybe by copying an example that we supply. One of the next things on our ToDo list is to provide a tutorial and to provide a nice installer for single modules so that we can add new modules between releases of KonaKart. If you are brave, please give it a go and we'll do our best to support you through the forum.

Good luck,

Paolo

smallitto

Thank you for the prompt response! A tutorial would be a great idea, please keep it up!