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:

Checks with canadian address not working 09 Nov 2013 13:12 #1

  • MaritimeLobster
  • MaritimeLobster's Avatar Topic Author
I am trying to set up my advanced shipping and no shipping cost is being displayed so obviously I have some syntax incorrect. Wondering if you could have a look. This is only 1 set of codes that I need to set up but once I can get this working then the rest will be easy. (I have a total of 2500 postal code entries to make but everything is in a spreadsheet so just need to copy and paste). Maybe the FSA needs to be in one string rather than separate lines?


NAME=1-2 Days;
H0A<=Canada_FSA=>H9Z 0r
J0A<=Canada_FSA=>J0L 0r
J0N<=Canada_FSA=>J0V 0r
J1A<=Canada_FSA=>J8K 0r
K0A<=Canada_FSA=>K0H 0r
K0K<=Canada_FSA=>K0Z 0r
K1A<=Canada_FSA=>K7T 0r
K8J<=Canada_FSA=>K9Z 0r
L0A<=Canada_FSA=>L0Z 0r
L1A<=Canada_FSA=>L9Z 0r
M0A<=Canada_FSA=>M9Z 0r
N1A<=Canada_FSA=>N9Z;
WEIGHT<=20; SHIPPING=20;
WEIGHT>20; SHIPPING=30
NAME=3-4 Days;
SHIPPING = 30

Checks with canadian address not working 09 Nov 2013 13:42 #2

-) My plugins expects one rule per line, so all conditions of one rule need to be writtin in the same line.
-) Also, I think you have the second >= of each condition wrong. The >= operator checks whether the value on the left is LARGER or equal to the value on the right.
-) The OR operator is case-sensitive, so you need to use OR rather than Or...

I assume you want rules like
NAME=1-2 Days; H0A<=Canada_FSA=>H9Z 0R J0A<=Canada_FSA=>J0L 0R J0N<=Canada_FSA=>J0V 0R J1A<=Canada_FSA=>J8K 0R K0A<=Canada_FSA=>K0H 0R K0K<=Canada_FSA=>K0Z 0R K1A<=Canada_FSA=>K7T 0R K8J<=Canada_FSA=>K9Z 0R L0A<=Canada_FSA=>L0Z 0R L1A<=Canada_FSA=>L9Z 0R M0A<=Canada_FSA=>M9Z 0R N1A<=Canada_FSA=>N9Z; WEIGHT<=20; SHIPPING=20
WEIGHT>20; SHIPPING=30
NAME=3-4 Days; SHIPPING = 30 

However, I'm not sure I understand what you want to achieve with the "Weight>20" rule. Do you want to use the Canada_FSA conditions for this rule, too? In that case, unfortunately, you have to duplicate those FSA conditions in that rule, too.

For future versions, I have put it in my TODO list to save complex conditions into a variable, but that has not yet been implemented. So for now you'll have to duplicate all those FSA checks in both rules.

Best regards,
Reinhold

Checks with canadian address not working 10 Nov 2013 15:57 #3

  • MaritimeLobster
  • MaritimeLobster's Avatar Topic Author
Ok, got everything working correctly with the syntax now and am able to display shipping a shipping cost.

I need a simple formula for shipping cost using the above postal codes.

Shipping Cost = If weight is less than 20, shipping cost = $30, else shipping = (weight-20) X 1.25

Is there anyway to write this condition using any of the parameters that are available

Checks with canadian address not working 10 Nov 2013 17:11 #4

You already have the formula written (except that you need to use * instead of X for the multiplication...):

NAME=1-2 Days (light); H0A<=Canada_FSA<=H9Z 0R J0A<=Canada_FSA<=J0L 0R J0N<=Canada_FSA<=J0V 0R J1A<=Canada_FSA<=J8K 0R K0A<=Canada_FSA<=K0H 0R K0K<=Canada_FSA<=K0Z 0R K1A<=Canada_FSA<=K7T 0R K8J<=Canada_FSA<=K9Z 0R L0A<=Canada_FSA<=L0Z 0R L1A<=Canada_FSA<=L9Z 0R M0A<=Canada_FSA<=M9Z 0R N1A<=Canada_FSA<=N9Z; WEIGHT<=20; SHIPPING=20
NAME=1-2 Days (heavy); H0A<=Canada_FSA<=H9Z 0R J0A<=Canada_FSA<=J0L 0R J0N<=Canada_FSA<=J0V 0R J1A<=Canada_FSA<=J8K 0R K0A<=Canada_FSA<=K0H 0R K0K<=Canada_FSA<=K0Z 0R K1A<=Canada_FSA<=K7T 0R K8J<=Canada_FSA<=K9Z 0R L0A<=Canada_FSA<=L0Z 0R L1A<=Canada_FSA<=L9Z 0R M0A<=Canada_FSA<=M9Z 0R N1A<=Canada_FSA<=N9Z; WEIGHT>20; SHIPPING=(Weight-20)*1.25


