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:

Rules ordering issue is messing up calculations 19 Feb 2014 23:30 #1

  • dennyf
  • dennyf's Avatar Topic Author
So I swear as of last weekend (nothing has changed to my knowledge) these rules used to work:
Name=No Free Shipping on Racks;"8-CEILING4X4-10" in SKUs OR "8-CEILING8X4-10" in SKUs OR "8-CEILING4X4" in SKUs OR "8-CEILING8X4" in SKUs; NoShipping
Name=Free Cabinet Shipping Over $500;500<= Amount AND Country == 'United States'; 0

Now randomly sometime this weekend it seems that top rule has begun to always evaluate to true and hide any free shipping option (which the second should display.)

I've tried to compensate with something like this...
Name=Free Cabinet Shipping Over $1000;1000<= Amount AND Country == 'United States' AND not("8-C"~SKUs); 0
Name=Free Shipping Over $500;500<=Amount<=999 AND Country == 'United States' AND not("8-C"~SKUs); 0
Name=No Free Shipping on Racks;"8-CEILING4X4-10" in SKUs OR "8-CEILING8X4-10" in SKUs OR "8-CEILING4X4" in SKUs OR "8-CEILING8X4" in SKUs; NoShipping

But this series of rules seems to throw an error that reads:
Unknown function 'not' encountered during evaluation of rule 'Name=Free Cabinet Shipping Over $1000;1000<= Amount AND Country == 'United States' AND not("8-C"~SKUs); 0'.

I'm stumped at this point. I know that top rule in the first example has begun to evaluate as true by replacing the "NoShipping" flag with a random number and then I can see that value appear on calculation. As a side note, yes we do have the advanced version. Please advise as this is negatively effecting my webstore.

Rules ordering issue is messing up calculations 22 Feb 2014 00:16 #2

Unfortunately, we had a terrible server crash, so my responses from this morning were lost. In short:

1) "8-C"~SKUs is invalid syntax, because SKUs is a list and the ~ operator only supports single strings.

2) To debug why the first rule seems to match arbitrary orders, I would suggest the debuggin techniques described in the documentation (which prints out all available variables, so you can check how the SKUs variable looks exactly).

3) if you want to distinguish different countries (i.e. free shipping only to US), I would recommend using multiple country zones: Zone 1 only for the US, where you write the rules for free shipping and Zone 2 without any restrictions (US orders that do not match any rule in the first zone will also be checked here). That saves you the Country check.

4) Instead of the multiple in checks combined with OR, you can use the function contains_any(SKUs, "8-CEILING4X4-10", "8-CEILING8X4-10", "8-CEILING4X4", "8-CEILING8X4"), which was added in plugin version 4.0

5) Apart from that, I really have no clue why the first rule would match...

Rules ordering issue is messing up calculations 26 Feb 2014 01:59 #3

  • dennyf
  • dennyf's Avatar Topic Author
Hello reinhold thank you for your response(s), I actually received the email which contained them but none the less.

1, I see the mistake. Silly me.

2, I finally dug it down to the country check... see #3

3, I set up a zone and applied it to the U.S. and same issue occurred, it was now bypassing the entry all together for some reason.. any advice on how to trouble shoot that?

4, Good idea. I'll probably update it.

I really appreciate the assistance reinhold, I'll make a few changes and hope to hear if you have any insight into which #3 fails the country check when it should not for any reason.

Rules ordering issue is messing up calculations 27 Feb 2014 08:24 #4

  • dennyf
  • dennyf's Avatar Topic Author
I'm still having major trouble getting things working as intended... it's almost like advanced features just don't exist? I'm trying to use:

. . . AND not("4" in Vendors)

And the error reads: "Evaluation yields unknown value while evaluating rule part 'Vendors'."

Rules ordering issue is messing up calculations 27 Feb 2014 11:49 #5

The Vendors variable was added in versino 3.3 of the plugin. Are you sure you have that (or a later) version of the plugin installed? Since the AND and the not are properly evaluated, the advanced features are properly available, just the Vendors variable isn't.

