Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Shipping by Rules for VirtueMart

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Not finding zip code of alternate shipping address 01 Apr 2016 17:54 #1

  • Mike Bench
  • Mike Bench's Avatar Topic Author
Hi Reinhold:

I've been away from the project for a while but have returned to it. I was able to get all of the previous errors resolved.

The site I am working on is on my local machine inside of xammp, with Joomla 3.5 and Virtuemart 3.0.14. Captiva shop is the template I'm working with, which is a Virtuemart shop template.

Here's my issue. I am trying to get "tools" to recognize alternate zip codes. I have set up 8 zones in advanced tools, based on my "zone 1". My zone 1 is for Idaho and Utah of the USA. My test alternate address is a family address is New York City , which I have set to zone 5. Each zone is set up separately in the 8 zone boxes you have set in tools.

I want to change the shipping rate of each subsequent zone using the "ExtraShippingMultiplier". All of my shipping amounts are currently test numbers and are not the final shipping rates, except for .65 at 21 pounds, which is the DIM of my most used box. I tested that number in my UPS account. Also, I changed the shipping multiplier from "(Weight)" to "(UseWeight)" in order for the formula to calculate based on volume weight, i.e. "Shipping=2.35*ceil(UseWeight)", I have tested using "ZIP" and "ZIP3". The script is currently set to "ZIP" with the first 3 digits of the zip.

My problem is, I can't get tools to recognize anything beyond zone 1. I change the bill to address to my test address in zone 5 and it still calculates according to zone 1. I leave my zone 1 bill to address alone and set the alternate ship to address to my zone 5 address and it still calculates to zone 1. It makes no difference whether I use "ZIP" or "ZIP3" in the script.

Here's my script for zone 1:

Variable=VolWeight; Value = TotalLength*TotalWidth*TotalHeight/166
Variable=UseWeight; Value = max(VolWeight, Weight)

Name=Shipping to Continental USA Zone 1; 800<=ZIP<=884 OR 889<=ZIP<=899

UseWeight<5; Shipping=2.35*ceil(UseWeight)
UseWeight<11; Shipping=2.41*ceil(UseWeight)
UseWeight<16; Shipping=1.05*ceil(UseWeight)
UseWeight<21; Shipping=.65*ceil(UseWeight)
UseWeight<26; Shipping=1.375*ceil(UseWeight)
Name=Shipping of 26 lbs and above; UseWeight>26; Shipping=1.30*ceil(UseWeight)

Here's the script for zone 5 (New York):

Variable=VolWeight; Value = TotalLength*TotalWidth*TotalHeight/166
Variable=UseWeight; Value = max(VolWeight, Weight)

Name=Shipping to Continental USA Zone 5; 010<=ZIP<=290 OR 320<=ZIP<=340; ExtraShippingMultiplier=2.2

UseWeight<5; Shipping=2.35*ceil(UseWeight)
UseWeight<11; Shipping=2.41*ceil(UseWeight)
UseWeight<16; Shipping=1.05*ceil(UseWeight)
UseWeight<21; Shipping=.65*ceil(UseWeight)
UseWeight<26; Shipping=1.375*ceil(UseWeight)
Name=Shipping of 26 lbs and above; UseWeight>26; Shipping=1.30*ceil(UseWeight)

Is there a problem with my script or am I looking at an issue with my virtuemart install? I'm hoping I'm just missing a semi colon somewhere.

Thanks again for all of your help.

Mike

Not finding zip code of alternate shipping address 02 Apr 2016 19:41 #2

Dear Mike,
To understand why things don't work as expected, I'll have to tell you a few details about how the plugin evaluates the zones and the rules:
  • The plugin first looks at the first zone, and goes through the rules sequentially (the countries are implicitly added as an additional condition to each rule), until it finds a line where all conditions match and where a shipping cost (or NoShipping) is given. If such a match is found, it is returned.
  • If none of the rules of the first zone matches, then the second rule is considered in exactly the same way.
  • It is not possible to use one rule as condition to jump out of the current country zone. Each line will be considered separately, and you'll have to add all conditions to each rule. There is simply no way to set conditions that apply to all rules of a zone automatically. So if you have a line like
    Name=Shipping to Continental USA Zone 1; 800<=ZIP<=884 OR 889<=ZIP<=899
    then the conditions of that line will only apply to that one line, but not to all subsequent rules! You'll have to add the conditions to each rule.

Here's my script for zone 1:
Name=Shipping to Continental USA Zone 1; 800<=ZIP<=884 OR 889<=ZIP<=899
UseWeight<5; Shipping=2.35*ceil(UseWeight)
UseWeight<11; Shipping=2.41*ceil(UseWeight)
UseWeight<16; Shipping=1.05*ceil(UseWeight)

With the above in mind, it should be clear that the ZIP conditions (and the Name=..) are not used in the rules that define the shipping costs, so of course some rule from that zone will match. You'll have to add the ZIP condition to each rule.

However, if I understand you correctly, your zones all have the same basic shipping costs, just different multipliers. In that case, I would not use different country zones.
Variable=VolWeight; Value = TotalLength*TotalWidth*TotalHeight/166
Variable=UseWeight; Value = max(VolWeight, Weight)

Variable=ShipName; 800<=ZIP<=884 OR 889<=ZIP<=899; Value="Shipping to Continental USA Zone 1"
800<=ZIP<=884 OR 889<=ZIP<=899; ExtraShippingMultiplier=1
[...Multipliers and shipping name definitions for zones 2-4...]
Variable=ShipName; 010<=ZIP<=290 OR 320<=ZIP<=340; Value="Shipping to Continental USA Zone 5"
010<=ZIP<=290 OR 320<=ZIP<=340; ExtraShippingMultiplier=2.2

