### Author Topic: Shipping by Rules Plugin - Shipping costs calculated from general rules  (Read 47147 times)

#### reinhold

• 3rd party VirtueMart Developer
• Jr. Member
• Posts: 204
##### Shipping by Rules Plugin - Shipping costs calculated from general rules
« 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:
Code: [Select]
`Name=Domestic Small; Articles<5; Amount<100; Shipping=1.50Name=Domestic Standard; Amount<100; Shipping=3.50Name=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

#### lindapowers

• Full Member
• Posts: 1335
• If you're going through hell, keep going.
• Skype Name: manu.gonzalez91
• VirtueMart Version: Latest avi
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #1 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

#### lindapowers

• Full Member
• Posts: 1335
• If you're going through hell, keep going.
• Skype Name: manu.gonzalez91
• VirtueMart Version: Latest avi
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #2 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

#### reinhold

• 3rd party VirtueMart Developer
• Jr. Member
• Posts: 204
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #3 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

#### lindapowers

• Full Member
• Posts: 1335
• If you're going through hell, keep going.
• Skype Name: manu.gonzalez91
• VirtueMart Version: Latest avi
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #4 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

#### zainabubu

• Jr. Member
• Posts: 128
• VirtueMart Version: 2.0
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #5 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.

#### reinhold

• 3rd party VirtueMart Developer
• Jr. Member
• Posts: 204
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #6 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

#### zainabubu

• Jr. Member
• Posts: 128
• VirtueMart Version: 2.0
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #7 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?

#### 3cellhosting

• Beginner
• Posts: 8
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #8 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

#### reinhold

• 3rd party VirtueMart Developer
• Jr. Member
• Posts: 204
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #9 on: July 03, 2013, 15:03:03 pm »
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

#### johnson33445

• Beginner
• Posts: 3
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #10 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

#### lindapowers

• Full Member
• Posts: 1335
• If you're going through hell, keep going.
• Skype Name: manu.gonzalez91
• VirtueMart Version: Latest avi
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #11 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

#### buzi

• Beginner
• Posts: 35
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #12 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

Code: [Select]
` 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.

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

and thanks for this great plugin

#### reinhold

• 3rd party VirtueMart Developer
• Jr. Member
• Posts: 204
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #13 on: August 26, 2013, 16:22:51 pm »
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

#### ricardo.nunes

• Beginner
• Posts: 5
##### Re: Shipping by Rules Plugin - Shipping costs calculated from general rules
« Reply #14 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?