VirtueMart Forum

VirtueMart 2 + 3 + 4 => 3rd party extension => Topic started by: reinhold on January 17, 2013, 12:25:14 PM

Title: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on January 17, 2013, 12:25:14 PM
Dear all,

This was the old support forum for my VirtueMart 2 Shipping by Rules plugin:
http://open-tools.net/virtuemart-2-extensions/vm2-shipping-by-rules-plugin.html

For all new inquiries, please use our dedicated support forum at:
http://open-tools.net/forum/shipping-by-rules-plugin.html


This is a Virtuemart 2 plugin that allows the shop owner to determine shipping costs according to arbitrary sets of general rules. Very complex shipping cost structures (depending on the amount, weight, number of products and/or articles and postal code of the order) can be easily implemented as one shipping method by describing each by a simple rule with conditions.

The rules are described as a simple line of text with an easy structure (semicolons separate the parts of the rule). For example:

Name=Domestic Small; Articles<5; Amount<100; Shipping=1.50
Name=Domestic Standard; Amount<100; Shipping=3.50
Name=Free Shipping; 100<=Amount; 0

This set of rules describes three shipping costs: Orders of 100€ and more are free, otherwise orders with less than five articles have shipping costs of 1.5€, all others 3.50€.

The standard version (FREE!) should suffice for most webshops, as it already allows an arbitrary number of rules in each of the eight country zones, where the rules can again contain any number of conditions. The shipping cost is given in fixed amounts of the shop currency for each rule.

The advanced version (paid) extends the standard version with arithmetic expressions, so that both your conditions as well as the shipping costs can be expressed as general mathematical expressions involving the operators +, -, *, /, %, ^ and parentheses.


If you have questions about the plugin (that are not yet answered in the FAQ on the plugin's homepage) or encounter problems, you can either send my an email (office@open-tools.net) or post your questions at our support forum: http://open-tools.net/forum/shipping-by-rules-plugin.html

Best regards,
Reinhold


Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: lindapowers on January 18, 2013, 08:50:53 AM
Saved the day for us.

Plugin well though and structured, all shipping rates per zones in one simple page and per line with a lot of options

The free version already does the job but we bought the advanced version just to support it, really worth the money.

Please keep updating it when needed as this is gonna be our main plugin to calculate all our shipping rates ;)

As a suggestion as mentioned before, selectable states will be great to see in the future.

Regards

Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: lindapowers on February 13, 2013, 23:42:29 PM
Hi Reinhold, we are facing a little problem with your shipping plugin and Rupostel's one page checkout.

We are using the shipping by rules advanced plugin.

You can see the issue here:

http://www.rupostel.com/phpBB3/viewtopic.php?f=5&t=420&sid=378fd7ee593e6071e9bcce26341b0ec1

And the replie by Stan is saying that those warnings appear due to having debugg messages turned on however we dont have them enabled.

Your plugin works perfectly with the default VM checkout but shows those warnings after loggin in from the one page checkout login module.

Regards
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on February 13, 2013, 23:49:01 PM
Ah, yes, there was an issue with the postal codes if no address had been entered yet. In that case the plugin wrote out that warning that ZIP did not evaluate to anything... I have meanwhile changed this so that the condition always fails if a variable is not set at all. So, if no ZIP has been entered, any check for a postal code will return false and the rule will not match...

I'll send you my latest version (which I will officially release in the next few days), which should work fine in that case (unless I messed up something again while coding).
Reinhold
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: lindapowers on February 14, 2013, 00:22:23 AM
Thanks

We installed it and the shipping rates were deleted, not a big issue as we have them saved and can put them back on.

However if the plugin is enabled clicking the link to go to the cart gives you a blank screen.

I send you the details and link by e-mail.

Regards

In case it helps you debugging shows this:

Fatal error: Call to undefined function array_replace() in /var/www/vhosts/webroot/plugins/vmshipment/rules_shipping_advanced/rules_shipping_base.php on line 394
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: zainabubu on June 19, 2013, 23:51:12 PM
Hello, does this support shipping by State zones only?
In my case shipping cost is based on 4 zones and the weight of packages. So 15 states can be under zone 3 regardless of the Cities or district, e.g.

Zone 3 (NYC, NJ, GA, CA...)
<= 0.5kg is $5
0.5< 1kg is $10
and so on.

Is this possible with your plugin, if so, how so?
I tried reading the instructions, but it only got me quite muddled up. Many thanks.

Please if it doesn't work this way, I would really appreciate it if you can point me in the right direction.
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on June 20, 2013, 00:04:03 AM
The plugin is currently not able to distinguish US states, only countries. The only way to distinguish different parts of the US is by ZIP ranges. I'm not sure how well this works for identifying US states, though.