Name="{ShipName}"; UseWeight<5; Shipping=2.35*ceil(UseWeight)
Name="{ShipName}"; UseWeight<11; Shipping=2.41*ceil(UseWeight)
Name="{ShipName}"; UseWeight<16; Shipping=1.05*ceil(UseWeight)
Name="{ShipName}"; UseWeight<21; Shipping=.65*ceil(UseWeight)
Name="{ShipName}"; UseWeight<26; Shipping=1.375*ceil(UseWeight)
Name="{ShipName}, Shipping of 26 lbs and above"; UseWeight>26; Shipping=1.30*ceil(UseWeight)

These rules first define the multiplier (shipping to NY in your case is 2.2 times as much as to Idaho and Utah). The ShipName is required just to have different shipment names displayed in the cart and invoice.
Then the basic shipping rates are defined without any conditions on the ZIP code, because they are already handled through the ExtraShippingMultiplier.

Best regards,
Reinhold

Not finding zip code of alternate shipping address 02 Apr 2016 19:47 #3

PS: looking at your definition of VolWeight, I don't think you want TotalLengh*TotalWidth*TotalHeight, but rather Volume:
Variable=VolWeight; Value = Volume/166

E.g. assume the customer buys three items with 1x1x1m each (i.e. each item has a volume of 1 cubic meter). The TotalLenght, TotalWidth and TotalHeight will be 3 (because it is the sum of the dimensions of the individual items). So your TotalLength*TotalWidth*TotalHeight will be 9 m³, while the actual volume of the three items will be just 3 m³. The variable Volume will contain that very value.
Notice, however, that the plugin only has the products' dimensions available, but packaging the items into boxes will alway leave some extra space in the box, so the actual volume of the package will be larger than the items' total volume. However, that is nothing a computer can determine. You just have to be aware and maybe add some safety margin...

Not finding zip code of alternate shipping address 04 Apr 2016 23:39 #4

  • Mike Bench
  • Mike Bench's Avatar Topic Author
Thanks Reinhold.
I was under the impression that each statement went into separate country zone boxes. Thanks for clearing that up. Here is the almost finished script if anyone wants use it. I just have to go in and confirm all of my base shipping rates. Anyone using this will just have to shift around the zip codes in the various zones and confirm their own shipping rates and multipliers. Works really well.
Thanks again.
Mike
*************************************
Variable=VolWeight; Value = Volume/166
Variable=UseWeight; Value = max(VolWeight, Weight)

Variable=ShipName; 800<=ZIP3<=884 OR 889<=ZIP3<=899; Value="Shipping to Continental USA Zone 1"
800<=ZIP3<=884 OR 889<=ZIP3<=899; ExtraShippingMultiplier=1

Variable=ShipName; 900<=ZIP3<994 OR 590<=ZIP3<599; Value="Shipping to Continental USA Zone 2"
900<=ZIP3<994 OR 590<=ZIP3<599; ExtraShippingMultiplier=1.14

Variable=ShipName; 500<=ZIP3<589 OR 600<=ZIP3<699 OR 700<=ZIP3<799 OR ZIP3==885; Value="Shipping to Continental USA Zone 3"
500<=ZIP3<589 OR 600<=ZIP3<699 OR 700<=ZIP3<799 OR 885==ZIP3; ExtraShippingMultiplier=1.508

Variable=ShipName; 400<=ZIP3<499 OR 300<=ZIP3<319 OR 350<=ZIP3<399; Value="Shipping to Continental USA Zone 4"
400<=ZIP3<499 OR 300<=ZIP3<319 OR 350<=ZIP3<399; ExtraShippingMultiplier=1.819

Variable=ShipName; 010<=ZIP3<=290 OR 320<=ZIP3<=340; Value="Shipping to Continental USA Zone 5"
010<=ZIP3<=290 OR 320<=ZIP3<=340; ExtraShippingMultiplier=2.23

Variable=ShipName; 005==ZIP3 OR 569==ZIP3; Value="Shipping to Continental USA Zone 6"
005==ZIP3 OR 569==ZIP3; ExtraShippingMultiplier=2.254

Variable=ShipName; 96700<=ZIP<96900 OR 99500<=ZIP; Value="Shipping to Alaska or Hawaii"
96700<=ZIP<96900 OR 99500<=ZIP; ExtraShippingMultiplier=7.1

Name=FREE SHIPPING in Contental USA over $350; Amount>=350; NOT(AK, HI); Coupon==""; Shipping=0

Name="{ShipName}"; UseWeight<5; Shipping=1.54*ceil(UseWeight)
Name="{ShipName}"; UseWeight<11; Shipping=.85*ceil(UseWeight)
Name="{ShipName}"; UseWeight<16; Shipping=.80*ceil(UseWeight)
Name="{ShipName}"; UseWeight<21; Shipping=.65*ceil(UseWeight)
Name="{ShipName}"; UseWeight<26; Shipping=.60*ceil(UseWeight)
Name="{ShipName}"; UseWeight<45; Shipping=.55*ceil(UseWeight)

[SOLVED] Not finding zip code of alternate shipping address 04 Apr 2016 23:39 #5

  • Mike Bench
  • Mike Bench's Avatar Topic Author
Problem solved.
  • Page:
  • 1