To check which variables are available (in particular, to check if the Vendors variable is available and to see its value), you can create a debugging shipment method as described in
open-tools.net/documentation/shipping-by...emart.html#debugging

That will print out all available variables and their values. Maybe that can give use some further hints...

Best regards,
Reinhold

Rules ordering issue is messing up calculations 27 Feb 2014 17:43 #6

  • dennyf
  • dennyf's Avatar Topic Author
Interesting, I'll try your suggestion to what is available. I was trying last night to find a version number but it is not printed anywhere I noticed? I'll report back when I have any news today.

Rules ordering issue is messing up calculations 27 Feb 2014 21:16 #7

You can find out the installed version of a Joomla extension in Joomla's backend: menu "Extensions" -> "Extension manager" -> "Manage" tab

Best regards,
Reinhold

Rules ordering issue is messing up calculations 27 Feb 2014 22:15 #8

  • dennyf
  • dennyf's Avatar Topic Author
Okay I can confirm now (can't believe I missed this earlier) version 3.3 date 2-8-2013, seems a bit out of date? Is there an update(r) I can install(use?) to come up to 4.1?

On another note: the "contains_any( . . . , . . . )" function you suggested doesn't work. If that is obvious due to the version I'm on then we can cross this bridge later. :)

Rules ordering issue is messing up calculations 27 Feb 2014 23:28 #9

