close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Shipping Rules for Zip Ranges & Shipping Service Variable

Thread began 11/20/2009 5:09 pm by Kevin373660 | Last modified 12/01/2009 5:56 pm by Eric Mittman | 1968 views | 9 replies |


Shipping Rules for Zip Ranges & Shipping Service Variable

Using eCart 4.5.2, php, MySQL, from North America, I need to ship to customers internationally. My base configuration settings are for UPS “Standard” rates and they pull up fine for people in North America. However, for international shipments I need other services.

Therefore, I was thinking of changing the default to a global standard “Express Saver” which reaches most countries and areas where shipments have to be flown into Hawaii. Then, adding shipping rule(s) to set up multiple ranges of zip codes for the USA and Canada for a flat rate.

Shipping Rules
How would I set up a shipping rule that would override my default eCart shipping service code for a range of zip codes and countries? There was a specific video on this and another thread a few months ago, but cannot find them. Can someone please point me in the right direction/link or provide the answer? Thank you.

It would be nice later to figure a way to allow users to select faster services if supported in their area but that would complicate it for now. I just need to get this working first.

Shipping Service Variable
I also need to store the appropriate level of service in my orders table. I have created the column and will add it in the post on the confirm page. I am not sure what the variable name is or if I have to create a new session variable to hold and pass that information? I think that another thread today may hold part of this answer.

Sign in to reply to this post

Eric Mittman

Setting up a shipping rule that is based off of a range of zip codes seems like a huge undertaking to me. I'm not so sure that this would work out the way that you intent it to. Since a zip codes value may not be very close to a near by area you could not just say, 'if the zip is between this value and that value'. Because of this you would need to have shipping rules for each zip code to base the shipping on the zip.

If your shipping is going to be outside of the North America then you should just use the international shipping options for the quote, or come up with flat rate shipping values for the various countries you intend to ship to. If you wanted to go with the flat rates to the other countries this would be fewer shipping rules than having rates based on zip.

Please post back with any additional questions you have and I will be glad to help you out with what I can.

Sign in to reply to this post


Here is a simplified idea. I can replace the static ship state dropdown list with a dynamic dropdown list using my database state table. In the state table I can add a column with a value=1, if the flat $10 shipping rate applies to that state.

Shipping Rules:
A) Shipping costs apply only if the total order weight is >0 (if nothing ships weight is =0
(This I have working and for others, it requires a weight column in your products table and a total order weight when setting up the eCart values)

B) If customer leaves the default ship method as UPS Standard=11, and the flatShipRate for the state =1, then the shipping cost=$10.

C) Else the rule does not apply, and the selected shipping method and dynamic rate from the courier is used.

How does that sound? If workable all that I need to know is how to:

1. How to grab the corresponding value for the flatShipRate column when the state is selected form the table record set? A dynamic menu list only allows me to select the value & label. I can not figure out how to also get and set the row value for the flatShipRate at the same time. I have been trying the eCart--> General --> Set Session Value, however perhaps my selection of the trigger and value are wrong. I have tried a few combinations and it still won't work.

2. eCart Shipping Rule Conditions for the above? (I understood the older online tutorial but the new one leaves me lost on how to apply what is show for different scenario.)

Please Help.

Sign in to reply to this post

Eric Mittman

I don't think that this is going to be very easy to implement like you have stated here. Instead of creating a dynamic select list for the state and try to use multiple values for the selection you should instead use a recordset lookup based on the selected state. You can query your table based on the posted state value.

You would then store the corresponding value for that state in a session variable. You will also want to check and make sure that you are storing the value for the shipping type in a session variable as well. Once you have these session variables setup like this you can then craft the rules to be like how you want.

For the flat rate rule you are looking to see if both of these session variables exists, then if they equal 1 and 11 respectively. If they do then you would have the flat rate value.

For the other shipping quote rule you can add in conditions for these other two session variables, if the ups variable is not equal to 11 AND the flat rate session variable is not equal to 1. Once you add in these other conditions the rule should only function if your first rule does not.

Sign in to reply to this post


I am using record sets. The shipping States record set and menu works fine. But I can't figure out how to set the session value for the flatShippingRate from the states table.

Please clarify what you are sugesting? Two recordsets? The second filtered by?? Then query the table with the second recordset based on the posted state value? How?

And then how to set the session for it?? What would I select as the Trigger and Value?

Sign in to reply to this post

Eric Mittman

So how you are setting up your state select list should not matter so long as the values match what you in your table. You will want to add in another recordset that selects from this table, you will want to use the filter options at the bottom to filter based on a form value and specify the state select list for the value.

This should give back the record from your table where it matches the state selected by the user. Once you have got this working the next thing is to set the session variable.

For the trigger you can use the post of the state value the same as you are filtering your recordset. For the value you would just set it to the column binding that holds the value you are looking for from your filtered recordset.

If you have any questions about any part of this please post back with what you have and the result you are getting.

Sign in to reply to this post


Still not working. For the checkout.php, I can't seem to get the session value set for the flatShipRate. Attached is the file. I tried to follow your instructions, but I must be doing something wrong:

1. I have a recordset (ShipState) to pull in the dw menu/list values set as state_Abrv column (ex. NY) from the tbl_state table

2. Created a second recordset (StateFlateRate) same table with the following settings:

Filter: state_Abrv =
Form Variable - state_Abrv

3. Setting Session:

Server Behaviors - eCart --> General --> Set Session Value

Trigger: (Form Value for Shipping State)
Session: flatShipRate
Value: (from the second recordset (StateFlateRate) column flatShipRate)

4. I also tried moving the code block to set the session to after the recordset. I still did not work. Additional attempts are remmed out in the code. I would like to have this resolved before I move on. Your asstance is appreciated.

Sign in to reply to this post

Eric Mittman

You have got it mostly there. I can see two problems that would prevent this from working correctly. The first issue is that you have this second recordset and the set session value code on this checkout page. This does not work because the checkout form is posting to the confirm page. You will need to move this recordset and set session code to the confirm page.

The other issue that I can see is how you are filtering the value for the recordset, you are filtering it on:


This is not the name of your select list though, the list is name state_province. So the filtered value you are using for the rs will need to be updated to be this state_province value instead. After you make these updates run through a test and let us know the result.

Sign in to reply to this post


Thank you for the direction to move the recordset and set the session variable on the confirm page. Below are the setting required for others who may be looking for a similar solution. I have that working on Thrusday!!

Only the shipping rules need to be configured in the eCart Object. You gave me some general direction in a ticket that I will try to follow.

HOWEVER, I ran into a problem last Tuesday night and need to switch to PayPal. I realy don't want to loose all of the effort so far. I am hopping that you, Ray or Jason can advise, as soon as possible!

New thread opened Thursday:

StateFlateRate - confirm.php

Filter: state_Abrv =
Form Variable shipping_state_province
Sort: None

Trigger: eCartCheckoutForm_shipping_state_province
Session Name: flatShipRate
Value: StateFlateRate['flatShipRate']

Sign in to reply to this post

Eric Mittman

Thanks for posting back with this info here, I'm sure that others will find it helpful.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...