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:

ZIP code with or without spaces 21 Oct 2016 17:42 #1

  • dkaneloglou
  • dkaneloglou's Avatar Topic Author
I have a problem with some particular places of Greece.
There are some places (very small villages or small islandes) that we dont want to show shipping cost and we want to show a message "Contact us" with a link to the contact form (if possible).
I have the Zip code of all these places.
The problem is that the zip code is very commun and sometimes the user insert it with space like this:
300 01
or like this:
30001
In the plugin I cannot include it in two ways. How do I include these cases?
What can I do?
Is it possible to "obligate" the user to put the ZIP only without spaces, as the plugin doesnt support spaces, validating the billing and shipping form? or maybe is it easier including in the plugin the two ways of the ZIP code?

ZIP code with or without spaces 21 Oct 2016 18:58 #2

  • dkaneloglou
  • dkaneloglou's Avatar Topic Author
VirtueMart version
3.0.16
Joomla version
3.6.2
PHP version
5.4.45
Webserver (apache/nginx/IIS)
Apache
Does your webserver's log contain any PHP messages or warnings?
No message

ZIP code with or without spaces 22 Oct 2016 23:17 #3

Dear DKaneloglou,
You are right, out of the box, spaces inside numbers cause the plugin to not properly understand the zip code as a such. If here are two common variants (i.e. you mention 300 01 as being quite common), it is probably easiest to simply check for both versions:
ZIP==30001 OR ZIP=="300 01"; Shipping=12345

By default, the plugin does not have string manipulation routines, so ignoring spaces in a variable is not so straightforward. One can extend the plugin to provide string manipulation, e.g. remove all spaces from the ZIP code before doing checks on it, but this requires some custom coding...

Best regards,
Reinhold

Best regards,
Reinhold
  • Page:
  • 1