Closed (fixed)
Project:
Ubercart
Version:
6.x-2.1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 May 2010 at 02:37 UTC
Updated:
25 Sep 2012 at 19:20 UTC
I have complex requirement on calculating shipping charges based on the destination country and total amount.
For ex:
0-20 US $5
21-40 US $10
41-60 US $15
60-80 US $17
80-100 US $19
---
----
Similar to this, we have charges for Canada and Mexico.
Is there any way that I can call a PHP function(which will retrieve shipping charge from cck or a custom table) by providing two parameters (Country and total amount)?
I tried with conditional actions, but because i have too many rules it gets bigger and bigger and cumbersome.
Thanks,
Comments
Comment #1
tr commentedThere are three ways to do this in Ubercart:
1) Use the built-in Conditional Actions to check both the order total and destination country, selecting an appropriate rate for each combination.
2) Write a custom Conditional Action with PHP to do this. Useful for more complex conditions.
3) Write a custom shipping module. It is very easy to take uc_flatrate as a template for your own shipping module, then modify it to perform whatever calculations you desire.
Comment #2
getstarted commentedThanks, I went with option 3 and worked like charm. Thanks,
Comment #4
philpro commentedgetstarted, care to share your source code for this? I'm looking for the same solution.
Comment #5
summit commentedSubscribing, interested in code also!
greetings, Martijn
Comment #6
cybershan commentedSubscribing...
Comment #7
cybershan commentedwhen user select the country option on Checkou page, the value only be known on Client side, not posted to server side, How to let shipping module know what country user selected ?
Comment #8
madhattertech commentedI also needed to create a custom shipping module. This site helped me so I thought I would pass it on.
http://tiger-fish.com/blog/tutorial-writing-drupal-6-ubercart-shipping-m...
Mike