E.g. for NYC:
   Name=Shipping to NYC; 100<=ZIP3<150; weight<=0.5; Shipping=5
   Name=Shipping to NYC, heavy; 100<=ZIP3<150; 0.5<weight<1; Shipping=10

Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: zainabubu on June 21, 2013, 01:13:02 AM
oh ok. It's not for US states, just used that as an example. Do you know of a work around to get this done? Or something else that does it?
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: 3cellhosting on July 03, 2013, 11:05:04 AM
Hi Reinhold,

I often have to work with Irish clients and this can be a nightmare as they only have postcodes for parts of Dublin. I need to calculate shipping by county(state) and was hoping this might be possible with your plugin.

If not, then it might be an idea to consider as there are many UK users whould would happily pay for a plugin that can cope with that level of flexibility.

Regards

David
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on July 03, 2013, 15:03:03 PM
Quote from: 3cellhosting on July 03, 2013, 11:05:04 AM
I often have to work with Irish clients and this can be a nightmare as they only have postcodes for parts of Dublin.

Ah, that's interesting. I wasn't aware that Dublin does not have any postal codes (I just read up a little on Wikipedia). How do users normally enter the district (it's a number 1-23, right?)? Is the district usually entered in the ZIP field, or is the city entered as "Dublin 1" (i.e. it's part of the city string)?

Quote
I need to calculate shipping by county(state) and was hoping this might be possible with your plugin.

Do I understand it correctly that you want to use the "State" address field (which is not even a required field)? Thatt's an idea, but it isn't implemented (yet?) in the plugin.

On the other hand, AFAICS, Virtuemart does not by default provide states/counties for Ireland (and the postal code field is required by default, even though NI does not have ZIP codes...)... So out of the box, no states are available anyway.

But I really need to understand how the Dublin districts are used and entered by the users. Once it's clear how such a feature would be used, the implementation is normally quite straightforward.



Regards,
Reinhold
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: johnson33445 on July 09, 2013, 12:06:19 PM
Ok i agreed with you I often have to work with Irish clients and this can be a nightmare as they only have postcodes for parts of Dublin. I need to calculate shipping by county(state) and was hoping this might be possible with your plugin. that's a write way you have ti do it
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: lindapowers on July 14, 2013, 15:08:25 PM
You can always introduce states manually, so the states selection I agree would be an amazing addon. Actually is the only thing I miss from this plugin.

Regards
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: buzi on August 22, 2013, 11:37:01 AM
BTW, i you have a Bug in the plugin,

in the file plugin/vmshipment/rules_shipping/rules_shipping_base.php on line 879, where is starts with

