Tags/topics: 
1
Answers
Vote up!
0
Vote down!

Shipping flat rate module using zip codes Help...

I have spent the day trying to find this answer and haven’t found anything that helps. My basic problem is I need to set up shipping fees based on 3 conditions. These are delivery areas based on Zip codes. The first is 45 zip codes the second is 3 and the last is anything else. I can get it working for 1 zip code in the first and second and a catch all. The problem comes when trying to add a second zip code to any condition. That condition stops working. This is setup exactly that the exampled used for Cities by rfay. This would be a good example to update to adding 2 cities
I have tried Operator Values of Contain and Equals and every sort of Text combination I can think of to get the search on multiple zip codes like 78701|78702 even a bunch of regex strings. Even a step beyond was going to various OR conditions for the second zip code. Anytime the condition adds one more value it stops working.

Working export:

{ "commerce_shipping_service_area_1_delivery" : {
"LABEL" : "Rate Area 1 delivery",
"PLUGIN" : "rule",
"REQUIRES" : [ "commerce_order", "commerce_shipping" ],
"USES VARIABLES" : { "commerce_order" : { "label" : "Order", "type" : "commerce_order" } },
"IF" : [
{ "commerce_order_compare_address" : {
"commerce_order" : [ "commerce_order" ],
"address_field" : "commerce_customer_shipping|commerce_customer_address",
"address_component" : "postal_code",
"operator" : "contains",
"value" : "78701"
}
}
],
"DO" : [
{ "commerce_shipping_service_rate_order" : {
"shipping_service_name" : "area_1_delivery",
"commerce_order" : [ "commerce-order" ]
}
}
]
}
}

This export fails

{ "commerce_shipping_service_area_1_delivery" : {
"LABEL" : "Rate Area 1 delivery",
"PLUGIN" : "rule",
"REQUIRES" : [ "commerce_order", "commerce_shipping" ],
"USES VARIABLES" : { "commerce_order" : { "label" : "Order", "type" : "commerce_order" } },
"IF" : [
{ "commerce_order_compare_address" : {
"commerce_order" : [ "commerce_order" ],
"address_field" : "commerce_customer_shipping|commerce_customer_address",
"address_component" : "postal_code",
"operator" : "contains",
"value" : "78701"
}
},
{ "OR" : [
{ "commerce_order_compare_address" : {
"commerce_order" : [ "commerce_order" ],
"address_field" : "commerce_customer_shipping|commerce_customer_address",
"address_component" : "postal_code",
"operator" : "contains",
"value" : "78702"
}
}
]
}
],
"DO" : [
{ "commerce_shipping_service_rate_order" : {
"shipping_service_name" : "area_1_delivery",
"commerce_order" : [ "commerce-order" ]
}
}
]
}
}

Asked by: David C
on September 26, 2012

1 Answer