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!



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


Defective state2 syntax 28 Dec 2013 02:19 #1

  • rna
  • rna's Avatar Topic Author
I just installed the free version of your plugin and I find that the "state2 ==" syntax does not work.

All the following test code except for the last line is ignored even though the state used is Quebec or Alberta.
Name=Quebec; state2 == "QC"; Amount<25; 5.00
Name=Quebec; state2 == "QC";; Amount<100; 25.00
Name=Alberta; state2 == "AB"; Amount<25; 6.00
Name=Alberta; state2 == "AB"; Amount<100; 50.00
Name=Left Over; Shipping=49.00

Am I doing something wrong?

Defective state2 syntax 31 Dec 2013 22:44 #2

Hmm, that's strange. I have tested it in my test setup and it seems to work just fine.

To debug the problem, can you use "Left Over, state2={state2}" as the name of the last rule:
Name=Left Over, state2={state2}; Shipping=49.00

That will insert the value of the state2 variable into the name, so you can see what the actual value is for your shopper's address.

Also, if you can reproduce the problem at demo.kainhofer.com, it would make debugging much easier.

Best regards and a happy new year,

Defective state2 syntax 01 Jan 2014 01:28 #3

  • rna
  • rna's Avatar Topic Author
The shipping line shows:
Canada - Shipping cost (Left Over, state2)

I am using:
Joomla 2.5.17
Virtuemart: 2.0.26a

I was unable to login to your demo page with:
user: admin
psw: admin

Defective state2 syntax 10 Jan 2014 19:29 #4

  • rna
  • rna's Avatar Topic Author
Any new developments on this problem?

Defective state2 syntax 11 Jan 2014 20:35 #5

First, sorry for the login problem at the demo server. Someone thought it was fun to change the password (and insert a spam link!)... admin/admin as user/password should be restored now.

Your output suggests that the state2 variable is not set at all. If the user entered a state in the shipping address, then that field should be populated with the 2-letter code for the state. I have no idea why it is not in your case. I can offer to take a look at your site, if you want.

Defective state2 syntax 11 Jan 2014 23:14 #6

BTW, with the latest version 4.0 (just released), I added some features to debug such problems. You can try the approach described in: open-tools.net/component/content/article...rules.html#debugging

The second one will print out ALL available variables, including the state2. This might give us a better idea where things go wrong.

Defective state2 syntax 12 Jan 2014 20:37 #7

  • rna
  • rna's Avatar Topic Author
I installed v 4.0 and tried the debugging option with
Name=All variables: <pre>{Values_Debug}</pre>; NoShipping

and I got the result:
All variables:

with no values or variable name.

How do I proceed to transmit to you confidential passwords and user names for my test site?

Defective state2 syntax 14 Jan 2014 19:20 #8

Thanks for the access, which gave me quite some insights. What you are experiencing were actually several small bugs in the basic (free) shipping by rules plugin:

1) In the basic shipping by rules plugin, I only split all expressions at the comparison operators. To handle the case-insensitive variable names, I have to cast them to lowercase. Apparently I missed that I must not lowercase strings that are used in comparisons. So basically, your state2=="AB" was internally turned into a comparison of state2 with "ab", while state2 still had the value "AB"... Of course, that rule never matched...

2) The fact that the {state2} was not displayed in the rule name is due to the "=" before it, which is used by the basic plugin to split rule parts... This is apparently also a small bug in the basic plugin, because it should only split on the first = in each rule part. The advanced plugin does not suffer from this, btw.

3) The fact that the {Values_Debug} was not printed out in the NoShipping debug warning was due to the <pre> wrapped around it (so that the output would be easier readable). This is again the same problem as with the =, because the < is a comparison operator and so the plugin tried to split the name at the <.

Sorry for these small bugs in the free plugin. I actually run several tests for each release, but mostly just with the advanced plugin (which shares ~99% of the code with the basic plugin; the only difference being how the rules are converted from a text into an expression, which is ~30 lines in the basic plugin that are not also used by the advanced plugin). Your bugs are some of the very few cases where a bugs affects only the basic plugin, but not the advanced, so I missed those so far.

I have now fixes these bugs and released version 4.0.1 of the (basic) Shipping by Rules plugin, where (1) comparisons with strings work again, (2) HTML and = in the rule name works and (3) the (optional) quotes around the rule name are no longer displayed to the user.

Best regards,

Defective state2 syntax 14 Jan 2014 21:02 #9

  • rna
  • rna's Avatar Topic Author
Thank you very much for the fixes.
I was testing the latest VirtueMart and Joomla 2.5 combination for a possible future upgrade.

Please consider the setup of the test site as a small thank you for providing such a powerful product for free.
  • Page:
  • 1