function matches($vals) {
// First, check the country, if any conditions are given:

if (count ($this->countries) > 0 && !in_array ($vals['countryid'], $this->countries) ){


it should be "$vals['countryid']" not $vals['country'], otherwise the rules will never work.

if (count ($this->countries) > 0 && !in_array ($vals['countryid'], $this->countries) ){


and thanks for this great plugin
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on August 26, 2013, 16:22:51 PM
Quote from: buzi on August 22, 2013, 11:37:01 AM
BTW, i you have a Bug in the plugin,

in the file plugin/vmshipment/rules_shipping/rules_shipping_base.php on line 879[...] it should be "$vals['countryid']" not $vals['country'], otherwise the rules will never work.

Thank you for the report. You are absolutely right, I missed this when I implemented all the various state/country variables...

I have fixed the bug and uploaded version 3.2 to the homepage.

Best regards,
Reinhold
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: ricardo.nunes on September 20, 2013, 11:05:34 AM
I'm using Joomla 2.5.14 with VM2 in a Ubuntu server with PHP 5.4 and a few weeks ago I've installed this plugin.

I've already put the rules for TNT Express but they only appear when the cart is empty. I have rules limite by weight but I can see through debug messages that the weight it's inside the expected ranges and that the rules that I'm expected to pass are validated, but when I put one product these shipment options disappear.

Does any of you had a problem like that?
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on September 21, 2013, 00:10:15 AM
Quote from: ricardo.nunes on September 20, 2013, 11:05:34 AM
I've already put the rules for TNT Express but they only appear when the cart is empty. I have rules limite by weight but I can see through debug messages that the weight it's inside the expected ranges and that the rules that I'm expected to pass are validated, but when I put one product these shipment options disappear.

Can you please try the latest version 3.3 of the plugin, which fixed a few issues.

Thanks,
Reinhold
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: greymoose on October 08, 2013, 06:10:12 AM
Hi there,

I've been testing the free Shipping by Rules Plugin on a development site for the last few weeks and it has been great. My customer has decided their freight rates and I needed to upgrade to the Advanced plugin. I thought I understood the syntax for a multi-part rule correctly but apparently not. I've tried the documentation link in the plugin but it's dead. I'd appreciate some pointers if possible.

My rule is:
Name= More than 3 items Rural Delivery; ZIP3 = 9 & Articles>3; ShippingWithTax = 14

So more than three items and the third digit of the zip is 9 to make it true.
I seem to have the syntax around concatenation wrong. I've tried +, ++, &, &&

Thanks in advance for your help.

Virtuemart 2.022b; Joomla 2.5.
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on October 08, 2013, 10:38:52 AM
Quote from: greymoose on October 08, 2013, 06:10:12 AM
My rule is:

Name= More than 3 items Rural Delivery; ZIP3 = 9 & Articles>3; ShippingWithTax = 14


So more than three items and the third digit of the zip is 9 to make it true.
I seem to have the syntax around concatenation wrong. I've tried +, ++, &, &&


Two things:
1) The comparison operator is "==" (i.e. two equal signs)
2) ZIP3 returns the first three digits of the postal code, not the third digit...

Best regards,
Reinhold
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: greymoose on October 08, 2013, 21:34:42 PM
Thanks Reinhold. That makes a lot more sense. Is there a way to pick out one number from a four digit zip? Can the plugin handle an expression to strip the zip to one digit within the rule?

NZ postcodes use the third digit to define rural, PO Box, urban destinations and so on.

Cheers.
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: futurefool on November 13, 2013, 15:19:36 PM
Hi Reinhold.

First of all, great plugin! It has greatly simplified my postage rules. I have encountered just one problem. I am developing a site with product variants where the child products have quite different weights. As such my parent products aren't setup with any product dimensions or weights.
I am using the plugin to determine the correct postage based on the product weight.  It seems that the Shipping by Rules plugin is looking for the product parents' dimensions and weights and not the product variants' dimensions and weights. As such, the plugin is not correctly matching the shipping rules.

I guess my question is, does the Shipping by Rules plugin not currently support use with product variants or is it that I need to make changes to my product variants configuration?

P.S. Apologies for posting this query here. I have tried to register on the open-tools site but have been unsuccessful.
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: futurefool on November 13, 2013, 15:54:54 PM
Ok. I believe it's solved now.

Absolutely no problem with the Shipping by Rules plugin. The issue was with the stockable variants plugin not using the child products dimensions and weight to override that of the parents in the cart. Using the stockable.php file and the vmprices.js files from the quotes below seems to have resolved the issue.

Quote from: drukman2000 on November 05, 2013, 12:02:54 PM
All,

Attached is the amended stockable.php.
It solve the weight & many other dimensions issues.
Now ALL Stockable Variants are passed into the cart correctly.
As a result now for example you may charge shipment according to weight.

All the best - Drukman.

Quote from: OpenGlobal on July 22, 2013, 22:18:05 PM
I have attached a zip file containing the latest fixes to the stockable.php and vmprices.js. Extract the zip file and move stockable.php to plugins/vmcustom/stockable and move vmprices to components/com_virtuemart/assets/js and overwrite the files which are already there. These files are based on the 2.0.22a versions of those files.

This contains the fix for being able to add more products than are in stock by repeatedly clicking the Add to Cart button and (hopefully) the fix for the price display problems.

I'd appreciate any feedback on this before it goes into the next release.

OpenGlobal E-commerce


Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on November 20, 2013, 22:52:50 PM
Quote from: greymoose on October 08, 2013, 21:34:42 PM
Is there a way to pick out one number from a four digit zip? Can the plugin handle an expression to strip the zip to one digit within the rule?

NZ postcodes use the third digit to define rural, PO Box, urban destinations and so on.

In the next version (Upcoming 4.0), I'll add a "digit" function in the advanced plugin that can extract the n-th digit of a number. It might take a few days before I can release it, though, because that version will add many new features that need quite some testing.

Reinhold
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: brendan on December 02, 2013, 12:26:06 PM
I'm using this extension and it works well. I'm using it to ship by weight and postcode. But it is restricting me to using only up to 4 "rules for country zone". I have about 65 lines each country zone. Am I going over a limit? Is there a way to extend that?
Title: Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
Post by: reinhold on December 02, 2013, 14:49:48 PM
Quote from: brendan on December 02, 2013, 12:26:06 PM
But it is restricting me to using only up to 4 "rules for country zone". I have about 65 lines each country zone. Am I going over a limit?

There is no limit about how many rules you can have per country zone. You can have arbitrarily many.

The only current limitation is that VirtueMart is only able to handle plugin configurations of up to ~19000 characters. So if all your rules together are longer than ~19000 characters, VM will (silently!) refuse to save the configuration. See http://open-tools.net/forum/shipping-by-rules-plugin/3160-solved-my-rules-are-not-saving.html

Unfortunately, there is nothing that my plugin can do to avoid this. However, in VM 2.1 it is planned to change the database field from a fixed, hardcoded length of ~19000 chars to a database field of variable length...

Best regards,
Reinhold