However, I don't think that your formula is really correct, because e.g. for a weight of 21 kg that would mean a shipping rate of (21-20)*1.25=1.25$ ... I assume you rather want 30+(weight-20)*1.25 ?

Checks with canadian address not working 10 Nov 2013 19:48 #5

  • MaritimeLobster
  • MaritimeLobster's Avatar Topic Author
No, that doesn't work because what happens to the shipments that are under 20 in that range.

Checks with canadian address not working 10 Nov 2013 22:43 #6

  • MaritimeLobster
  • MaritimeLobster's Avatar Topic Author
I have over 3000 entries for my rule that I put together in a spreadsheet. I am trying to copy and paste to the rule box but it just keeps wrapping the text so that that each OR statement is on a different line. Any suggestions for this? I can't possibly type all of these entries into the box manually. As per your suggestion above I have to repeat the rule for each set of postal codes that I have (weight <20 and weight >20.

Checks with canadian address not working 10 Nov 2013 22:46 #7

  • MaritimeLobster
  • MaritimeLobster's Avatar Topic Author
I am copying it from notepad where is shows as one line only.

Checks with canadian address not working 10 Nov 2013 22:58 #8

  • MaritimeLobster
  • MaritimeLobster's Avatar Topic Author
Evaluation yields unknown value while evaluating rule part 'H0A'.
Evaluation yields unknown value while evaluating rule part 'H0A'.
Evaluation yields unknown value while evaluating rule part 'G0A'.
Evaluation yields unknown value while evaluating rule part 'G0A'.
Evaluation yields unknown value while evaluating rule part 'H0A'.
Evaluation yields unknown value while evaluating rule part 'H0A'.
Evaluation yields unknown value while evaluating rule part 'G0A'.
Evaluation yields unknown value while evaluating rule part 'G0A'.
Evaluation yields unknown value while evaluating rule part 'H0A'.
Evaluation yields unknown value while evaluating rule part 'H0A'.
Evaluation yields unknown value while evaluating rule part 'G0A'.
Evaluation yields unknown value while evaluating rule part 'G0A'.

Checks with canadian address not working 11 Nov 2013 03:23 #9

  • MaritimeLobster
  • MaritimeLobster's Avatar Topic Author
Here is a screenshot of the rule text box
Attachments:

Checks with canadian address not working 12 Nov 2013 03:02 #10

Oops, sorry, I forgot to quote the strings, as in:
"H0A"<=Canada_FSA<="H9Z" 0R "J0A"<=Canada_FSA<="J0L"

To the plugin, H0A is a variable name (which it tries to evaluate, but cannot find), while "H0A" is a string value.

Best regards,
Reinhold

Checks with canadian address not working 12 Nov 2013 06:29 #11

  • MaritimeLobster
  • MaritimeLobster's Avatar Topic Author
OK Thanks

On to my next rule now that uses the entire postal code. Just want to confirm that my syntax is correct before I populate all 2700 of them.

"B0J1A0"<=CANADA_FSA AND CANADA_LDU<="B0J1A0" OR
"B0J1C0"<=CANADA_FSA AND CANADA_LDU<="B0J1E0" OR
"B0J1H0"<=CANADA_FSA AND CANADA_LDU<="B0J1K0" OR

Also can you explain to me when I need to use a new rule box. Or should this all be going in 1 box. I understand that it reads rules by lines but does it look at boxes in order as well.

Thanks

lisa

Checks with canadian address not working 16 Nov 2013 22:37 #12

If you combine OR and AND operators, I would strongly advise you to use parentheses to group the expressions.

Also, the Canada_FSA variable will have a value of just "B0J", while the Canada_LDU will have a value of "1A0", so your comparisons given here won't work. What do you try to achieve exactly?

The different rule boxes are mainly meant for different countries, but you can also use the same country in all the boxes. In the later case, there is really no difference between putting all rules in one box (one rule per line), or putting each rule in its own box (again, each rule cannot be split across multiple lines!).

When evaluating the rules, the plugin looks at the country of the first box. If it matches, it will look at the rules of the first box. If any of the rules matches, it returns the shipping costs.
If none of the rules of the first box matches, or if the country of the first box does not match, the plugin will look at the second box.
  • Page:
  • 1