You can download the new version from the webshop and simply install it over the old version (don't remove the old version before, because that might erase your settings!).

The contains_any function was added in version 4.0, so it's not supposed to work in your installation ;-)

Rules ordering issue is messing up calculations 27 Feb 2014 23:37 #10

  • dennyfite
  • dennyfite's Avatar
Huzzah! So I'm up to 4.1 now, my former associate's email contained the registration info for the site. d'oh

So these are my rules:
Name=No Free Shipping on Racks;"8-CEILING4X4-10" in SKUs OR "8-CEILING8X4-10" in SKUs OR "8-CEILING4X4" in SKUs OR "8-CEILING8X4" in SKUs; NoShipping
Name=Free Cabinet Shipping Over $1000;Amount>=1000; 0
Name=Free Shipping Over $500;Amount>=500; 0

and these are the 4 errors, moments before the update to 4.1 these were basically functional (albeit not quite doing what I'd like...)
      Evaluation yields unknown value while evaluating rule part '>='.
      Evaluation yields unknown value while evaluating rule part '>='.
      Evaluation yields unknown value while evaluating rule part '>='.
      Evaluation yields unknown value while evaluating rule part '>='.

What say you, Guru of the Shipping!

Rules ordering issue is messing up calculations 28 Feb 2014 00:39 #11

Do you also have the basic (free) shipping by rules plugin installed? If so, please update that one too (the two plugins share some common code, so it might be that some old code is called from the free plugin instead of the updated advanced plugin).

I hvae tried your rules and they work just fine in my installation...

Rules ordering issue is messing up calculations 28 Feb 2014 01:00 #12

  • dennyf
  • dennyf's Avatar Topic Author
My goodness I think we're very close now. Updated both advanced and basic versions up added 2x items for a grand total of ~$520 SKU 8P-36. My rules are:
Name=No Free Shipping on Racks;contains_any(SKUs, "8-CEILING4X4-10", "8-CEILING8X4-10", "8-CEILING4X4", "8-CEILING8X4"); NoShipping
Name=Free Cabinet Shipping Over $1000;Amount>=1000; 0
Name=Free Shipping Over $500;Amount>=500; 0

And the error reads
No Free Shipping on Racks

Which as you can imagine shouldn't fail there...

Rules ordering issue is messing up calculations 01 Mar 2014 15:48 #13

If you create a debugging method as described in the documentation (open-tools.net/documentation/shipping-by...emart.html#debugging ), what is the actual value of the SKUs variable?

Once we know the value of SKUs, we can start figuring out why the rule matches erroneously.

Best regards,
Reinhold

Rules ordering issue is messing up calculations 03 Mar 2014 18:39 #14

  • dennyf
  • dennyf's Avatar Topic Author
Here you go, sir.
Array
(
    [zip] => 90670
    [zip1] => 9
    [zip2] => 90
    [zip3] => 906
    [zip4] => 9067
    [zip5] => 90670
    [zip6] => 90670
    [city] => Santa Fe Springs
    [articles] => 2
    [products] => 1
    [amount] => 543.18
    [amountwithtax] => 543.18
    [amountwithouttax] => 543.18
    [baseprice] => 646.66
    [basepricewithtax] => 646.66
    [discountedpricewithouttax] => 543.18
    [salesprice] => 543.18
    [taxamount] => 0
    [salespricewithdiscount] => 0
    [discountamount] => 103.48
    [pricewithouttax] => 543.18
    [skus] => Array
        (
            [0] => 8P-48
        )

    [categories] => Array
        (
            [0] => 61
        )

    [vendors] => Array
        (
            [0] => 1
        )

    [manufacturers] => Array
        (
            [0] => 1
        )

    [countryid] => 223
    [country] => United States
    [country2] => US
    [country3] => USA
    [stateid] => 5
    [state] => California
    [state2] => CA
    [state3] => CAL
    [weight] => 600
    [maxweight] => 300.0000
    [minweight] => 300.0000
    [volume] => 0
    [maxvolume] => 0
    [minvolume] => 0
    [maxlength] => 0
    [minlength] => 0
    [totallength] => 0
    [maxwidth] => 0
    [minwidth] => 0
    [totalwidth] => 0
    [maxheight] => 0
    [minheight] => 0
    [totalheight] => 0
    [maxpackaging] => 0
    [minpackaging] => 
    [totalpackaging] => 0
    [coupon] => 
    [uk_outward] => 
    [uk_area] => 
    [uk_district] => 
    [uk_subdistrict] => 
    [uk_inward] => 
    [canada_fsa] => 
    [canada_area] => 
    [canada_urban] => 
    [canada_subarea] => 
    [canada_ldu] => 
)

Rules ordering issue is messing up calculations 05 Mar 2014 12:57 #15

Ah, now I see the problem: The plugin does not correctly identify the contains_any term as a condition (because it does not contain any comparison operators). All terms that are not detected as a condition are understood as shipping costs, which is then overwritten by the "NoShipping" term, so effectively it has no effect. You can help the plugin by explicitly prepending "Condition=". This indicates to the plugin that the next term is a condition rather than a shipping rate:
Name=No Free Shipping on Racks; Condition=contains_any(SKUs, "8-CEILING4X4-10", "8-CEILING8X4-10", "8-CEILING4X4", "8-CEILING8X4"); NoShipping

Rules ordering issue is messing up calculations 06 Mar 2014 22:25 #16

  • dennyf
  • dennyf's Avatar Topic Author
Interesting. I put in the condition line, could this be similar behavior occurring in the test on which country someone is in?

To be honest I haven't had a chance to experiment if the two updates fixed that issue for me.

Again I really appreciate the assistance reinhold, you have a great program here!

Rules ordering issue is messing up calculations 18 Mar 2014 17:38 #17

  • dennyf
  • dennyf's Avatar Topic Author
I'm gonna go ahead and mark this as resolved. It looks like doing the update on both the free/premium plugin fixed it for me. I'm still having a few minor weird behavior things but I think it's because I'm trying to be very minimalistic and it appears to be "assuming" so I guess I can just explicitly state those in the rules I create.

Also adding the Condition= after the name was probably a good idea, I'm doing it on every rule now and not seeing weird behavior where it ignores things.

Thanks a ton reinhold, both in your support and for putting together such a useful tool for folks to use!

[SOLVED] Rules ordering issue is messing up calculations 18 Mar 2014 17:38 #18

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