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:

Syntax for state2 and amount 11 Nov 2013 14:31 #1

  • madmax
  • madmax's Avatar Topic Author
First of all very nice and helpful plugin, but I seem to have some problems getting it to work with my set-up. Most probably I have a syntax error or something, but somehow I seem not be able to find it...

I want to achieve that all orders below $500 get automatically a $68 delivery fee, except for 3 dedicated states, which shall have $106 delivery fee and 2 states, which shall have no possibility to get delivery.

All orders over $500 are free for the first set of States again, except for the same 3 states like before, they shall get $38 delivery fee and still the 2 states shall have no delivery at all no matter what the amount of purchase..

This is the rules I have placed in, however for some reason, for all states only the very first rule is applied and none of the other...
Name=Delivery Fee; 1<=Amount<500; state2 in list("CW", "EA", "KC", "KT", "KW", "SK", "ST", "SP", "SO", "TP", "TW", "WC", "WT", "YT"); Shipping=68.00
Name=Extended Delivery Fee; 1<=Amount<500; state2 in list("TM", "YL", "LT"); Shipping=106.00
Name=NO Delivery to Outlaying Islands, please pick up at one of our shops; 1<=Amount; state2 in list("IL", "NO"); NoShipping
Name=Free Delivery; 500<= Amount; state2 in list("CW", "EA", "KC", "KT", "KW", "SK", "ST", "SP", "SO", "TP", "TW", "WC", "WT", "YT"); 0
Name=Extra Delivery Fee; 500<= Amount; state2 in list("TM", "YL", "LT"); Shipping=38.00

Any help would be very appreciated

Thanks


Maxi

Syntax for state2 and amount 12 Nov 2013 01:50 #2

Are you sure the state2 variable has the correct value? As a first step, I would insert {state2} into the rule names, which means that the value of the state2 variable is printed in the rule name. That way we can ensure that the state2 variable has the correct value:
Name=Delivery Fee (state2={state2}); 1<=Amount<500; state2 in list("CW", "EA", "KC", "KT", "KW", "SK", "ST", "SP", "SO", "TP", "TW", "WC", "WT", "YT"); Shipping=68.00

And then I would rearrange you logic a little bit:
1) First check for states "IL" and "NO" and exclude them (so in all following rules you can assume the state is NOT "IL" or "NO")
2) for the three states "TM", "YL" and "LT" you give those two rules with 106 and 38$ shipping (so in all rules after that, you can assume that the state is also none of those three)
3) As all other states are handled identical, you don't need any further check of the long state list. The special states are already filtered out by the first three rules, and the standard states are left.
Name=NO Delivery to Outlaying Islands, please pick up at one of our shops; state2 in list("IL", "NO"); NoShipping
Name=Extended Delivery Fee; 1<=Amount<500; state2 in list("TM", "YL", "LT"); Shipping=106.00
Name=Extra Delivery Fee; 500<= Amount; state2 in list("TM", "YL", "LT"); Shipping=38.00
Name=Delivery Fee; 1<=Amount<500; Shipping=68.00
Name=Free Delivery; 500<= Amount; 0

Also, please note that in VirtueMart a shipping plugin that does NOT offer a shipping rate cannot print out any message, so the nice "please pick up..." message will unfortunately NOT be printed. I don't see any way to work around this limitation with my plugin.

Best regards,
Reinhold

Syntax for state2 and amount 12 Nov 2013 03:19 #3

  • madmax
  • madmax's Avatar Topic Author
Hello Reinhold:

First of all thanks for the reply and the suggestions...

I changed the rules to include just your initial state2 rule, and it pick up the $68 fee automatically, however prints it out a bit strange:
(Delivery Fee (state2)

Somehow it does not write out the state2 contents, even I checked and double checked the codes are all correct and are a 100% match with the actual codes in the State2 under Countries and the database.

Than I just added the
Name=NO Delivery to Outlaying Islands, please pick up at one of our shops; state2 in list("IL", "NO");
To see if the plugin successfully picks up the different State and changes the delivery fee to NO Delivery...

Which it unfortunately does not do...

If I have an address with the IL or NO state2 code it still puts the $68 as Delivery fee...

However strangely enough, when I remove the product from the cart I get this error message from VM:
Evaluation yields unknown value while evaluating rule part 'state2 in list("il", "no")'.

I am very very confused, somehow it picks it up but does not pick it up?

I am happy to give you access to the site to figure that one out, as now after 3 days of trying I am at the end of my wits and can not make it work...

Thanks a lot for any help possible,


Maxie

Syntax for state2 and amount 16 Nov 2013 07:40 #4

  • madmax
  • madmax's Avatar Topic Author
I tried all different possibilities over the last few days and somehow I can not make it work. I really would need some help. So ANY help is very very much appreciated.

Maxie

Syntax for state2 and amount 20 Nov 2013 20:58 #5

Dear Maxie,
The the list feature and the "in" operator are only available in the advanced (non-free) version of the plugin...
See also: open-tools.net/documentation/shipping-by...-for-virtuemart.html (The section "Available Operators).

The free plugin does not contain the code to evaluate any expressions apart from simple alpha- and numerical comparisons (<, <=, >=, >, ==). E.g. in the free version of the plugin you can write rules like (notice that the name will not be printed yet! I'll try to implement printing the message as a warning in the next version):
Name=NO Delivery to Outlaying Islands, please pick up at one of our shops; state2 == "IL"; NoShipping
Name=NO Delivery to Outlaying Islands, please pick up at one of our shops; state2 == "NO"; NoShipping

The error message "unknown value while evaluating rule part 'state2 in list("il", "no")'"also indicates that the plugin cannot evaluate the "state in list(...)" expression...

Best regards,
Reinhold

Syntax for state2 and amount 21 Nov 2013 00:48 #6

  • madmax
  • madmax's Avatar Topic Author
So, if I buy the advanced Plugin it will work?

Happy to buy the advanced Plugin just want to make sure it works, before I buy it...

Thanks

Maxie

Syntax for state2 and amount 21 Nov 2013 00:51 #7

Yes, it is supposed to work.
Currently the message for NoShipping is NOT yet printed out, but I'm working on that. The next version 4.0 will finally be able to print the warning message of the NoShipping rules out.

The list and the in operator (i.e. everything you need for your rules) should work just fine with the advanced version. To update your existing shipping method to the advanced version, simply install the advanced plugin and then change the shipping method type on the first tab of the shipping method setup to the advanced plugin. Your existing rules should be preserved.

Best regards,
Reinhold

[SOLVED] Syntax for state2 and amount 22 Nov 2013 07:50 #8

  • madmax
  • madmax's Avatar Topic Author
Problem solved.

Buying and installing the Advanced Plugin sorted out the issues, as you said, except for the print-out for No Delivery everything else works and calculates now correctly.

Thanks


Maxie...

[SOLVED] Syntax for state2 and amount 13 Jan 2014 16:08 #9

Version 4.0 of the plugin has been released, which now also prints the name of NoShipping rules ("NO Delivery to Outlaying Islands, please pick up at one of our shops" in your case) as warning.
  • Page:
  • 1