VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Shipping VM 1.1 => Topic started by: da8iwr on June 18, 2009, 18:04:52 pm

Title: New UK Post code shipping module, needs ideas for a wish list
Post by: da8iwr on June 18, 2009, 18:04:52 pm
Hi There i have been commissioned to make a UK Post code shipping module by one of my clients as he hates what is in VM now.

http://en.wikipedia.org/wiki/List_of_postcode_areas_in_the_United_Kingdom

I have found these postcodes as a list which i will add to the module.

I will build and release this as GPL, so people can take and modify it, but rather than make it very static, i thought i will find out what others want and try to make it to suit a general audience, please give me your wish list of how it will work.

I'm not sure whether to make it work with

Any ideas?
Title: Re: New UK Post code shipping module
Post by: furnitureman on June 18, 2009, 19:01:15 pm
Ian, We get charged different rates by our furniture carriers based on the volume of goods that we ship.  Standard mainland postcodes have a fixed rate and Scottish Highlands postcodes are higher and then the smaller Islands around the UK have different rates as does Northern Ireland and the Republic of Ireland.  It would be good to be able to drag postcodes into a delivery category such as standard mainland, Scottish Highlands, Scottish Islands, IOW, Isle of Man, Channel Islands etc and to have a full detailed list of postcodes that covered all these regions and to create your own names for the regions.  

The shipping system that we use at the moment via Romancart and Virtuemart works by allocating a weight figure to each product and then adding shipping prices to the various tiered bands of weights so that it easy to manage and control.  The weight doesnt have to be the actual weight of the product.  This is by far the best way for us to calculate shipping from a shopping cart to so i would look for something similar if we changed module which we would probably do as the choice is terrible at the moment.  

It would definately be good to have the option to be able to click a few buttons and then all the delivery charges become free over a certain basket value which can be typed in when we run a sale over a weekend or a few weeks and then to un click the option and return to normal shipping rates.  

It would be really handy to have an option to manually change the VAT rate in one box by inputting the rate (15% or 17.5%) which then adjusts the VAT on the delivery based on GROSS tiered delivery rates that are input.  Some work off NET delivery rates which means all the tiered price levels need re calculating and inputting again from 1st Jan 2010 whenVAT changes back to 17.5%.  This is a real pain!  

It would also be good to be able to set a manual maximum delivery charge that would then ignore higher rates in the tiered ranges if this was activated so we could run an offer on max delivery of say £50 rather than the current rate of £80 which we have at the moment.  If this could be done within a few clicks it would be brilliant and if set to zero would be the same as free delivery which again could be run for a weekend for a special offer with very little work involved to change the rates.

If you could also offer the functionality to add different shipping companies or speeds of delivery to the tiered rates then customer may be able to choose a specific delivery company or a quicker or slower delivery which would be reflected in the price.  This would suit some companies but others might not be bothered about this but if the functionality was there i think people would start to use it if they had a use for it.

I'm sure many others with have comments and suggestions as every business if different.  It would be worth looking at the Romancart system as thats really simple and very functional and maybe adapting something similar into Virtuemart.  Its important to try and get the module to look proffesional within the shopping cart as well.  Good luck with this and i for one would be interested in trialling a new module with a few more bells and whistles on it.

Thanks Dave, Top Furniture Ltd
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: cinos on June 18, 2009, 19:01:28 pm
Hi there,

Obviously I can only speak for what I would want personally, but hopefully some of the things I mention will be useful to you.  ;)

Currently my shop uses Business Post for next day delivery and they typically have 5 areas within the Uk which all carry different delivery charges. Depending if whether the postcode is in the north of Scotland, Republic of Ireland...etc.

1.   As such, the most important feature for me would be for the shipping module to be able to determine which area a specific Postcode is located within and charge accordingly.


The ability to take into account the total weight of an order would be a close second. At present I have had to enter in each weight range separately which is both time consuming and limiting. Going back to Business Posts charge structure; items up to 10kg all carry the same charge. However once past this limit the charge increases by a certain amount of pence per extra kilogram. This has forced me to create a very long list of delivery options which will take an age to edit should I need to change carrier at a later date.

2.   What would be really handy is if the module could provide a single page for each delivery method (Business Post, Royal Mail 1st Class, 2nd, Standard Parcels, etc). With options to specify the standard (lowest charge) then ‘user set’ weight limits with extra charge options, all kept neatly for easy editing.


My shop also offers cover options for delivery  (i.e up to £100 cover, Up to £200 ,etc) and at present when someone places an order all options appear for the customer to choose. For instance on a £20 order the customer will still be given choices for standard cover of £39, plus cover for £100, £200 etc.

3.   As such it would be really good if the shipping module could also take into account the total value of an order and limit certain delivery options from appearing.


I’m really interested to see how this project turns out as it would be really helpful. After the excellent Frooglefeed module, I’m sure you have what it takes to make something brilliant. ;)

If I think of anything else I will let you know.  :)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: Judge G on June 18, 2009, 19:34:40 pm
I need a mix of weight and price.
below 1 kg would be £2.95, above would be £5.95. but over £100 would be free delivery in the UK
european would be under 2kg £20, 2-4Kg £40, over 4kg £50, there is no free delivery over £100 on this.
It would be great to make it simple to choose as well, atm I have to make a product that customers choose, which for obvious reasons customers dont and try to get free delivery!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: aqroo on June 18, 2009, 23:17:19 pm
Here in the US, UPS and FedEx both base their pricing based on a nationwide zone map. It would be very helpful to have the ability to setup the zone that you ship from, and then a matching of the list of US zip codes to the corresponding zone. I think UPS and FedEx make this matching available via flat text/.csv file to make the loading process less arduous.

If the plugin has this ability, the basket could automatically calculate the number of zones the package has to travel and compute an accurate shipping quote based on the result.

Great ideas! Keep up the good work!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: helenbn on June 18, 2009, 23:44:30 pm
Hi Ian,

To make this work for the US too would be great, but difficult. (Play scarey music...)

Enter tax into the equation. The US has tax rules that vary vary vary according to each state selling from depending on where it is selling to. Just that confusing statement might make you run screaming.

Now this does relate to your shipping module because some states tax shipping, some handling, some shipping and handling, some shipping one rate and handling another rate and this is effected by it's own set of tax rules.

For example, in Virginia you tax only sales shipping to Virginia. You also tax handling but not shipping. However VM lumps shipping and handling in the same line. So in Virginia, if it is worded together and it is shipped within Virginia, then you have to charge tax on S&H. You end up paying tax on something that you really don't have to.

But if you ship it to any other state you do not charge tax and there is no way to not charge tax on shipping and handling. VM does not have a way to control tax on S&H by ship to address.

So what I did with a Virginia store is change the VM wording from "Shipping and Handling" to just "Shipping" and not charge any tax on it to any state shipped to. By leaving out the word "Handling" I have satisfied the tax laws in Virginia.

This was a simple solution, but other states have much more complex laws.

So I think I would like to see a way to control tax on shipping location.

And I would like to see it have the option to break the shipping and handling line apart and choose this tax option.

I also use free shipping after you spend a certain amount.

Thanks,
Helen
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: Woody5k on June 19, 2009, 09:25:01 am
Hi There,

My daughter operates a card crafting web business and the problem she has with the Virtumart module is trying to get a compromise between weight and size that could be tagged to an item. The best way to explain what I mean is to give you an example.

Most of the items sold are small in size and small in weight and would go in a A5 Jiffy bag, if somebody then orders one 12" x 12" sheet of card (value 0.65) the order now has to be shipped in a cardboard box due to its size and required protection. In this instance the value of the order only increases by 0.65p but jumps in P&P quite considerably

In this instance it would be ideal if the selection of such an item in the cart would automatically choose an appropriate type of P&P.

Our site only ships to the UK and as such it would be ideal if only genuine UK postcodes would allow you to proceed beyond the cart this would prevent persons in such as the Republic of Ireland and mainland Europe from making payments with an inappropriate postcode. This could be a switchable facility so as to not restrict other users shipping worldwide

I hope I have not rambled on to much and hope that you can accommodate these requests.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mparrish on June 19, 2009, 11:19:15 am
Ian

Some good suggestions from furnitureman.  We would like to see;
- weight and volume based carriage charges
- set max carriage charge value
- being able to print shipping labels from the orders list (can do this with another module that we have added, but would be better integrated in your shipping module and add in flexibility)
- being able to set free carriage over a certain order value
- allowing the carriage charges to differ by product category within Virtuemart ( we sell a wide variety of product types and some of them need different carriage charging mechanisms)
- add in tracking facilities for carriers from within the Order List screen

Look forward to trialing the new module.

Mike
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: richardp7 on June 19, 2009, 12:46:46 pm
Hi Ian

I'd just like to see it simple - different postcodes have different charges as required (perhaps with a maximum carriage cost), plus the opportunity to give free carriage over certain amounts.

In addition, being able to also send package abroad.

regards

Richard

PS - when can you get it done - I have sites that would use it!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: suziec on July 01, 2009, 15:14:04 pm
We have about 5 different suppliers with different shipping rates. This gets very confusing when customers order several products at one time. We would manually have to go in and create a rate for each weight bracket.

Is it possible to link shipping rates to specified wholesaler? And for this to also cope when one product bought from one wholesaler, and another from a different wholesaler?

Cheers
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: da8iwr on July 01, 2009, 15:27:50 pm
Anything is possible with some serious hacking, but as a standard system this wont be possible i don't think.

You will either need to add a new field which will be your supplier, so the shipping module will know which one to use, or you could use the manufacturer i suppose, but i don't think it will be easy at all to set up.

You will also need some form of feed form your shipping suppliers, so the site can keep upto date records of the costs.

If this was all done, i suppsoe it could be done though, i will have to have think about this one :)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: Alex S on August 12, 2009, 15:12:15 pm
Hi Ian,

Just wondering how this project is coming along. I have since found a really good use for this idea. We own a local retail outlet, so we'd like to offer customers who have a 'WV' postcode free shipping. Anyone who doesn't have a 'WV' shipping postcode has to pay full whack for delivery.

What would be REALLY useful though is to limit the 'free delivery perimeter' by postcode even further. We are based at WV2, so WV14 is a looong drive away, so if we could limit free deliveries to maybe WV10, that would be even better.

This would be a perfect plugin to Virtuemart. I look forward to hear how this is coming along. Many thanks,
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: jayskibob on August 18, 2009, 22:19:02 pm
wow lot's of responses.

I just wanted to send positive feedback and hope that this UK shipping module works as well as hoped - we are all routing for you - hehehe

keep us posted on events

Jay
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: da8iwr on September 02, 2009, 18:11:47 pm
Sorry for the loss of contact... the interest is not lost, its just I have a huge contract to finish by the 15th, and it will be cutting it fine as it is.

After the 15th, I will be looking back at this module :)

Regards
Ian
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: heywood79 on September 07, 2009, 13:09:50 pm
Hi Ian

I have a client who wants to use VM, I've never used it before and I'm staggered by the lack of modules catering for UK stores!

What I would be looking for in this instance is the ability to deliver with costs based on weight and by postcode. I.e. extra charges for the outlying UK areas.

My client also does local deliveries free, only to certain postcodes and some postcodes depend upon a minimum spend whilst others don't!

I'm going to have a play around with what VM offers and see what I can come up with.

Cheers
Rob
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: dirtymonkey on November 16, 2009, 16:46:27 pm
Hi Ian,

Any chance of a quick update on this project?
I'd be happy to beta test if required.

Thanks in advance, DM.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: awharton on March 17, 2010, 14:16:08 pm
Is this a dead post now ? no sign of the shipping module ?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: bella28 on March 19, 2010, 10:33:07 am
I have been following this post and am also in desperate need of a UK shipping module. The plans outlined sound fantastic. I would pay for a module like this!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alpertheidiot on April 10, 2010, 04:22:51 am
Ian, I think some of us are happy to contrubite to a certain degree (financially), please can you update us where you are with the project? This certainly is a very very useful add on (and in fact is essential for a lot of people).

Please let us know whats happening and what needs doing..

thanks
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on April 23, 2010, 15:12:02 pm
Hi,

After searching in vane for a UK postcode based shipping solution for virtuemart and finding this thread which looks like the work stalled I created my own UK postcode shipping module for a client of my company and my boss says that we will release it to the virtuemart community.

With this in mind and the earlier comments in this thread, I added more options than our client actually needs but I've had to restrict the bulk of my testing to the clients setup so please treat it as beta code and thoroughly test before deploying to a production enviornment. We don't offer any guarantee of fitness for purpose or any official support yet.

I'll accept bug reports here but as we aren't officially supporting it at the moment I don't know when I'll be able to do bug fixes.

----------- Details -----------

Installation
------------

Download the attached postcode_shipping_module.zip, unzip and upload the 3 files to /administrator/components/com_virtuemart/classes/shipping/

Configuration
-------------

Go to Components->VirtueMart.
Click on the Admin tab and click Configuration then the Shipping tab.
Tick the check box for "UK Postcode Zones. Shipping rates by zones defined by UK postcodes" to enable the module.
Click on the Store tab and click Shipping module List.
Find the Postcode Zones entry and click Configure Ship Method.

Options
-------

Carrier Name: This is the name shown in the shipping information on the order screen and also the start of the name in the checkout ship methods stage.

Tax Rate: set the tax rate for shipping.

Enable default zone: you can enable a default zone to catch any postcodes that don't match any zones you've set up, you can give teh default a name and base rate just like normal zones.

No zone match message: text to display if the default zone is disabled and the postcode doesn't match any normal zones (can be left blank to display no message).

Rate type: you can choose from 4 rate types - flat rate, by weight, by price or by items, see below for more info.

Shipping options: you can create shipping options that will present extra choices to the user and modify the zone rate (eg 9am delivery, Saturday delivery etc - see below for more details).

Maximum shipping rate: you can set a maximum shipping rate to cap the amount of shipping charged (can be used to give free shipping for a period without changing the zones or max £50 shipping etc).

Total order price for free shipping: you can set an amount to trigger free shipping.

Check address is in GB: if enabled the module will check if the address country is GB and immediately exit if not. If enabled you can enter a message to show if country is not in GB.

Zones
-----

Each zone has the following settings.

Zone name: the name of the zone (this does not have to be unique so you can create several different zones with different matching criteria but the same name to give the illusion of one zone).

Postcodes in zone: a comma seperated list of postcodes or parts of postcodes as controlled by the match type setting (see below).

Base rate: the base amount to charge for the zone, this will be modified depending on the rate type settings (see below) and the shipping option choosen (if any).

Match type: each zone can be set to match either the "area" or "outward" part of the postcode or the full postcode. The "area" part is the first letter(s) (eg TR for Cornwall where I live), the "outward" part is the letter(s) and number(s) upto the space (eg TR18 for Penzance), the full postcode is, of course the full postcode.

If a zone is set to "outward" match type you can enter postcode ranges like "TR15-18" as an equivenlant of writing "TR15,Tr16,Tr17,TR18". There are no ranges for area or full match zones.

A postcode will be tried against all "full" match zones first then against "outward" match zones and finally "area" match zones.

This allows you to setup a full match zone for a handfull of postcodes around your business (eg "TR181AB,TR182BC,TR183ED"), then an outward match zone for your postcode district (eg "TR18") and finally area match zones for the 'standard' zones for your carrier (eg "TR,PL,TQ"). this way the postcode TR18 1AB will match the full match zone, while TR18 9ZZ will match the outward match zone and TR19 4FG will match the area match zone.

Rate Type
---------

As stated above there are 4 rate types to choose from.

Flat rate
---------

The zone's base rate will be charged no matter what the order contains.

By weight
---------

You set a weight amount (in kg's) for the base rate and any extra weight will be charged in multiples of the base rate. So an order with a total weight of upto the amount set will be charged the zone's base rate, an order with up to twice the amount will be charged twice the zone's base rate etc.

You can also configure whether to show info of the weight on the shipping method choice list eihter nothing, show the number of "units" of weight or show the total weight. If you set the show option you can set a display label and whether to pluralise the lable.

As an aside I've done this because our client sells large items and they needed to be able to charge shipping per pallet with each item taking one or more pallets. So I've set the rate type to "By weight" and set the amount to 1 and to display the number of units of weight with a display label "pallet" with pluralise lable enabled. This means that I can set the weight of each item 1 kg for each pallet and the shipping method will charge 3 times the base rate for an item taking 3 pallets and will show "3 pallets" on the choose shipping method choice.

By price
--------

You can set up price bands with a minimum price to trigger the band and a modifier to apply to the zone's base rate. The modifier can be either a multiplication (*x), a division (/x), an addition (+x), a subtraction (-x) or a setter (=x) and it will be applied to the zone's base rate.

So if you set a band with a minimum of £10 and a modifier of +5 and a second band with a minimum of £100 and a modifier of =0 then an order of less than £10
will cost the zone's base rate, while orders between £10.01 and £100 will add 5 to the zone's base rate while orders of £100.01+ will be charge 0.

By Items
--------

Works similar to By price above except that the bands affect the number of items that fall within that band.

So if you set up a band with a minimum of 3 and a modifier of /2 and a second band with a minimum of 10 and a modifier of =0 then the first and second item would be charged the zone's base rate each, the third until the ninth item would be charged 1/2 the zone's base rate each and the tenth item upwards would not be charged.

Shipping Options
----------------

These have a name and a modifier (as above the modifier can be +,-,/,* or =).

When the module ouputs it's radio button on the shipping method choice stage of the checkout it will show an additional radio button choice for each option set.

So if you set an option with name equals "9am delivery" and modifier equals +15 and another option with name equals "Saturday delivery" and modifier equals +25 on the shipping methods stage of the checkout you will get 3 radio buttons from this module:

   ( ) STD, Zone 1: £10
   ( ) STD, Zone 1 [9am delivery]: £25
   ( ) STD, Zone 1 [Saturday delivery]: £35

Multiple carriers
-----------------

This module can only be configured with the zones for one carrier, however after reading the shipvalue topics about changes needed to clone the shipvalue module I've tried to make it easy to clone this module to provide for different carriers.

Basically for each carrier beyond the first you will need to decide on the clone's identifier which has to be the same in all the edits below (except the name and description in the ini file) and then follow the following steps (for the example the clone's identifier is '1'):

Copy postcode.php to postcode1.php.

Edit postcode1.php, change the following lines

Code: [Select]
59: class postcode {
60:    var $classname = "postcode";
61:    var $instance  = '';

to

Code: [Select]
59:class postcode1 {
60:    var $classname = "postcode1";
61:    var $instance  = '1';

Copy postcode.ini to postcode1.ini

Edit postcode1.ini, changing

Code: [Select]
4: name = Postcode Zones
....
12: description = UK Postcode Zones. Fixed shipping rates by zones defined by UK postcodes
....
15: filename = postcode.php

to

Code: [Select]
4: name = Postcode Zones 1 [enter any descriptive change here, shown on the shipping methods list]
....
12: description = UK Postcode Zones 1. Fixed shipping rates by zones defined by UK postcodes [enter any descriptive change here, shown on the shipping tab]
....
15: filename = postcode1.php
-------------------------------

As stated at the beginning of this post we offer no support or warranty for this module and accept no liabilty for problems caused by using this module but I look forward to hearing comments, ideas and bug reports from anyone who does test it.

Cheers,

Alan Brookland,

altcom Ltd.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alpertheidiot on April 23, 2010, 16:03:10 pm
alan, thank you so much for sharing this.. i will try this asap..

many thanks!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on April 23, 2010, 16:51:12 pm
Hi alpertheidiot,

no problem, I look forward to your feedback.

I've just found a bug, an old line of code left in by mistake but only triggered if the country = GB check is enabled.

Here's the fixed version of the module attached. Please use this one not the one two posts above.

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: heywood79 on May 01, 2010, 15:22:50 pm
Hi Alan

Thanks for this shipping module. It is just what has been needed.

I have configured for a client and am running through some test scenarios.

I have noticed that when Shipping By weight with the default zone enabled and the weight amount set at 15 it is charging customers a proportion of the default zone shipping rate.

i.e.
Default zone cost £8.99
Product wieght 7.5
Shipping Cost £4.50

Unless I have read/done something wrong this is supposed to charge £8.99 .

Am I correct?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alpertheidiot on May 01, 2010, 21:34:57 pm
alan, I've been testing this your module and it is working like a treat. Im going to use it on my next project, and I will update you accordingly.

like i said, on my tests it just worked perfect, just what I needed.. thank you so much!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: heywood79 on May 01, 2010, 22:21:12 pm
Hi alpertheidiot

Is it working spot on for you when you try shipping by weight?

Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 04, 2010, 13:31:02 pm
Hi guys, This is great to see after several days trawling for a UK based module. This looks like it will work perfectly so kudos to alanB for releasing it to the community. I have installed and tried it BUT i am having the same issue as heywood79 in the I set a base rate of £5.95 (default zone not enabled) but the shipping price being shown is 79p and not 5.95. I'm sure this is a confi issue but i'm stuck as to what to try next. Did you solve this heywood79?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 04, 2010, 13:32:46 pm
Ooops, I also meant to add that I was also using the ship by weight option. (Could this be virtuemart converting my product weight into something other than KG?) I have each product set in KG in the item listing.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 04, 2010, 13:46:49 pm
Just tried a bit more testing and switched on the 'show units of weight' display type and can now see that the weight being shows does not match the weight of the item. My item is set to 1.1kg in VM but is showing as 0.44kg on the shipping page. Now just need to find out why...
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 04, 2010, 14:15:09 pm
$num_units; seems to be what is providing the unti of measure in the php script. My php is poor tho so any ideas anybody?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alpertheidiot on May 04, 2010, 16:30:48 pm
sorry guys, I havent tried by weight option. I will try and let you know when I have some time..
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 04, 2010, 16:34:06 pm
Thanks alpertheidiot, it would be good to know whether it also fails on your test as that might indicate a setting in VM that is wrong. Although from brief examination it does look like the weight is actually showing the date from the variable $num_units. I just dont know enough php to work out what to do next. Will keep playing this evening tho and let you know if I find anything.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 04, 2010, 17:06:58 pm
I've figured out that my products weight is being divided by whatever number is entered into the 'by weight>amount' field. The divided number is then being multiplied by the base amount. How do set this so the product weight is not divided? (Sorry for numerous posts, just hoping this may help someone better at php than myself)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 07, 2010, 10:38:24 am
Hi Guys, I had a dig around the code a bit more last night and have managed to recode the section that works out the weight so it now works as it should and the mod is now charging the correct shipping price based on the weight bracket entered. Would still like to see if alanB can come up with a fix as i'm sure is php will be cleaner/more efficient than mine!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alpertheidiot on May 07, 2010, 12:06:06 pm
can you maybe share your hack? Im not using weight option but others might need.

cheers
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 10, 2010, 11:17:56 am
Hi guys,

sorry for silence - I've been on holiday. I've been assigned another project now but will try and fix this weight issue in my breaks (as I said above I can't officialy support it at the moment).

I'll post as soon as I can, @asphole if you can post an explanation of what you did, it'll save me some time.

Cheers,

Alan
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: heywood79 on May 10, 2010, 11:25:49 am
I have made a few quick and dirty changes to the mod to get it to work for me. I'll post my changes when I put them together with an install instruction
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 10, 2010, 13:40:13 pm
Hi,

I've had a quick look at the weight problem and I realise my code only works when set up with products having whole number weights in kgs and the rate limit is also whole number in kgs (which is how our client's site works)

Virtue mart converts weights in pounds into kgs behind the scenes so that if you're not careful a product set to weight 1 will become 0.44kgs for the shipping module.

When I get more time I'll rewrite the wieght calculation to take into account these things and produce the correct answer for $num_units.

@heywood79 and @asphole - if you can post the code changes you've done it'll speed up my work and I can upload a new version of the whole module.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 10, 2010, 14:25:34 pm
Hi,

here's an updated version of the module (v0.2) that hopefully fixes the weight problems.

*edit* Note: anyone who's updating - don't upload the postcode.cfg file from the zip, you'll lose any settings you've already saved. */edit*

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 10, 2010, 17:20:30 pm
Hi Guys, Sorry, I've had the weekend off so only just been back to this thread. I haven't tried your fix as mine was working now as it should be but I can post the code here if for any reason your's is not working for people. I basically edited the code to calculate the overall weight of the cart and then work out how many times to multiply the base rate by. (ie:if base rate was 5kg and overall weight was 7kg then 2xbase rate were required) It all seems good for my setup so hopefully your fix will work for others. Thanks again for releasing the mod. It saved me a lot of time!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 11, 2010, 13:03:49 pm
Hi,

After fixing the weight issue yesterday I thought that the weight option could be a bit limiting and that some people might need to use weight bands instead so I've added another rate type.

Here's v0.3 which offers weight bands that work in the same way as price bands i.e. you can have one or more weight bands with a minimum weight to trigger the band and a modifier to the zone's base rate.

If you want to upgrade from v0.1 or v0.2 you will need to either upload the included postcode.cfg file (which will remove any config settings you've saved) or download your original config file, insert the following line into it and re upload it.

Code: [Select]
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']=array();
add it just before the current line 26:

Code: [Select]
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_PRICES']=array();
Cheers,

Alan

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 12, 2010, 10:53:28 am
Hi alanB, Great work. I've just tried the updated module at it works perfectly using the weight options. I can now configure different weight brackets for each delivery service. I wondered if it was possible to somehow use this mod for international delivery options using country codes rather than UK postcodes?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 12, 2010, 11:20:43 am
Hi asphole,

thanks, glad it's working for you.

Off the top of my head it should be a trivial change to compare with the country code so you could create a copy of this module but change it to detect country codes instead of postcodes.

I'll see if I can bash out a version during lunch.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 12, 2010, 11:46:38 am
Hi alanB, thats great news. You should also think about getting a 'donate' button set up somehow as I've seen other commercial mods that don't compare with this version and I for one would be happy to contribute. Especially as you're giving up lunch breaks to do this!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 12, 2010, 14:52:41 pm
Hi asphole,

Once again thanks, most of the work was done on behalf of a client as we couldn't find anything out there to do it but I do enjoy passing something back to the community to help pay back for all the free software and help I've had during my career. If my boss sees your post, however, he might decide to start charging for it ;D

I've just finished lunch and I've done a quick and dirty version for using country codes, however I can't test it as I deleted all countries outside of the UK on my local test machine since our client only ships to UK ::)

Most of the help text still refers to postcodes but of course it's now contry codes :D

Can you have a play and tell me if it works or not - also I'm not sure whether to use the 2 or 3 letter country code (currently it looks at the 2 letter code) - maybe it should be an option in the module for which one it uses :-\

You'll find it as "Country code zones" next to "UK postcode zones" in the shipping methods list.

Let me know and I'll see if I can finish it tomorrow lunchtime 8)

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 12, 2010, 20:56:19 pm
Hi Alan,

Thanks again for taking the time to do this. I'm sure a lot of people will appreciate the effort you have gone to. Myself included.

I've uploaded the files and configured it using 2 letter country codes but when I checkout using one of the country codes as my location I get the following error message:

Fatal error: Cannot break/continue 2 levels in /home/domain/public_html/administrator/components/com_virtuemart/classes/shipping/postcode_int.php  on line 118

Any ideas?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 12, 2010, 21:52:30 pm
Hi Alan,

I changed the code from 'break(2);' on line 118 to 'break;' and it now works perfectly (limited testing but seems to be doing the job. I'm just going to test it a bit more now)

I also changed the following 2 lines to include a <br> so each shipping option that appears after these mods is on a new line. (I changed this as I found that if I used a message on the 'Shipping address not in GB message:' then the next shipping module to appear on the users cart appeared on the same line as the message).

            $string = "<br /><input type=\"radio\"$checked name=\"shipping_rate_id\" value=\"$value\" />";
            $string .= "$postcode_cfg[POSTCODE_CARRIER_NAME]: $name$extra_description: <strong>". $CURRENCY_DISPLAY->getFullValue($basic_rate)."</strong><br>";

Is there anywhere else to include the <br>? (I haven't been using the other options yet so not sure if breaks onto a new line using price bands for example)

Hope this helps. So far this looks like it will offer all the functionality needed to migrate my sites from zen cart to virtuemart. (It was only the shipping modules or lack of that stopped me previously) so a BIG thanks again!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 12, 2010, 22:43:29 pm
Hi Alan,

I just noticed that the URL in the .ini file is incorrect so it points to a 404. It looks like VM adds the 'http://' so if its included in the .ini file then it appears in the shipping module list as 'http://http://www.domain.com'

Just thought you might want to change this so you can at least get some visits to your site.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 13, 2010, 03:46:21 am
Hi Alan,

I've just done some more testing using the weight bands and wondered if this could be tweaked to allow decimal places or if I'm missing something obvious? The weight bands works fine at present for me assuming my product weights are all 1kg,2kg,3kg etc but a lot of my products are smaller weights such as 150g/.15kg.

In order to get this to work on weights over 1kg I have to enter the weight of the product in VM as: .1350KG and not 1.35kg (note the decimal point at the beginning)

My weight band is set like this: minimum:1250 - modifier:=5.70 (as I cant set a minimum of 1.25

If I set the weight in VM to 1350g it is converted to 1.35 on the shipping page and I cant add a 'minimum' of 1.35 in the mod.(which would be preferred)

I am testing this on a test site but would ultimately like to use it on an existing site and would prefer not to have to manually adjust all the product weights as there are 1000+(other readers may also be adding to an existing site) so if you have any ideas on the best approach to this i'd be hugely grateful.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 13, 2010, 12:46:35 pm
Hi Alan,

I've managed to get round the weight issue by adding $weight_total = $weight_total*1000; on line 194.

I can now set my product weights in VM to 1KG,2KG etc and .125, .250 etc
and then set the 'minimum' in the module to 999

Hopefully this may help others.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 13, 2010, 13:44:51 pm
Hi Asphole,

Cheers, I've fixed the break(2) bug.

I've figured out the decimal places issue - the code was casting to ints and using them as array indexes. I'm changing it use the entered string as array indexes and then casting them as float when checking against the total weight (it;'s the same for the price bands so I'll apply the same incase anyone wants £2.50 price band etc).

I'll post fixed versions of both postcode and postcode_int when I get them both sorted.

I'll also add in a fix for the last radio button or the message not having a BR.

I also noticed another issue in the postcode_int - I hadn't removed the $dest_postcode var from the radio button value code so it was causing a notice. I've changed it to show dets_country instead (lines ~277 and ~309)

Thanks for the feedback and I'll probably have these fixes posted tomorow after lunch.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 13, 2010, 14:01:46 pm
Thats great Cheers Alan, I'll hold off playing any more until you post the new versions. Cheers again.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 14, 2010, 14:15:43 pm
Hi,

here's 0.4 versions of the postcode shipping module and the postcode_int port to use country code zones. They both now allow decimals in the weight and price band minimums and they both add BR's after the radio buttons (I note that the other shipping modules I've looked at don't add BR's?), the no default zone message and the postcode module no GB message.

@asphole - in the postcode_int version I've added in an option to use either the country 2 code or the country 3 code, this requires a change to the postcode_int.cfg.php file, if you want to keep your current config file you'll need to edit it to add the following line:

Code: [Select]
    $POSTCODE_CFG_int['POSTCODE_COUNTRY_CODE_TYPE'] = '2';
just after:

Code: [Select]
    $POSTCODE_CFG_int['POSTCODE_TAX_RATE'] = '0';
Again let me know if anything goes wrong - I don't have much time to test :)

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 17, 2010, 10:41:36 am
Hi Alan,

Sorry for the delay in replying. I installed the new versions yesterday and everything works ok for me now. I've set weight bands up based on postcodes and it works perfectly.

I did try to clone the mod using your instructions on P2 of this thread but get the following error:

Fatal error: Call to a member function show_configuration() on a non-object in /home/domain/public_html/administrator/components/com_virtuemart/html/store.shipping_module_form.php  on line 48

Any ideas? Have you tried to duplicate the mod yourself?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 17, 2010, 10:51:23 am
Hi Asphole,

It looks like you've not renamed the file and class the same:

postcode.php -> postcode1.php

and

Code: [Select]
class postcode { ->
Code: [Select]
class postcode1 {
The code that is failing is because it figures the class name from the filename.

Let me know what exactly you've done if you have done both of those and I'll look into it.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 17, 2010, 11:10:32 am
Hi Alan,

You're absolutely right! Sorry it was very late late when I did this last night! I'd forgotten to change the name of the class. (I just changed the values!) It's now working and just needs configuring.

It looks like it will suit my needs exactly so I'll do some more testing tonight and let you know if I see any issues. (There certainly doesn't seem to be any using the weight band option)

Thanks again for your effort on this mod! I'm sure there will be many people using it and grateful for the work you've put in!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 17, 2010, 11:15:54 am
Hi asphole,

great - looks like I'll be able to tell my boss the module is about ready to be official released, I'll have to look into how to add it to the Virtue Mart extensions directory.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 17, 2010, 12:23:58 pm
Yes, It's definitely looking that way. you might also want to add a link somewhere in your read me file to http://en.wikipedia.org/wiki/List_of_postcode_areas_in_the_United_Kingdom for list of 2 digit UK postcodes to make life easier for some users who don't already have this info.

I'll test some of the other options tonight and let you know if I see any issues. I would have tried it over the weekend but spent ages trying to resolve the VM breadcrumb issue! :o(

Just need to find a shipping calculator now....
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: AH on May 19, 2010, 23:04:12 pm
Can't wait for this to be ready for a live site!! :)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 24, 2010, 11:48:10 am
Hi,

Here's v0.5 of the shipping module and the international port that fixes a few things.

1) The maximum rate option wouldn't work if set to 0.

2) The total order price for free shipping option wouldn't work if set to 0.

2) The instance name was being appended to the classname when creating the filename for the config file. The bug wouldn't stop the use of multiple intances except if you created your own config file following the instructions. For an instance called "1" the filename would end up being postcode11.cfg.php.

I had already fixed this bug when creating the international version but forgot to copy it across to the original. If you have created other instances of the main postcode module and update to this version you'll need to rename the config file to remove the second instance name.

3) I've changed the order that the weight/price/item bands are stored in the config files for both the normal and international versions so that they don't have to be reversed in the list rates code but instead have to be reversed when editing the config, this optimises the code so less work is done when customers are checking out.

This means that if you update to either v0.5 versions but keep your original config file you will have to edit and save your configuration - no need to change anything (you will see no differences but the order will be changed in the config file) until you do this the bands will not work as expected as the highest rate will be triggered before the lower rates.


I think we're about ready to release the module as v1 on VMED, however fixing 1) and 2) above made me think about these options. If you set a max rate or the free shipping option what would you want to happen if you have any extra options?

For example if you had "Saturday delivery" adding £10 to the rate and the max rate set to £50 pounds should the Saturday option be set to £60 or £50 or not even show? Currently the saturday delivery option will cost £60.

Also if the free shipping option is set then the Saturday delivery option is shown (listed as free shipping) but costing £10. Is this the desired behaviour or again should it be free or should the options not show when free shipping is triggered? I suppose at least the "Free shipping" text should be removed on the options?

Hopefully some responses here will allow me to set the right behaviour (or choice of behaviours) and then we'll be looking at adding the module to the VMED next week.

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: asphole on May 26, 2010, 01:07:14 am
Hi Alan,

I've tested the new version and it appears to be working perfectly. I've also cloned the module a couple of times for different carriers and had no problems at all so good work!

With regard to your questions, my personal preference would be:

Maximum Rate: As it is, ie;Set Saturday Delivery to £60 (using your example)
Free Delivery: Show options and total as £10 but remove "Free Shipping" text.

Hopefully some of the other testers will also chip in with some ideas. As soon as you release it at VMED I'll leave you a positive review.

Thanks again for releasing this. It has made my life so much easier and covers all of my shipping requirements!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mondomota on May 27, 2010, 16:00:30 pm
Hi Alan,

I've been following this thread with great interest and have used your mod on a site I'm building.
What would be fantastic is to be able to specify a total order price for free shipping for each of the zones rather than just one coverall price.

We have set our ordr total at £75 for free shipping which is fine for the UK mainland where the shiping charge would normally be just £5.99

But in the Scottish highlands for example we have to charge £34.99 for delivery and can't afford to give that away for free.

If you could do that you'd be on my Christmas card list eternally!

Ollie
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on May 27, 2010, 16:43:53 pm
Hi mondomota,

That's not hard to add, how do you see it interacting with the general free shipping amount?

As far as I can see you could have either:

1) each zone can have a free shipping value that overrides the general value

or

2) the general value if set overrides the zones value

I suppose 1) is better as you can have a general free shipping amount set and then only set a different amount for specific zones that needed it. Or maybe I could add a choice for which overrides the other? Let me know your ideas / needs.

I'm still waiting to figure out what to do with options when max rate and/or free shipping is set (see the bottom part of http://forum.virtuemart.net/index.php?topic=57000.msg237232#msg237232 (http://forum.virtuemart.net/index.php?topic=57000.msg237232#msg237232)) so when I add that code I'll add your request too.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on June 07, 2010, 13:00:48 pm
Hi,

here's v0.6 of the postcode shipping module, changes are:

1) Removed the "free shipping" text from the options radio buttons if free shipping is triggered.

2) Added a free shipping option for each zone and an option for whether the zone free shipping amount overrides the base free shipping amount or vice versa.

3) Added the version number into the config file and the module code. Added code to check the config file and automatically upgrade it if needed while keeping user config data.


Since I didn't get any feedback regarding the options and free shipping interaction apart from asphole's I've just left it as is barring the removal of the free shipping text.


If you're upgrading from a previous version don't upload the config file from the zip, the auto config file upgrade should work fine but I would definately take a backup to be safe. If I've not forgotten any of the config file changes the auto upgrade should work from any version of the config file going back to the original release.

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: badgesforschools on June 14, 2010, 14:56:13 pm
Hi All,

I have installed v0.6 and configured it but when i click 'add zone' nothing happens, i am on a mac using firefox. Any ideas?

Cheers,
Bruce.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on June 14, 2010, 15:17:46 pm
Hi Bruce,

hmmm - looks like I introduced a bug in 0.6 thanks for reporting it.

I'm just putting the finishing touches to 0.7 and will fix it in this release which I'll be posting asap.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on June 14, 2010, 16:21:24 pm
Hi All,

here's v0.7 of the postcode shipping module.

I noticed a call for help by Mongrel over at http://forum.virtuemart.net/index.php?topic=71690.msg238596#msg238596 (http://forum.virtuemart.net/index.php?topic=71690.msg238596#msg238596) for a shipping module that would allow shipping to be set as a variable percentage of the order total based on state and decided I could do a port of this module for state codes just as I did for county codes. Then I thought "why maintain 3 almost identical versions of the module when I could add an option for what to match against into the main module" and so now the postcode shipping module becomes the "UK postcode/State code/Country code shipping module".

New to v0.7.

As mentioned above there is now a Zone Type option that allows you to choose to match zones based on the UK postcode (well it could possibly be used in other countries but it has some very UK centric code and assumptions in there), the state code or the country code.

Since the module is now more than just a UK postcode I changed the "Check address is within GB" option to "Check address is within country" option with a drop down to choose the country.

Also to facilitate Mongrel's request I've added a new Rate Type - Percentage of Order Total where the zone's base rate will be used to figure out a percentage of the order total to charge as the shipping rate.

I also fixed the new zone bug introduced in v0.6 reported bt badgesforschools.

Remember as there's an auto config file upgrade facility do not upload the config file if you wish to keep your current settings.

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: pipgraphics on July 04, 2010, 12:57:52 pm
Hi Alan, I have to say your postcode module is just genius.
Thank you.

Can you tel me if on any version the Rate type "By Item Band" works as I can seem to get it working. The calculation alway shows up as £0.00

Im trying with Min: 2 and Mod: /2 Im finding vertion 5, better suite my needs as I need fixed rate for UK delivery with a choise of next day for any dilivery size. But Europe is £5.99 per item and the rest of the world £7.99 per item. But I cant seem to get the "by item band" to work.

Any help with this would be much appriciated.

Thanks

Paul
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 05, 2010, 10:45:52 am
Hi pipgraphics,

glad you like the module.

I've looked at the by item bands and there's no way it could work which is odd beacause I'm sure I tested it when I wrote it. Oh well, I've fixed it now :) I'll post a new version below.

[edit]By the way not sure what you mean by finding version 5 better, there shouldn't be anything you can do with an earlier version you can't do with the latest?[/edit]

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 05, 2010, 10:52:05 am
Hi all,

here's v1.1 of the UK postcode/county/country code shipping module.

(Version number bumped to 1 when I submitted it to the VMED - not had any response from them yet though - if anyone involved in the VMED sees this can they let me know why not)

Fixed the item bands rate type as reported by pipgraphics.



[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on July 05, 2010, 11:11:27 am
it worked pretty well for me ,only problem is only the 1st 9 states (regions) are appearing at step 2 of check out ,any region after the ninth i just get a "Please select a Shipping Method!" without any option. ive tried to go through the codes in postcode.php and the config file but im still stumped why only nine states would be processed after adding about 30 in the vm_states table.

any ideas of what could be causing this
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 05, 2010, 11:15:16 am
Hi adrian,

can you post your postcode.cfg.php file and I'll have a look.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on July 05, 2010, 12:40:38 pm
here is the config files

///////////////////////////////////////////////
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die('Direct Access to this location is not allowed.');

if(!defined('POSTCODE')) {
    define('POSTCODE', 1);
    global $POSTCODE_CFG;

    $POSTCODE_CFG = array();

    $POSTCODE_CFG['POSTCODE_VERSION'] = 0.7;
    $POSTCODE_CFG['POSTCODE_CARRIER_NAME'] = 'STD';
    $POSTCODE_CFG['POSTCODE_TAX_RATE'] = '0';
    $POSTCODE_CFG['POSTCODE_ENABLE_DEFAULT'] = 0;
    $POSTCODE_CFG['POSTCODE_DEFAULT_NAME'] = '';
    $POSTCODE_CFG['POSTCODE_DEFAULT_RATE'] = '';
    $POSTCODE_CFG['POSTCODE_NO_ZONE_MESSAGE'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE'] = 'weight';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_AMOUNT'] = '5';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_TYPE'] = 'weight';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_NAME'] = 'KGs';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_PLURALISE'] = 0;
    $POSTCODE_CFG['POSTCODE_MAX_RATE'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING_OVERRIDE'] = 1;
    $POSTCODE_CFG['POSTCODE_COUNTRY_CHECK'] = 1;
    $POSTCODE_CFG['POSTCODE_COUNTRY'] = 'KE';
    $POSTCODE_CFG['POSTCODE_NOT_COUNTRY_MESSAGE'] = 'not shipping outside kenya';
    $POSTCODE_CFG['POSTCODE_ZONE_TYPE'] = 'state_3';
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_PRICES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_ITEMS']=array();
    $POSTCODE_CFG['POSTCODE_OPTIONS']=array();
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Zone A', 'text' => 'NRB,', 'postcodes' => array('NRB,' => '','' => ''), 'rate' => '200', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Zone B', 'text' => 'ATH,KRT,KAR,KIA,KIK,LIM,MAC,MUR,NIV,NKR,NGO,NYE,RUI,THK,', 'postcodes' => array('ATH' => '', 'KRT' => '', 'KAR' => '', 'KIA' => '', 'KIK' => '', 'LIM' => '', 'MAC' => '', 'MUR' => '', 'NIV' => '', 'NKR' => '', 'NGO' => '', 'NYE' => '', 'RUI' => '', 'THK' => '', '' => ''), 'rate' => '250', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Zone C', 'text' => 'CHO,CHU,EMB,KAJ,KTU,NYA,', 'postcodes' => array('CHO' => '', 'CHU' => '', 'EMB' => '', 'KAJ' => '', 'KTU' => '', 'NYA' => '', '' => ''), 'rate' => '300', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Zone D', 'text' => 'ELD,KAK,KER,KIS,KSM,KIT,MER,NAN,NAR,VOI,', 'postcodes' => array('ELD' => '', 'KAK' => '', 'KER' => '', 'KIS' => '', 'KSM' => '', 'KIT' => '', 'MER' => '', 'NAN' => '', 'NAR' => '', 'VOI' => '', '' => ''), 'rate' => '350', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Zone E', 'text' => 'BUN,MSA,', 'postcodes' => array('BUN' => '', 'MSA' => '', '' => ''), 'rate' => '400', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Zone F', 'text' => 'MAL,', 'postcodes' => array('MAL' => '', '' => ''), 'rate' => '500', 'free' => '');
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']['0.2']='+50';
}

?>

//////////////////////////////////////////


and here are the states  added to vm_state table ,(there actually towns in kenya),they appear ok in the regisratin form , but whrn u select any town after "karatina" wich is the ninth, it will not appear in the choose shipping method.



///////////////////////////////////


INSERT INTO `mol_vm_state` VALUES(449, 110, 'Athi River', 'ATH', '1');
INSERT INTO `mol_vm_state` VALUES(450, 110, 'Bungoma', 'BUN', '2');
INSERT INTO `mol_vm_state` VALUES(451, 110, 'Chogoria', 'CHO', '3');
INSERT INTO `mol_vm_state` VALUES(452, 110, 'Chuka', 'CHU', '4');
INSERT INTO `mol_vm_state` VALUES(453, 110, 'Eldoret', 'ELD', '5');
INSERT INTO `mol_vm_state` VALUES(454, 110, 'Embu', 'EMB', '6');
INSERT INTO `mol_vm_state` VALUES(455, 110, 'Kajiado', 'KAJ', '7');
INSERT INTO `mol_vm_state` VALUES(456, 110, 'Kakamega', 'KAK', '8');
INSERT INTO `mol_vm_state` VALUES(457, 110, 'Karatina', 'KRT', '9');
INSERT INTO `mol_vm_state` VALUES(458, 110, 'Karen', 'KAR', '10');
INSERT INTO `mol_vm_state` VALUES(459, 110, 'Kericho', 'KER', '11');
INSERT INTO `mol_vm_state` VALUES(460, 110, 'Kiambu', 'KIA', '12');
INSERT INTO `mol_vm_state` VALUES(461, 110, 'Kikuyu', 'KIK', '13');
INSERT INTO `mol_vm_state` VALUES(462, 110, 'Kisii', 'KIS', '14');
INSERT INTO `mol_vm_state` VALUES(463, 110, 'Kisumu', 'KSM', '15');
INSERT INTO `mol_vm_state` VALUES(464, 110, 'Kitale', 'KIT', '16');
INSERT INTO `mol_vm_state` VALUES(465, 110, 'Kitui', 'KTU', '17');
INSERT INTO `mol_vm_state` VALUES(466, 110, 'Limuru', 'LIM', '18');
INSERT INTO `mol_vm_state` VALUES(467, 110, 'Machakos', 'MAC', '19');
INSERT INTO `mol_vm_state` VALUES(468, 110, 'Malindi', 'MAL', '20');
INSERT INTO `mol_vm_state` VALUES(469, 110, 'Meru', 'MER', '21');
INSERT INTO `mol_vm_state` VALUES(470, 110, 'Mombasa', 'MSA', '22');
INSERT INTO `mol_vm_state` VALUES(471, 110, 'Muranga', 'MUR', '23');
INSERT INTO `mol_vm_state` VALUES(472, 110, 'Nairobi CBD', 'NRB', '24');
INSERT INTO `mol_vm_state` VALUES(473, 110, 'Naivasha', 'NIV', '25');
INSERT INTO `mol_vm_state` VALUES(474, 110, 'Nakuru', 'NKR', '26');
INSERT INTO `mol_vm_state` VALUES(475, 110, 'Nanyuki', 'NAN', '27');
INSERT INTO `mol_vm_state` VALUES(476, 110, 'Narok', 'NAR', '28');
INSERT INTO `mol_vm_state` VALUES(477, 110, 'Ngong', 'NGO', '29');
INSERT INTO `mol_vm_state` VALUES(478, 110, 'Nyahururu', 'NYA', '30');
INSERT INTO `mol_vm_state` VALUES(479, 110, 'Nyeri', 'NYE', '31');
INSERT INTO `mol_vm_state` VALUES(480, 110, 'Ruiru', 'RUI', '32');
INSERT INTO `mol_vm_state` VALUES(481, 110, 'Thika', 'THK', '33');
INSERT INTO `mol_vm_state` VALUES(482, 110, 'Voi', 'VOI', '34');
///////////////////////////////////////////

thanks for the response, great plugin
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 05, 2010, 14:55:42 pm
Hi adrian,

I deleted all country and state data from my development version of virtuemart except for UK so I can't test this properly at the moment.

However your config file and my code looks like it should work and not just for the first 9 states. I wonder if it's the code that selects the user info from the database getting the wrong state or more than one state, do you have other states in your db?

Also I notice that your state_2_codes aren't actually two letter codes like there supposed to be (afaik) but I don't know of any reason why that would make a difference but you could try changing them.

You could try changing the code that gets the user info from the db, around line 114:

Code: [Select]
        $q  = "SELECT * FROM #__{vm}_user_info, #__{vm}_country, #__{vm}_state WHERE user_info_id='" . $d["ship_to_info_id"]."' AND ( country=country_2_code OR country=country_3_code) AND ( state=state_3_code OR state=state_2_code)";
to:

Code: [Select]
$q  = "SELECT * FROM #__{vm}_user_info AS u, #__{vm}_country AS c, #__{vm}_state AS s WHERE u.user_info_id='" . $d["ship_to_info_id"]."' AND ( u.country=c.country_2_code OR u.country=c.country_3_code) AND (c.country_id = s.country_id AND (u.state=s.state_3_code OR u.state=s.state_2_code))";
Let me know if it makes any difference.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on July 05, 2010, 20:55:38 pm
thanks for the suggestion ,i changed the code to what u had suggested

this time it seems to work but now its not selecting the proper zone for the selected states appear in zone A.

im yet to try the other suggestion ,im still searching for the code that picks the user data,

will update u
thanks 4 all the help
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 06, 2010, 10:31:22 am
OK,

when I get some spare time I'll install a vanilla copy of virtue mart and see if I can figure it out - no promises on when I'll be able to do it though.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on July 06, 2010, 13:11:41 pm
thanks will be also trying on this side, im sure what is causing this is something very small will probably laugh when we find out
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on July 06, 2010, 19:48:06 pm
HI ALAN

i think i just found out what the problem was , it was in the vm_state table, before my states looked like this
/////////////////

INSERT INTO `mol_vm_state` VALUES(456, 110, 'Kakamega', 'KAK', '8');
INSERT INTO `mol_vm_state` VALUES(457, 110, 'Karatina', 'KRT', '9');
INSERT INTO `mol_vm_state` VALUES(458, 110, 'Karen', 'KAR', '10');
INSERT INTO `mol_vm_state` VALUES(459, 110, 'Kericho', 'KER', '11');
INSERT INTO `mol_vm_state` VALUES(460, 110, 'Kiambu', 'KIA', '12');
INSERT INTO `mol_vm_state` VALUES(461, 110, 'Kikuyu', 'KIK', '13');
INSERT INTO `mol_vm_state` VALUES(462, 110, 'Kisii', 'KIS', '14');
INSERT INTO `mol_vm_state` VALUES(463, 110, 'Kisumu', 'KSM', '15');
INSERT INTO `mol_vm_state` VALUES(464, 110, 'Kitale', 'KIT', '16');
//////////////////////

i changed to this

///////////////

INSERT INTO `mol_vm_state` VALUES(454, 110, 'Embu', 'EMB', 'EMBU');
INSERT INTO `mol_vm_state` VALUES(455, 110, 'Kajiado', 'KAJ', 'KAJIADO');
INSERT INTO `mol_vm_state` VALUES(456, 110, 'Kakamega', 'KAK', 'KAKAMEGA');
INSERT INTO `mol_vm_state` VALUES(457, 110, 'Karatina', 'KRT', 'KARATINA');
INSERT INTO `mol_vm_state` VALUES(458, 110, 'Karen', 'KAR', 'KAREN');
INSERT INTO `mol_vm_state` VALUES(459, 110, 'Kericho', 'KER', 'KERICHO');
/////////////////


for some reason state_2_code was not picking up the states with two digits, so i just changed it to accept upto 20 characters and put the state names, because even when it accepted before it only displayed the number instead of the town name in the shipping order.

thanks a million 4 ur replies they really helped narrow down the issue, iwas almost giving up ,perhaps ill upgrade to ur new ver 1.0

cheers mate
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 07, 2010, 10:12:23 am
Ok,

I see so the problem was that since the state_2_code is supposed to only be two characters so KAJIADO, KAKAMEGA, KARATINA and KAREN would all be seen as KA and so I guess either no state info would be selected or KAJIADO would be selected for any of those states.

I think you'd be better off choosing codes that are 2 chararcters and looking at how to get the state name displayed rather than the state code but if it's working for you as is then I guess it'll be OK.

Leaves me wondering if I still need to modify the sql in the module as I suggested in my earlier post?

Anyway glad it's working for you.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on July 26, 2010, 14:46:36 pm
I have the latest version installed and I'm trying to make 2 zones. One for Australia and one for New Zealand. Zone type is set to country 2 code and the config appears to save correctly. When I re visit the config, none of my zones appear although if I examine the config file they are there. When I test the module the first zone appears to apply regardless of the address so even if the address falls within the second zone the first zone rules are applied. I'm not certain if both those issues are connected but perhaps they are.

Any idea what's happening? If this works it will be a perfect solution for the site I'm working with.

Regards

Andy
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 26, 2010, 14:51:24 pm
Hi Andy,

can post your config file and I'll have a look when I get some time.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on July 27, 2010, 12:08:12 pm
Thanks Alan, here's the config.

if(!defined('POSTCODE')) {
    define('POSTCODE', 1);
    global $POSTCODE_CFG;

    $POSTCODE_CFG = array();

    $POSTCODE_CFG['POSTCODE_VERSION'] = 1;
    $POSTCODE_CFG['POSTCODE_CARRIER_NAME'] = 'Shipping';
    $POSTCODE_CFG['POSTCODE_TAX_RATE'] = '2';
    $POSTCODE_CFG['POSTCODE_ENABLE_DEFAULT'] = 0;
    $POSTCODE_CFG['POSTCODE_DEFAULT_NAME'] = '';
    $POSTCODE_CFG['POSTCODE_DEFAULT_RATE'] = '';
    $POSTCODE_CFG['POSTCODE_NO_ZONE_MESSAGE'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE'] = 'flat';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_AMOUNT'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_TYPE'] = 'none';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_NAME'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_PLURALISE'] = 0;
    $POSTCODE_CFG['POSTCODE_MAX_RATE'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING_OVERRIDE'] = 1;
    $POSTCODE_CFG['POSTCODE_COUNTRY_CHECK'] = 0;
    $POSTCODE_CFG['POSTCODE_COUNTRY'] = 'AF';
    $POSTCODE_CFG['POSTCODE_NOT_COUNTRY_MESSAGE'] = '';
    $POSTCODE_CFG['POSTCODE_ZONE_TYPE'] = 'country_2';
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_PRICES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_ITEMS']=array();
    $POSTCODE_CFG['POSTCODE_OPTIONS']=array();
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Australia', 'text' => 'AU', 'postcodes' => array('AU' => ''), 'rate' => '8', 'free' => '150');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'New Zealand', 'text' => 'NZ', 'postcodes' => array('NZ' => ''), 'rate' => '16', 'free' => '9999');
}


Andy
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on July 29, 2010, 17:36:20 pm
where can i get the latest version
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 29, 2010, 17:40:47 pm
Hi adrian,

i've tried submitting to VMED but no one's got back to me and I've not got any spare time at the moment to chase it up.

Currently the latest version is attached to this post http://forum.virtuemart.net/index.php?topic=57000.msg243053#msg243053 (http://forum.virtuemart.net/index.php?topic=57000.msg243053#msg243053)

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on July 29, 2010, 17:52:37 pm
hi

sorry for the bother i followed the link and all i can see is a download for 0.6 and 0.7 ,i thought 1 is the latest? or is 0.7 the latest?
thanks
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on July 29, 2010, 17:57:58 pm
Hi,

the link in the post above takes you to the post that has version 1.1 attached - just click the link and the post at the top of the page should be the one.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on July 29, 2010, 18:36:03 pm
thanks found it
Title: configurations disappear
Post by: adrian on July 31, 2010, 13:42:10 pm
hi

for some reason when u open the shipping method to adjust the shipping method after u had configured the 1st time, all the fields are empty , so u have to make the changes in the "postcode.cfg.php" file. ive seen this in verio 0.7 and 1.1
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on August 02, 2010, 10:25:23 am
Hi adrian,

Hmmm, I've not come across this before.

Is the config file writeable by joomla? The config page itself will say at the top.

If it is then I'll have to investigate but no one else has reported the same issue.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on August 03, 2010, 01:42:07 am
That's one of the issues I'm having. I can write the config and it appears to save correctly, however when I go back to re-edit it the values have gone. If I open the file to examine it the values appear to be there. That was kinda stage one of my problems.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on August 03, 2010, 10:42:04 am
Hi,

Here's V1.2 of the UK postcode/county/country shipping module.

I found an error when rendering the config page when the Zone Type was set to any thing other than UK Postcode. This I believe is causing the config settings to be saved but not shown when viewed again as reported by andy and Adrian.

Again don't upload the included config file if you want to upgrade and keep your current settings.

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on August 04, 2010, 03:30:59 am
That update has solved the persistance of the conifiguration in the admin but I still cannot get more than one zone to work. Perhaps I have configured the module incorrectly but I create 2 zones, one for Australia and another for New Zealand and only the Australian one works. I've tried to do some testing with other zones and when I attempted to make only one zone for the UK it wouldn't work either. Could it be something to with the address of my store being Australian that it works for that config?

Andy
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on August 04, 2010, 10:39:38 am
Hi,

Here's v1.3 of the UK Postcode/Country/County shipping module that fixes an error in the sql that selects user info from the database.

It wouldn't work if the country contained no states so the address had '-' entered for the state.

@Andy - this was your problem with New Zealand not working.

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: AH on August 04, 2010, 11:03:47 am
Good catch Alanb

There is a taxation issues with countries not having the tax calculated correctly for countries that do have states.  Does your module solve this??
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on August 04, 2010, 11:25:41 am
Hi Andrew,

The sql in question was purely my own in the module - I was selecting ac_vm_user_info with ac_vm_country and ac_vm_state where "state=state_2_code or state=state_3_code" but for countries without states the ac_vm_user_info state would be set to "-" so I had to add "or state='-'".

Are you talking about the tax on the shipping rate as that's the only thing a shipping module could affect?

I've just put a tax rate option in the module's config same as I found in other shipping modules. I suppose it would be possible to add a tax override option for each zone.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on August 04, 2010, 12:12:25 pm
Great work Alan. That "no states" fix worked. There only appears to be one more problem with the current version. I have two zones set up, one for Australia and one for New Zealand. Since there is supposed to be no free shipping to NZ I've entered a value of 99999 as it's unlikely anyone will order this value of products. Unfortunately in testing the NZ (second) zone appears to be regarding the value from the first zone, in this case 150.

Other than that it seems to be working a treat right now.


Regards

Andy
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: AH on August 04, 2010, 15:08:46 pm
Alan


Yes I was referring to the tax on the shipping rate.

There was/is a fault in the original shipping tax calculation in that if you selected a country that had states, the shipping rate was not having the appropriate tax applied to it.  i.e. it was tax free.

Have you tested/tried this and seen the tax updated appropriately?

Some suggest just adding the tax to the shipping rate in the first place, but this is not a solution and the tax amount needs to include any tax related to shipping.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: adrian on August 06, 2010, 17:46:50 pm
thanks will give it a try
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: briannourse on August 09, 2010, 18:32:38 pm
hi

Could not instantiate Class postcode.php

any ideas please
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: briannourse on August 09, 2010, 18:35:01 pm
hi

Could not instantiate Class postcode.php

any ideas please
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on August 11, 2010, 12:11:47 pm
Hi Alan,

Have you had a chance to look into why only the first zone in the current version is being used to calculate free shipping?

Thanks

Andy
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on August 11, 2010, 12:16:12 pm
Hi Andy,

Sorry been snowed under with other work, I'll try and have a look asap.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on August 12, 2010, 01:51:33 am
No probs Alan, I know exactly how that goes.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: BinG on August 12, 2010, 18:09:07 pm
great module, just what i needed, cheers.

is there any way to have it so that the free shipping is activated from the sub total instead of the overall total.

i only want to offer free shipping on the pre-tax amount and not the post tax total.

any help much appreciated
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on August 13, 2010, 10:34:28 am
Hi BinG,

thanks, currently that's not an option.

If/when I get some free time I'll try and add it in.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: maxifus on August 18, 2010, 03:25:50 am
Hi Alan!

Thanks for this awesome module, it is very powerful, just what I was looking for!

I am having some issues that you may be interested:
1.-Configuration saves the country within address must be, but when I load it again it brings back the firs country in the list (Afghanistan)
2.- Can you make the zone configuration work for mixed zones in the full match types? Example: 4500,5000-5100,6000 will make matches for 4500, 5000,5001,5002,...5100 and 6000.
3.-Suggestion: change the module name to WORLD Post code shipping module, because your work is spreading widely :)

Regards,
Max
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on August 18, 2010, 10:12:48 am
Hi Max,

Thanks, good to hear it's usefull.

I've got a heavy work load at the moment but I'll add your requests and problems to the list.

The reason it's UK postcode is because there is some major UK centric assumptions in the handling of postcodes. When I get to work on it again maybe I can add in an option to set whether it uses the UK postcode specific stuff or not.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: maxifus on August 18, 2010, 16:50:34 pm
OK, thanks!
Good luck with your work!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: maxifus on August 20, 2010, 23:43:10 pm
Hi Alan:

I have been trying your work, looks great!
As I suggested previously, I think this module can be improved to work globally!

In my case, I think the ideal would be:
Back-end:
1.- Define you country code logic, example:
First 2(X) characters: State
Second 4(Y) characters: Numeric
Third 0(Z) characters: Ignore (0 means all)
1.- Submit to the joomla database the list of all the codes and cities of your country. States are already there!
2.- Define shipping zones with the new parameters and numerical codes separated with commas, like it is working right now. AA,AB,etc. 5001,5002,etc. Maybe with intervals like 5000-5100
Front-end:
1.- In the user registration, first select your postal code.
2.- Then, in a combo-box the user can select the city or neighborhood covered by that code. the State is selected automagically after.

What dou you think of it?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: Stonedfury on September 01, 2010, 23:01:15 pm
I have looked at several modules for UK and other international shipping. My true issue is the billing/shipping address does not allow for the proper input.

My example is:
Shipping to UK. When selected in the billing information the state/providence/region are not correct. I would like to remove the default drop down and allow someone to input the information manually. Would take too long to get a list of all the areas to post.

Anyone know what file I would modify to set this to blank fill in field for just international?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on September 02, 2010, 10:08:01 am
Shipping to UK. When selected in the billing information the state/providence/region are not correct. I would like to remove the default drop down and allow someone to input the information manually. Would take too long to get a list of all the areas to post.

Anyone know what file I would modify to set this to blank fill in field for just international?

What is it that is not correct?

The country and state info is stored in the database and can be edited via the virtuemart backend, you can add remove and edit countries and states.

If you wanted to change the way the address is captured you'd have to override the default behaviour.

There are other topics in the forum covering some ways to change the region etc but they generally need you to modify core virtuemart files.

The reason country and state are dropdowns rather than free text is that the shipping code uses country and state codes (2 or 3 letter codes) which are what is stored in the address, if you allowed free text entry the shipping code would have to be able to parse UK, england, England, GB, great britain, Great Britain etc as the same thing and also deal with spelling mistakes. The drop downs are much easier to deal with and stop the issue of spelling mistakes.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: RecursiveS on September 15, 2010, 01:28:04 am
Hi. First, thanks to Alan for this much needed add-on.

Have it installed and it works fine for the UK end of things, and correctly displays a message that it is not a Uk postcode if it is not. But it will not then display the second zone that contains the country codes for the EU.

Any thoughts anyone?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on September 15, 2010, 10:21:49 am
Hi RecursiveS,

how have you setup the configuration?

Have you created a second "instance" of the module to handle EU country codes or are you trying to do both in the one module?

If the latter then I guess that's your problem, you need to follow the instructions in the readme to create a copy of the module to handle country codes and set zones up in it. There's no way the module can handle UK post codes and country codes in the same "instance" as you have to tell it to check one or the other.

If you have two instances of the module then you don't want the UK one to display the "not in UK message" as the second one will display an option for those outside the UK.

Not sure what you would do if there are places you don't ship to as neither instance would display a message or an option then, I don't see any easy way to check for that as each instance is totaly seperate and so wouldn't know whether the other instance is going to handle the shipping address.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on September 16, 2010, 13:29:55 pm
Alan,

I seem to have figured out the problem. Some previous efforts to create a free shipping scenario had the free shipping in the store config set to an amount and it was conflicting with your class. Might be worth putting a note in the readme about that if it isn't already there.

Thanks for all the great work

Andy
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on September 16, 2010, 13:58:26 pm
Hi Andy,

Cool, I'll add something to that affect to the readme for the next version (assuming I ever get any free time again - work is piling up here).

Cheers,

Alan
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: shandy on September 27, 2010, 07:15:58 am
My client just dumped on me that they need flat rate for one zone but banded shipping by price for another zone. Luckily it seems like this module can cope if I clone it, however I haven't had any luck. Besides the basic changes shown in the readme file are there any other steps required? Both the original and the clone are enabled in VM and they have their respective config files looking ok.

Thanks

Andy
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on September 27, 2010, 12:55:19 pm
Hi Andy,

If you've followed the instructions correctly then that is all you need to do.

What exactly is going wrong? I take it you have both modules enabled and can see the configuration screen for each?

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on September 27, 2010, 16:43:33 pm
Hi All,

here's version 1.4 of the Postcode/County/Country Zones shipping module.

@shandy - if you haven't got your extra instance working try this update, it handles creating and deleting instances for you (now I have to figure out updating instances but I can leave that to the next version :D)

Change log
----------

Fixed error in the postcode expansion (AA1-3 into AA1,AA2,AA3) that stopped it working.

Fixed error saving user entered strings with a ' (apostraphe) in the config file.

Added new "generic_postcode" Zone Type which doesn't use UK specific postcode matches. Instead added the ability to create new Match Types to control which part of the post code the zone will match on.

Added functionality to create / delete extra module instances to handle different carrier zones or other situations that require seperate configuration options.

Added ability to enable / disable shipping options so you can remove them without deleting them.

Added functionality to only show rate type options for the currently selected rate type.

Cheers,

Alan.

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ironmike on September 28, 2010, 22:00:30 pm
Alan,

Hope this is the solution to my shipping issue. It looks great, but i cant get it to work for my shop (using your 1.4 version icw VM114).

I would like to set up 3 country zones (filled with several countries) with 3 rates and 3 different free shipping ammounts, belonging to each zone. I created 3 zones and filled the "Country codes in Zone" field with the country names i like for that zone (matching the country name as the virtuemart customer info eg. Belgium).

As a result i get the "no zone match" message. I'm not sure what the naming convention is for using the "country codes in zone" field, but i'm trying/using eg Belgium, Belgie and BE in one zone with no result. Please advise,

Regards, marco
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on September 29, 2010, 09:40:23 am
Hi Marco,

If you've set the "Zone Type" to "Country 2 Code" then the zones should contain a list with BE for Belgium or BEL if you chose "Country 3 Code". The list needs to be comma seperated without spaces so for example Austria, Belgium and England in one zone would be "AT,BE,GB" if you chose country 2 codes or "AUT,BEL,GBR" if you chose country 3 codes.

You can see a list of countries and their respective codes in the Virtuemart config under the Admin tab "List Countries".

If you're still having trouble can you copy the postcode.cfg.php file contents and post here.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ironmike on September 29, 2010, 13:48:52 pm
Alan,

Thanks for your quick respons and your help. I understand the convention for country type 2 and country type 3. I created two zones and filled the first with BE and the second with NL. Same result: no zone match message. The "enable default zone" works though. Please find below my config:
---------------------
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die('Direct Access to this location is not allowed.');

if(!defined('POSTCODE')) {
    define('POSTCODE', 1);
    global $POSTCODE_CFG;

    $POSTCODE_CFG = array();

    $POSTCODE_CFG['POSTCODE_VERSION'] = 1.4;
    $POSTCODE_CFG['POSTCODE_CARRIER_NAME'] = 'TNT Post';
    $POSTCODE_CFG['POSTCODE_TAX_RATE'] = '2';
    $POSTCODE_CFG['POSTCODE_ENABLE_DEFAULT'] = 0;
    $POSTCODE_CFG['POSTCODE_DEFAULT_NAME'] = 'Default';
    $POSTCODE_CFG['POSTCODE_DEFAULT_RATE'] = '35';
    $POSTCODE_CFG['POSTCODE_NO_ZONE_MESSAGE'] = 'We do not have a shipping solution at hand for your location, please contact us';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE'] = 'flat';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_AMOUNT'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_TYPE'] = 'none';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_NAME'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_PLURALISE'] = 0;
    $POSTCODE_CFG['POSTCODE_MAX_RATE'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING_OVERRIDE'] = 1;
    $POSTCODE_CFG['POSTCODE_COUNTRY_CHECK'] = 0;
    $POSTCODE_CFG['POSTCODE_COUNTRY'] = 'GB';
    $POSTCODE_CFG['POSTCODE_NOT_COUNTRY_MESSAGE'] = '';
    $POSTCODE_CFG['POSTCODE_ZONE_TYPE'] = 'country_2';
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']=array();
    $POSTCODE_CFG['POSTCODE_MATCH_TYPES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_PRICES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_ITEMS']=array();
    $POSTCODE_CFG['POSTCODE_OPTIONS']=array();
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Netherlands', 'text' => 'NL', 'postcodes' => array('NL' => ''), 'rate' => '2.95', 'free' => '70');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'Belgium', 'text' => 'BE', 'postcodes' => array('BE' => ''), 'rate' => '8.95', 'free' => '100');
}

?>
-----------
Where am i going wrong?

Regards, marco
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on September 29, 2010, 14:16:36 pm
Hi Marco,

I've tested your config and it all works fine for me, the zones trigger for the correct countries.

Have you made any changes to the Virtuemart country list or any other changes to the Virtuemart code that might be confilicting with how my module works?

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ironmike on September 30, 2010, 20:06:31 pm
Hi Alan,

I tracked back to an old version of the site (JM 1.5.8 VM 1.1.2). It worked fine with your module!

I found that the country list in my VM1.1.4 version is missing the colomb "Current zone". But refilled it with the zone shipping module. But with no succes.

Now i've done a clean install of the joomla ecommerce package JM 1.5.14 with VM 1.1.4. and the following happens:

Any clues? Wat version of joomla and VM are you testing on?

Cheers marco
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on October 01, 2010, 10:50:46 am
Hi Marco,

I'm testing on Joomla 1.5.18 and Virtuemart 1.1.4

I had only tested with alternative addresses but I just changed my test user's default address to Belgium/Netherlands and the zones still work from your config so I don't understand what's failing for your default address. Perhaps looking into the database and seeing if there is anything different/wrong about the default address?

The module basically will be selecting the country_2_code field from the the ac_vm_country table where the country field equals the country field in the ac_vm_user_info table entry for that address.

My module doesn't make any use of the default_zone column so I'm not surprised that that didn't make any difference.

When I get some spare time I plan to add a debugging mode to output the details of the address as the module sees it and what matches it's trying etc - maybe that'll help track down what's going wrong if you can't figure it out yourself.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ironmike on October 01, 2010, 21:26:23 pm
Hi Alan,

Thanks for your help sofar. I'm not a coder, but I will look into the DB tables and see if i can find any clues in there. I will continue the challenge and report in this thread if find find something helpfull for the rest of the community.

Kind Regards, marco
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: Camiband on October 06, 2010, 20:51:57 pm
Alan,

First of all I'm a novice.  But I went ahead and installed the shipping module and I'm having a strange problem.  When I add a zone and save, the zone settings don't save. Once I go exit the module and re-enter it my zone settings are lost.  Any ideas?  I re-uploaded the files but get the same results.  Thanks.

Ray
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: dazza_dog on October 08, 2010, 17:32:51 pm
Hi Alan,

Thanks for a great module.

I have read through your documentation and at the moment I have one question.
I ship products by weight. For up to 30Kg it is a flat rate, after that there is an additional charge per kilo.
Is this possible and if so how do I this.

Thanks in advance

Darryn
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on October 08, 2010, 18:07:12 pm
@Ray, Did you enter a name for your zone(s), if no name is entered the program thinks it's a deleted zone and won't save the zone to the config (hmmm - perhaps I should add that info to the config screen and readme). Also are your other settings being saved?

@Darryn, I'm afraid that currently you can't do that easily.

There is the option to use weight bands but you would have to create a band for every kg after 30 to do what you want which is not a sensible option (unless you are happy for it to max out quite quickly or add a lot of bands).

If the charge per extra kg was £1 then you would have to add weight bands like this:

31 = +1
32 = +2
33 = +3
34 = +4 etc and etc.

Maybe if I get some time I'll add this in as an extra option.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: dazza_dog on October 08, 2010, 22:03:35 pm
Hi Alan

Thanks for the reply. I hope you get some free time soon ;D as I think I will have to work out some weight bands, 75% of our shipments are less than 30Kg, 20% are between 30-150Kg and 5% go upto 2.5tonnes, so I might work out some 10Kg bands and then add a call for quote option.

Do you have a mailing list for updates?

Thanks again

Darryn

I've also had an idea.
The ability to exclude zones, my carrier will only give 48hr delivery options to Mainland UK. Out lying areas are 72-96hr and I only have about 20areas that would need to be excluded.

Darryn
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on October 11, 2010, 10:29:35 am
Hi Darryn,

No, I don't have a mailing list for updates, I post everything here, so keeping watch on this topic is the only way at the moment.

Excluding zones from options is possible, I suppose the simplest would be to add a comma seperated list of zone names with the option to either exclude the list or include only the list (that way you only have to enter the smallest list possible). Is that what you're after? I'll add it to my wish list (which isn't very long but free time is at a premium).

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: dazza_dog on October 11, 2010, 14:43:02 pm
Alan

I'll keep on watching - thanks
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ashs on October 14, 2010, 16:06:18 pm
Hello,

I've just spent the day setting up your module and I have to say this is a life saver. The amount of times the sales team here have had to call up people from Scottish highlands, or scilly isles, channel islands etc we have had to charge them more. But now we won't need to!!

I have however spotted what I see as a little bug. Areas in central london have slightly different postcodes: e.g.: EC1A 4AA. This is a slight annoyance if I need to manually put in EC1A, EC1B etc for every outcome.If you could include this in the next version that would be amazing.

Other than that I love this tool. Like I said it's going to be a time & money saver!

I will be personally looking at the code of this to see if I can create an exception. If I succeed I'll post it here for review. Can't wait to see this in the VMED
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on October 14, 2010, 16:11:33 pm
Hi Ashs,

glad you like it and find it useful.

So do you want an expander EC1A-F = EC1A,EC1B,EC1C...EC1F to supplement the current EC1-8 = EC1,EC2,EC3...EC8?

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ashs on October 14, 2010, 17:44:11 pm
Yeah Alan that would be spot on

Thanks,
Ash
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on October 14, 2010, 17:50:00 pm
OK, I'll add it to the wish list

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on October 15, 2010, 12:02:18 pm
Hi Ash,

I'll investigate when I get a chance, but I don't understand why you need the other instances - the AM and Saturday options should work fine in the origianl instance. It might be better going back to one instance and figuring out why the options don't show.

The extra instances are supposed to be if you offer multiple carriers eg Royal Mail and TNT etc.

If you could recreate your original setup and post the config file here I'll investigate the options not appearing also.

Cheers,

Alan.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: Camiband on October 18, 2010, 16:28:17 pm
Hi Alan,

In response to your question:

"@Ray, Did you enter a name for your zone(s), if no name is entered the program thinks it's a deleted zone and won't save the zone to the config (hmmm - perhaps I should add that info to the config screen and readme). Also are your other settings being saved?"

I have named the zones.  Now when I went back in after reading your e-mail, I can't even add a zone.  ??? Also, For Zone Type, what is the difference between Country 2 Code and Country 3 Code and which should I be using? As a reminder, all I'm trying to do is:

$10.99 Flat rate for Non-USA orders
$4.99 Flat rate for USA orders < $100
Free Shipping for USA Orders >$100

Your help is greatly appreciated.  Thank you.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ashs on October 20, 2010, 17:31:07 pm
I think I know why it was only showing the one. My one option is a free shipping option (anything over £2...everything) I'm using the multiple instances and managed to get it working, turns out it was permissions.. I was looking at the wrong file  :-[

I've got this working on our live site, and it works great we've had a good 80 or so orders come through since I installed this on the 14th and only came across the issue with central London addresses (EC1A, EC1B etc)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ecopure on November 16, 2010, 00:11:45 am
Hi Alan,

Forgive me if this has been answered prevously.

Our couriers are citylink. They charge extra for postcode as listed OUTWARD and also some as INWARD.
Clearly this means some outward postcodes do not incur an extra charge - E.G IV11. However the INWARD postcode IV11 8 does incur a charge. How would i configure the module for this? Or do i need to find all the full postcodes for the ones listed as inward and then configure the module?

SECONDLY:
CityLink charge for zone 1 after the base rate of 7.99 for upto 20kg, an extra 0.23p per kg is charged.
However for zone 2 the base rate is 35.20 for upto 10kg, and there after is an extra 1.63 per kg for over 10kg
for zone 3, extra 1.95 etc

How do i charge extra if each zone charge per kg is different? Should i copy postcode to postcode1.php etc for each zone and then configure?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on November 19, 2010, 10:52:02 am
Hi ecopure,

I'm afraid there is no support for what you call the INWARD postcodes (actually that digit is called the postcode sector, the digit and last two charcters together make the inward part of the postcode). Currently you would have to add all full postcodes for that sector.

I'll add that functionalilty to the wish list for the next version that I'm currently working on, however I can't guarantee when I'll get it done as I can only work on it in my spare time at work (which hasn't been much recently).

Also I'm afraid my module won't currently do your second question. I'm already working on adding the functionality which allows 7.99 upto 20kg then +0.23p per kg. Although at the moment it is a instance wide option not a zone option.

Again I'll add the ability to set rate type per zone not just for all zones to the wish list.

So basically you'll have to wait until I can get the next version out before my module will do what you want.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mamasboy on November 20, 2010, 09:39:43 am
Hi,

I don't know why the javascript is not working even though my browser does not disable javascript. I'd tried on FF and Google Chrome on Linux. I tried on Windows using IE and FF too. It would work for awhile in the beginning and then it stop working.

Most of the fields will be saved but the zones will not be saved. Also the form will not load the zone values and the POSTCODE_COUNTRY, I believe.

The only way to edit is to go direct to the postcode.cfg.php file and edit using text editor.

I'm using Ubuntu 10.04 running LAMP on PHP 5.2. My online host I believe is using the same config.

Is that a javascript bug??
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mamasboy on November 22, 2010, 05:00:23 am
Oops.. I was using ver.1 from VirtueMart Extensions Directory (VMED)
http://extensions.virtuemart.net/index.php?option=com_sobi2&sobi2Task=sobi2Details&catid=3&sobi2Id=442&Itemid=2

I got the ver.1.4 from one of the posts here... You guys should update the version at VMED!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on November 22, 2010, 10:55:01 am
Hi mamasboy,

thanks for the heads up, last time I checked it still wasn't published in the VMED yet.

I'll start updating the version there from now on.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ecopure on December 04, 2010, 13:59:28 pm
Hi Alan,

Thanks for your reply..

Thats no problem, i really appreciate what you have done already!!

I have a database of 1.7m full postocodes from the opensource database from OS. If you want help with intergrating it or need a copy for this module let me know..
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: HughesIT on January 05, 2011, 14:12:10 pm
Hi,
I'm fairly new to Virtuemart but very impressed so far. The uK postcode extension looks to be perfect for the project I'm working on but hit a few problems in testing. Below is full info:
Joomla version = 1.5.21
Virtuemart = 1.1.5
The postcode extension is installed and published fine.
I have created 5 zones based on Outward postcodes using the following syntax HP1-25,LU1-19 etc.. etc...
i've also kept things simple by having a flat rate for each zone.
In testing all I get is the 1 line message I created. I've tried a few other things but must be missing something.

Thanks
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 05, 2011, 14:42:57 pm
Hi HughesIT,

I've only used the module on VM 1.1.4 so that could be an issue although I wouldn't have thought so.

Can you post the contents of your postcode.cfg.php file (found in administrator/components/com_virtuemart/classes/shipping directory) and I'll see if there's anything obvious.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mrsjprice on January 06, 2011, 15:35:07 pm
Agh I think I am being really thick.

I want to setup this module so that it gives the buyer free postage when there order is over £60 only in the UK.

Now ere I thought I had done it right but obviously not as it is offering free postage to all countries.

I changed the zone type to country 3 code.

Created a zone at the bottom and put GBR in the Postcodes/States/Country codes box and set the free shipping as 60.00.

Hit save, but yet all countries can get free postage on orders over £60.

So what am I doing wrong?

I am confused..
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 06, 2011, 15:52:48 pm
Hi mrsjprice,

I guess you've not set the "Check address is within country" option - if you set that to United Kingom then this module won't operate for other countries and the free shipping should then apply correctly to only GBR addresses.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mrsjprice on January 06, 2011, 15:57:35 pm
Yep I have ticked that but it is still offering free postage for all countries. hhmm
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 06, 2011, 16:06:42 pm
hmmm indeed, my module shouldn't be offering a shipping choice for any addresses outside of the UK with that option turned on.

Can you paste the contents of the postcode.cfg.php file (found in administrator/components/com_virtuemart/classes/shipping directory) or describe options if you can't.

Also what other shipping modules are you using?

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mrsjprice on January 06, 2011, 16:23:32 pm
I am probably being really thick and its just me, im new to all this virtuemart stuff.

The contents are as follows -

Code: [Select]
<?php
if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die('Direct Access to this location is not allowed.'); 

if(!
defined('POSTCODE')) {
    
define('POSTCODE'1);
    global 
$POSTCODE_CFG;

    
$POSTCODE_CFG = array();

    
$POSTCODE_CFG['POSTCODE_VERSION'] = 1.4;
    
$POSTCODE_CFG['POSTCODE_CARRIER_NAME'] = 'Free Shipping';
    
$POSTCODE_CFG['POSTCODE_TAX_RATE'] = '0';
    
$POSTCODE_CFG['POSTCODE_ENABLE_DEFAULT'] = 0;
    
$POSTCODE_CFG['POSTCODE_DEFAULT_NAME'] = '';
    
$POSTCODE_CFG['POSTCODE_DEFAULT_RATE'] = '';
    
$POSTCODE_CFG['POSTCODE_NO_ZONE_MESSAGE'] = '';
    
$POSTCODE_CFG['POSTCODE_RATE_TYPE'] = 'flat';
    
$POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_AMOUNT'] = '';
    
$POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_TYPE'] = 'none';
    
$POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_NAME'] = '';
    
$POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_PLURALISE'] = 0;
    
$POSTCODE_CFG['POSTCODE_MAX_RATE'] = '';
    
$POSTCODE_CFG['POSTCODE_FREE_SHIPPING'] = '';
    
$POSTCODE_CFG['POSTCODE_FREE_SHIPPING_OVERRIDE'] = 1;
    
$POSTCODE_CFG['POSTCODE_COUNTRY_CHECK'] = 1;
    
$POSTCODE_CFG['POSTCODE_COUNTRY'] = 'GB';
    
$POSTCODE_CFG['POSTCODE_NOT_COUNTRY_MESSAGE'] = 'Your address does not exsist in your selected country.';
    
$POSTCODE_CFG['POSTCODE_ZONE_TYPE'] = 'country_3';
    
$POSTCODE_CFG['POSTCODE_SHIP_ZONES']=array();
    
$POSTCODE_CFG['POSTCODE_MATCH_TYPES']=array();
    
$POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']=array();
    
$POSTCODE_CFG['POSTCODE_RATE_TYPE_PRICES']=array();
    
$POSTCODE_CFG['POSTCODE_RATE_TYPE_ITEMS']=array();
    
$POSTCODE_CFG['POSTCODE_OPTIONS']=array();
    
$POSTCODE_CFG['POSTCODE_SHIP_ZONES'][]=array('name' => 'uk free shipping''text' => 'GBR, GB''postcodes' => array('GBR' => ''' GB' => ''), 'rate' => '''free' => '60.00');
}

?>

I also have the following module enabled -    Standard Shipping Module

Where I have set up the following postages for the UK -

Royal Mail      1st Class Recorded    
Royal Mail    Next day service record

And for europe -
Royal Mail    European Service

These all work as expected.

I have just noticed that if I switch the address back to the UK and go to check out, I get the following postage options -

Please select a Shipping Method!
Free Shipping: uk free shipping: £0.00


    Shipper    Shipping Rate                 Price
   Royal Mail   Next day service           £6.95
   Royal Mail   Royal Mail 1st Class Recorded   £3.95

I don't know where "Free Shipping: uk free shipping: £0.00" has come from as the order I am trying to process is under £60, free postage shouldn't be offered unless under £60.

Man I am confused lol
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 06, 2011, 16:57:32 pm
OK so what's happening is that the Standard Shipping module is giving you the two Royal Mail prices and my module is giving you the Free Shipping choice.

My module is detecting that the address is within the UK and finding the zone you set up for GBR, the free shipping option isn't being triggered as the total is < £60 BUT you haven't set the zones shipping rate so it is calculating a price of £0.

Shipping modules cannot interact with each other so all shipping modules that you have enabled will output their options to choose from.
I think that you might be able to try the following:

1) disable the Standard Shipping Module
2) configure my module:
-- a) set the Carrier name to Royal Mail
-- b) set the zone name to UK Recorded (or something similar)
-- c) set Check Address to UK
-- d) set the Royal Mail 1st Class Recorded price as the zone's shipping rate (3.95)
-- c) set the shipping rate type as appropriate depending on how the shipping price is calculated (by number of items, by total price etc)
-- e) set a shipping option for Next day service that adds 3 to the zone shipping rate
-- f) set the free shipping to £60
3) create a new instance of my module (details in the readme file in the zip) and configure it:
-- a) set the carrier name to Royal Mail
-- b) set it to country 3 code
-- c) add a zone(s) with EU country codes but not UK with correct shipping rate, call it European Service

Although I've not tested it in theory that should mean that when a UK address is entered the original version of my module will trigger and offer:

Royal Mail: UK Recorded: £3.95
Royal Mail: UK Recorded [Next day service]: £6.95

unless the total is £60+ when it should offer:

Royal Mail: UK Recorded [Free shipping]

and if the address is in the EU then the second instance of my module should pick that up and offer

Royal Mail: European Service: £xx

I hope that all makes sense :)

I am working on the next version of the module that adds some new functionality including the ability to create new instances of the module with the click of a button but since I can only work on it during slack time at work I can't guarantee when I get it ready for release.

Good luck with getting your shipping requirements sorted with Virtue Mart - I know what a headache it can be (I found it impossible to satisfy my clients needs before I wrote this module).

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mrsjprice on January 06, 2011, 17:27:29 pm
Ok I have managed to get the european shipping to show, but if the order is over £60 then it offers free delivery (it shouldnt to europe).

And I can't get any of the UK options to show. lol I am hopeless.

If I gave you the login details would you be able to take a look for me? Please :)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mrsjprice on January 06, 2011, 17:33:42 pm
Ok I got it, I need a lis tof UK postcodes. Ha I am so dense.

Thanks very much for your help!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mrsjprice on January 06, 2011, 17:37:02 pm
Ok it is still giving free shipping in the EU countries...
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: swdargyll on January 07, 2011, 11:36:36 am
Hi Alan,
Firstly...great job on this extension, just what I was looking for.
Quick question; is it possible to have separate minimum order values for two zones ?
Scenario: local postode zones with minimum order value of £5.00 for example and any other zones to have minimum order value of £10.00
I may be missing something but it would be great if this is possible.
All the best.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 07, 2011, 11:57:09 am
Hi swdargyll,

I'm not sure what you mean by minimum order value, do you mean that a person cannot order stuff unless they purchase at least £x? If so then that's not built into my module at all.

Can you explain more please.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: swdargyll on January 08, 2011, 16:01:08 pm
Hi Alan,
Thanks for getting back to me.
The customer wants two minimum order levels;
1. 1st zone (local postcode area) - minimum order value £25 - delivery = £5
2. 2nd zone - (anything outside local postcode area) minimum order value £45 - delivery = £10
The overall minimum order value for free delivery = £100 which overrides the others.

I though I might be able to make it work using the price band option ? no luck so far.

If you can follow what I am looking for I wonder if I can achieve this using two separate instances ?

Hope this makes sense :)
Many thanks

Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mrsjprice on January 09, 2011, 00:28:58 am
Have you managed to have a peak at mine yet? I've been racking my brain trying to figure out what other combinations I can do to see if I can get it to work.

But nope nada, free delivery still for eu on orders over £60. Agh!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 10, 2011, 13:33:10 pm
@mrsjprice,

I've just had a look at your site's virtuemart config and I see that the free shipping option is set to £60 so that is why orders over £60 are offering free shipping regardless of country.

I've turned that off for you so now the only free shipping option should be coming from the UK instance of my module.

FYI to get to the VM free shipping option go to Components -> VirtueMart then click on the Store tab and then Edit Store in the left hand menu. Look in the Store Information section for the "Minimum Amount for Free Shipping" setting.

Hope that sorts it out for you.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 10, 2011, 13:45:50 pm
@swdargyll,

I'm afraid that as I stated before my shipping module doesn't have anything to do with minimum order values. I would guess that the minimum order value code is a part of the core of VirtueMart as I would expect it to be checked before the user got to the checkout.

Personally I'd be annoyed if I had added stuff to my basket, gone to checkout, choose my address and only then was told that I hadn't met the minimum order value. Although of course that would be the only way you could have different minimum order values based on the shipping address.

I'm happy to add a minimum order value for each zone to the wish list for the next version of the module but I can't guarentee how soon I'll be releasing the next version.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: swdargyll on January 10, 2011, 13:50:09 pm
Hi Alan,
Appreciate the feedback, I thought as much. To be honest I think most people have just one minimum order value anyway not two :)
Thanks again for your help.
All the best
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: farmboy on January 16, 2011, 20:29:29 pm
Hi Alan

I'd like to add my thanks to all the other expressions of appreciation for the work you've done on this excellent module.

The only thing is that I can't get it to work! Once I've unchecked the default zone setting, all postcodes are coming up with the no zone match message.

I've got Zone Type set to UK Postcode, and Zones A,B,C,D each with outward and area match boxes.
 
I've tried using the billing address and shipping address. Then it struck me: where is the module pulling the postcode from? How does it know that the field is called "zip", and not "postcode"? Or am I completely on the wrong track?

Tom   
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 17, 2011, 10:54:10 am
Hi farmboy,

thank you for the appreciation.

That sounds very odd, VirturMart stores the postcode in the zip field so when the module is set to postcode match it looks at the zip field of the #__vm_user_info record for the currently selected shipping address.

If you post the contents of your postcode.cfg.php file I'll see if I can spot anything obviously wrong with your configuration.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: farmboy on January 17, 2011, 17:17:33 pm
Thanks, Alan.

<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die('Direct Access to this location is not allowed.');

if(!defined('POSTCODE')) {
    define('POSTCODE', 1);
    global $POSTCODE_CFG;

    $POSTCODE_CFG = array();

    $POSTCODE_CFG['POSTCODE_VERSION'] = 1.4;
    $POSTCODE_CFG['POSTCODE_CARRIER_NAME'] = 'UKMail';
    $POSTCODE_CFG['POSTCODE_TAX_RATE'] = '1';
    $POSTCODE_CFG['POSTCODE_ENABLE_DEFAULT'] = 0;
    $POSTCODE_CFG['POSTCODE_DEFAULT_NAME'] = '';
    $POSTCODE_CFG['POSTCODE_DEFAULT_RATE'] = '';
    $POSTCODE_CFG['POSTCODE_NO_ZONE_MESSAGE'] = 'This is the wrong zone!';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE'] = 'weight_band';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_AMOUNT'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_TYPE'] = 'none';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_NAME'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_PLURALISE'] = 0;
    $POSTCODE_CFG['POSTCODE_MAX_RATE'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING_OVERRIDE'] = 1;
    $POSTCODE_CFG['POSTCODE_COUNTRY_CHECK'] = 0;
    $POSTCODE_CFG['POSTCODE_COUNTRY'] = 'GB';
    $POSTCODE_CFG['POSTCODE_NOT_COUNTRY_MESSAGE'] = 'This is the wrong country!';
    $POSTCODE_CFG['POSTCODE_ZONE_TYPE'] = 'uk_postcode';
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']=array('full' => array(), 'outward' => array(), 'area' => array());
    $POSTCODE_CFG['POSTCODE_MATCH_TYPES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_PRICES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_ITEMS']=array();
    $POSTCODE_CFG['POSTCODE_OPTIONS']=array();
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']['outward'][]=array('name' => 'Zone B', 'text' => 'KA1-26,KA29-30,AB1-16,AB21-25,AB30,AB39,PA1-19,PH1-3', 'postcodes' => array('AB30' => '', 'AB39' => '', 'KA1' => '', 'KA2' => '', 'KA3' => '', 'KA4' => '', 'KA5' => '', 'KA6' => '', 'KA7' => '', 'KA8' => '', 'KA9' => '', 'KA10' => '', 'KA11' => '', 'KA12' => '', 'KA13' => '', 'KA14' => '', 'KA15' => '', 'KA16' => '', 'KA17' => '', 'KA18' => '', 'KA19' => '', 'KA20' => '', 'KA21' => '', 'KA22' => '', 'KA23' => '', 'KA24' => '', 'KA25' => '', 'KA26' => '', 'KA29' => '', 'KA30' => '', 'AB1' => '', 'AB2' => '', 'AB3' => '', 'AB4' => '', 'AB5' => '', 'AB6' => '', 'AB7' => '', 'AB8' => '', 'AB9' => '', 'AB10' => '', 'AB11' => '', 'AB12' => '', 'AB13' => '', 'AB14' => '', 'AB15' => '', 'AB16' => '', 'AB21' => '', 'AB22' => '', 'AB23' => '', 'AB24' => '', 'AB25' => '', 'PA1' => '', 'PA2' => '', 'PA3' => '', 'PA4' => '', 'PA5' => '', 'PA6' => '', 'PA7' => '', 'PA8' => '', 'PA9' => '', 'PA10' => '', 'PA11' => '', 'PA12' => '', 'PA13' => '', 'PA14' => '', 'PA15' => '', 'PA16' => '', 'PA17' => '', 'PA18' => '', 'PA19' => '', 'PH1' => '', 'PH2' => '', 'PH3' => ''), 'rate' => '5.99', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']['outward'][]=array('name' => 'Zone C', 'text' => 'AB31-38,AB40-56,IV1-28,IV30-32,IV36,IV40,IV52-54,IV63,KW1-14,PA21-38,PH4-41,PH49-50', 'postcodes' => array('IV36' => '', 'IV40' => '', 'IV63' => '', 'AB31' => '', 'AB32' => '', 'AB33' => '', 'AB34' => '', 'AB35' => '', 'AB36' => '', 'AB37' => '', 'AB38' => '', 'AB40' => '', 'AB41' => '', 'AB42' => '', 'AB43' => '', 'AB44' => '', 'AB45' => '', 'AB46' => '', 'AB47' => '', 'AB48' => '', 'AB49' => '', 'AB50' => '', 'AB51' => '', 'AB52' => '', 'AB53' => '', 'AB54' => '', 'AB55' => '', 'AB56' => '', 'IV1' => '', 'IV2' => '', 'IV3' => '', 'IV4' => '', 'IV5' => '', 'IV6' => '', 'IV7' => '', 'IV8' => '', 'IV9' => '', 'IV10' => '', 'IV11' => '', 'IV12' => '', 'IV13' => '', 'IV14' => '', 'IV15' => '', 'IV16' => '', 'IV17' => '', 'IV18' => '', 'IV19' => '', 'IV20' => '', 'IV21' => '', 'IV22' => '', 'IV23' => '', 'IV24' => '', 'IV25' => '', 'IV26' => '', 'IV27' => '', 'IV28' => '', 'IV30' => '', 'IV31' => '', 'IV32' => '', 'IV52' => '', 'IV53' => '', 'IV54' => '', 'KW1' => '', 'KW2' => '', 'KW3' => '', 'KW4' => '', 'KW5' => '', 'KW6' => '', 'KW7' => '', 'KW8' => '', 'KW9' => '', 'KW10' => '', 'KW11' => '', 'KW12' => '', 'KW13' => '', 'KW14' => '', 'PA21' => '', 'PA22' => '', 'PA23' => '', 'PA24' => '', 'PA25' => '', 'PA26' => '', 'PA27' => '', 'PA28' => '', 'PA29' => '', 'PA30' => '', 'PA31' => '', 'PA32' => '', 'PA33' => '', 'PA34' => '', 'PA35' => '', 'PA36' => '', 'PA37' => '', 'PA38' => '', 'PH4' => '', 'PH5' => '', 'PH6' => '', 'PH7' => '', 'PH8' => '', 'PH9' => '', 'PH10' => '', 'PH11' => '', 'PH12' => '', 'PH13' => '', 'PH14' => '', 'PH15' => '', 'PH16' => '', 'PH17' => '', 'PH18' => '', 'PH19' => '', 'PH20' => '', 'PH21' => '', 'PH22' => '', 'PH23' => '', 'PH24' => '', 'PH25' => '', 'PH26' => '', 'PH27' => '', 'PH28' => '', 'PH29' => '', 'PH30' => '', 'PH31' => '', 'PH32' => '', 'PH33' => '', 'PH34' => '', 'PH35' => '', 'PH36' => '', 'PH37' => '', 'PH38' => '', 'PH39' => '', 'PH40' => '', 'PH41' => '', 'PH49' => '', 'PH50' => ''), 'rate' => '50', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']['outward'][]=array('name' => 'Zone D', 'text' => 'IV41-49,IV51,IV55-56,KA27-28,KW15-17,PA20,PA41-PA49,PA60-PA78,PH42-PH44', 'postcodes' => array('IV51' => '', 'PA20' => '', 'PA41-PA49' => '', 'PA60-PA78' => '', 'PH42-PH44' => '', 'IV41' => '', 'IV42' => '', 'IV43' => '', 'IV44' => '', 'IV45' => '', 'IV46' => '', 'IV47' => '', 'IV48' => '', 'IV49' => '', 'IV55' => '', 'IV56' => '', 'KA27' => '', 'KA28' => '', 'KW15' => '', 'KW16' => '', 'KW17' => ''), 'rate' => '100', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']['area'][]=array('name' => 'Zone A', 'text' => 'AL,B,BA,BB,BD,BH,BL,BN,BR,BS,CA,CB,CF,CH,CM,CO,CR,CT,CV,CW,DA,DE,DH,DL,DN,DT,DY,E,EC,EN,EX,FY,GL,GU,HA,HD,HG,HP,HR,HU,HX,IG,IP,KT,L,LA,LD,LE,LL,LN,LS,LU,M,ME,MK,N,NE,NG,NN,NP,NR,NW,OL,OX,PE,PL,PO,PR,RG,RH,RM,S,SA,SE,SG,SK,SL,SM,SN,SO,SP,SR,SS,ST,SW,SY,TA,TF,TN,TQ,TR,TS,TW,UB,W,WA,WC,WD,WF,WN,WR,WS,WV,YO', 'postcodes' => array('AL' => '', 'B' => '', 'BA' => '', 'BB' => '', 'BD' => '', 'BH' => '', 'BL' => '', 'BN' => '', 'BR' => '', 'BS' => '', 'CA' => '', 'CB' => '', 'CF' => '', 'CH' => '', 'CM' => '', 'CO' => '', 'CR' => '', 'CT' => '', 'CV' => '', 'CW' => '', 'DA' => '', 'DE' => '', 'DH' => '', 'DL' => '', 'DN' => '', 'DT' => '', 'DY' => '', 'E' => '', 'EC' => '', 'EN' => '', 'EX' => '', 'FY' => '', 'GL' => '', 'GU' => '', 'HA' => '', 'HD' => '', 'HG' => '', 'HP' => '', 'HR' => '', 'HU' => '', 'HX' => '', 'IG' => '', 'IP' => '', 'KT' => '', 'L' => '', 'LA' => '', 'LD' => '', 'LE' => '', 'LL' => '', 'LN' => '', 'LS' => '', 'LU' => '', 'M' => '', 'ME' => '', 'MK' => '', 'N' => '', 'NE' => '', 'NG' => '', 'NN' => '', 'NP' => '', 'NR' => '', 'NW' => '', 'OL' => '', 'OX' => '', 'PE' => '', 'PL' => '', 'PO' => '', 'PR' => '', 'RG' => '', 'RH' => '', 'RM' => '', 'S' => '', 'SA' => '', 'SE' => '', 'SG' => '', 'SK' => '', 'SL' => '', 'SM' => '', 'SN' => '', 'SO' => '', 'SP' => '', 'SR' => '', 'SS' => '', 'ST' => '', 'SW' => '', 'SY' => '', 'TA' => '', 'TF' => '', 'TN' => '', 'TQ' => '', 'TR' => '', 'TS' => '', 'TW' => '', 'UB' => '', 'W' => '', 'WA' => '', 'WC' => '', 'WD' => '', 'WF' => '', 'WN' => '', 'WR' => '', 'WS' => '', 'WV' => '', 'YO' => ''), 'rate' => '5.99', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']['area'][]=array('name' => 'Zone B', 'text' => 'DD,DG,EH,FK,G,KY,ML,TD', 'postcodes' => array('DD' => '', 'DG' => '', 'EH' => '', 'FK' => '', 'G' => '', 'KY' => '', 'ML' => '', 'TD' => ''), 'rate' => '5.99', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']['area'][]=array('name' => 'Zone C', 'text' => 'BT', 'postcodes' => array('BT' => ''), 'rate' => '50', 'free' => '');
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']['area'][]=array('name' => 'Zone D', 'text' => 'HS,ZE,IM,JE,GY,IM', 'postcodes' => array('HS' => '', 'ZE' => '', 'IM' => '', 'JE' => '', 'GY' => ''), 'rate' => '100', 'free' => '');
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']['10']='+100';
}

?>

Anything obvious?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: itonic on January 28, 2011, 11:25:35 am
What a fantastic hack! still cant believe its free.
I'm wondering if anyone can help.

I understand that the total weight charged is calculated from a multiple of the base rate, however, is there a way I can just add the base rate to the total cost of weight instead.

ie.

base rate £5 for zone

weight one - 0 - 5kg - £5
weight two - 5 - 10kg - £6
weight three - 10 - 20kg - £8

so the customer orders something at weight two and instead of his total being base x rate = £30 its base + rate = £11

thanks in advance

Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on January 28, 2011, 12:01:08 pm
Hi itonic,

thanks for the praise.

The weight bands (and other bands) can be set to either multiply, divide, add or subtract the bands value to the base rate.

So for your example:

Zone base rate = "10"

Band 1: Minimum = "5" Modifier = "+1"
Band 2: Minimum = "10" Modifier = "+3"

gives exactly what you ask for weight = 3kg, rate = £10; weight = 7kg, rate = £11; weight = 11kg, rate = £13.

I guess if you really want you can set the zone base rate to 5 and create a band with minimum of 0 but it's not needed as the band with minimum of 0 should be the same as the base rate IMHO.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: itonic on January 28, 2011, 16:34:44 pm
Alan = Legend!!

I cant believe it was that easy. in fact I cant believe I missed it.

Thanks again, Keep up the good work



Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: zeebee on February 03, 2011, 08:21:44 am
Hi Alan,
I just wanted to say this is fantastic, I never normally post in forums but I felt with this I simply had to.
Thank you so much for spending the time to create this module. I must admit I started to scratch my head a little during the config but after reading your posts to other users my clients site is now working correctly.
Thank you again,
zeebee
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: chapster5 on February 08, 2011, 19:17:12 pm
Hi Alan,

Great peice of software definatly helping :D

Now I have a problem :( That requires a rather urgent reply if you can.

I have created a modifier called Next Day Deliver and set the modifier to +2.00 now it displays the option of the base rate (5.81) and an option for Next Day (7.81) but when you select the next day option and click next it doesnt add 7.51 to the overall price it just says Shipping & Handling - 0.00 ?

but if I select the base rate (5.81) option it adds 5.81 just fine to the over all price.

Any ideas my friend?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: chapster5 on February 08, 2011, 23:41:32 pm
I think its fixed itself :P Weird huh :/
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 09, 2011, 10:11:45 am
Hi chapster5,

definitely wierd :D

Glad it's working for you.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: uglykidjoe on February 10, 2011, 11:52:34 am
Brillant module

One question I have ended up with quite a lot of shipping options, is there a way to change the radio buttons into a dropdown or be able to separate blocks of options off into sections.

Thanks
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 10, 2011, 12:04:57 pm
Hi uglykidjoe,

I'm afraid that's not possible currently.

You couldn't use a select box method unless my shipping module is the only one enabled as each shipping module outputs it's own radio button(s) to create all the choices for shipping. If however this module was the only one used then I guess it would be possible to change the code to output a select box rather than a list of radio buttons.

As to grouping the radio buttons it would require some code changes to add configuaration options to set the group for each option and then wrap the grouped radio buttons in fieldsets I guess.

I'm rather busy at work at the moment so I can add these options to the wish list but there's no guarantee when I'll be able to devote some time to the next release (which is approx half done at the moment) so I can't tell you when I'll be releasing the next version.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: uglykidjoe on February 10, 2011, 12:26:23 pm
Thanks

The Postcode module is the only one in use...I am trying to use it for a date picker.

The titles for each option are generated using strttime for the titles and have am, pm and any time for two weeks hence.

Could I have an instance for each day (ie 14 days/instances) with it's own am,pm and anytime? I did try this but each instance was not "different" enough so only shows the first one as there is not anything to match.

I could then style each instance of the module to separate it off even with just a <hr/> for testing
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 10, 2011, 13:07:54 pm
Hi uglykidjoe,

I'm not sure about the seperate instance idea, each instance would have to have your zones set up (which isn't too big a problem I guess as you could copy the postcode.cfg.php from the first instance into the ohers to get all your main config and zones set up for each.

But each instance would be offering a plain shipping rate and then any option rates. I suppose if they're set up right the main shipping rate for each instance would basically be one of the options but getting the names of the rates looking correct might be an issue.

Also the instances don't have any wrapping HTML around the radio buttons so you would have to modify the code to add that.

Have you modified the code to do the strttime for the titles?

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: uglykidjoe on February 10, 2011, 13:32:16 pm
Yes I have mofied the titles...

// P4
   $POSTCODE_CFG['POSTCODE_OPTIONS'][]=array('name' => '<b>AM</b> '.$p4, 'modifier' => '+10.00', 'enabled' => true);
    $POSTCODE_CFG['POSTCODE_OPTIONS'][]=array('name' => '<b>PM</b> '.$p4 , 'modifier' => '+10.00', 'enabled' => true);
   $POSTCODE_CFG['POSTCODE_OPTIONS'][]=array('name' => '<b><i>Anytime</i></b> ' .$p4 , 'modifier' => '+0.00', 'enabled' => true);

There is some logic at the top to create a $p4 $p5 etc using strtime the current time etc
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 10, 2011, 14:22:44 pm
OK, that's interesting but be careful because if you save the config through VirtueMart you'll lose any modifications to the postcode.cfg.php file.

Also do you really need Anytime as an option if it doesn't modify the zones base rate?

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: uglykidjoe on February 10, 2011, 15:04:25 pm
Yep found out the hardway regarding the cfg file!!

The anytime option is so a user can pick a delivery date
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 10, 2011, 15:31:06 pm
Right got you, I understand what you're trying to do now - it's an interesting idea.

Do the shipping costs vary depending on the day choosen or only on the am/pm or anytime choice? If they don't then it might be a better idea to modify the actually code to generate the options on the fly.

If you set the config to have just the AM and PM options and then modified the code so that all the code that generated the radio button HTML was wrapped in a for loop then the options for a day would be generated through the loop. You would have to add something to the $rate_id and $option_rate_id to make them unique for each day.

That way you could either wrap each day's output in a fieldset or seperate with a <hr/> within the for loop.

I'd be interested to see what solution you come up if you do get it working with my module.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: uglykidjoe on February 10, 2011, 15:49:11 pm
The prices will change depending on the number of bookings already saved in the DB for a given date - so the transport department don't have loads of orders on any given day, in otherwords the modifier will be dynamic, and will disable an option when a threshold is reached.

Thanks Steve
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 10, 2011, 15:53:58 pm
Whoah - sounds like you'll need to do some serious customisation then to modify the price and availabilty of days/options based on that, you still might be able to do it as I was suggesting above, you'd have to add some code to check availability for that day/option and dynamically modify the price or disable the radio button.

Good luck with getting a working solution.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: uglykidjoe on February 10, 2011, 16:45:30 pm
Well that's the good news I have that bit of coding working
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ecopure on February 11, 2011, 01:05:00 am
uglykidjoe - that sounds a brilliant piece of code - hopefully you will release it when finished??

to all - help! since installing this brilliant module, when my checkout gets to shiping, it disapears to the bottom of the page (almost to the bottom left position)

See photos, any ideas? it didnt do it before the module was installed

[attachment cleanup by admin]
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 11, 2011, 10:17:14 am
Hi ecopure,

It looks like something is making the main content too wide to fit next to the left hand column so it's being pushed down below it.

Is the site on line? It's impossible to tell what's causing it without seeing the HTML and CSS.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ecopure on February 11, 2011, 10:51:22 am
Morning Alan,

The site is indeed live - www.grippatank.co.uk

Just add a product to cart and see what happens. Ive tried it with firebug and can't find the issue (i think im being a bit thick)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 11, 2011, 11:29:30 am
Morning ecopure,

I've had a quick look and you've got some major differences between the Shipping Address step page (page 1 from now on) and the Shipping Method step page (page 2 from now on).

This is probably all down to each page using different css files this is definitely what's causing the width of the main content to be too big on page 2 - 718px on page 1 and 968px on page 2.

Page 1 uses http://www.grippatank.co.uk/templates/nld_050_shop/css/template_blue.css

Page 2 uses http://www.grippatank.co.uk/templates/nld_050_1.5/css/template_blue.css

I also notice that the shopping cart and other boxes in the left hand column aren't displaying correctly which I guess is also down to the wrong css file being used.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: uglykidjoe on February 15, 2011, 13:22:09 pm
Well I got a bit further...

1. Created a PHP module (on all pages) with the following in
Code: [Select]
<script type="text/javascript">


var timerlen = 5;
var slideAniLen = 250;

var timerID = new Array();
var startTime = new Array();
var obj = new Array();
var endHeight = new Array();
var moving = new Array();
var dir = new Array();

function slidedown(objname){
        if(moving[objname])
                return;

        if(document.getElementById(objname).style.display != "none")
                return; // cannot slide down something that is already visible

        moving[objname] = true;
        dir[objname] = "down";
        startslide(objname);
}

function slideup(objname){
        if(moving[objname])
                return;

        if(document.getElementById(objname).style.display == "none")
                return; // cannot slide up something that is already hidden

        moving[objname] = true;
        dir[objname] = "up";
        startslide(objname);
}

function startslide(objname){
        obj[objname] = document.getElementById(objname);

        endHeight[objname] = parseInt(obj[objname].style.height);
        startTime[objname] = (new Date()).getTime();

        if(dir[objname] == "down"){
                obj[objname].style.height = "1px";
        }

        obj[objname].style.display = "block";

        timerID[objname] = setInterval('slidetick(\'' + objname + '\');',timerlen);
}

function slidetick(objname){
        var elapsed = (new Date()).getTime() - startTime[objname];

        if (elapsed > slideAniLen)
                endSlide(objname)
        else {
                var d =Math.round(elapsed / slideAniLen * endHeight[objname]);
                if(dir[objname] == "up")
                        d = endHeight[objname] - d;

                obj[objname].style.height = d + "px";
        }

        return;
}

function endSlide(objname){
        clearInterval(timerID[objname]);

        if(dir[objname] == "up")
                obj[objname].style.display = "none";

        obj[objname].style.height = endHeight[objname] + "px";

        delete(moving[objname]);
        delete(timerID[objname]);
        delete(startTime[objname]);
        delete(endHeight[objname]);
        delete(obj[objname]);
        delete(dir[objname]);

        return;
}

</script>

Changed
Code: [Select]
$_SESSION[$value] = "1";

to

Code: [Select]
$_SESSION[$value] = "1";
            ?><div id="mydiv" style="display:none; overflow:hidden; height:100px; width:600px"><?php

The mydiv for each instance will change eg mydiv1 mydiv2 etc

added to the top of each postcode.cfg.php the mydivs changes for each instances
Code: [Select]
<a href="javascript:;" onmousedown="slidedown('mydiv2');slideup('mydiv');">[+]</a>
<a href="javascript:;" onmousedown="slideup('mydiv2');">[-]</a>


Thanks Steve

Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ecopure on February 15, 2011, 13:26:45 pm
Thanks Alan,
I sort this out now.
How did i miss that?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: CreativeDesigns on February 17, 2011, 14:13:53 pm
Hi all, this sounds like an incredible addition to VM. I've been trying to implement this on my site, however to no avail.
I am in South Africa. here, we have 9 provinces. My client would like that 1 province has a set delivery rate, while the other 8 have a different rate.. So essentially there are really only 2 rates.

From what I understand, this module checks the zone and places a rate against that.
In the "State list for South Africa" I have created all 9 provinces. I have given them each their own State Code (2) and State code (3).
In the Shipping Module Configuration, I have set the Zone type to State 2 Code. No tax rate, Rate Type as a Flat Rate.
2x shipping options have been set - one for local (within the Gauteng province) and one for national (anything outside the gauteng province). Both are checked Enabled.

"This overrides Zone's Free Shipping" radio button is selected.
Check address is within country is checked and South Africa is selected.
Further down under the Zone section, I have set 2 zones:
Local and National.
In the large blocks next to the zone names, I have put in the name of the provinces, as well as the State 2 Codes, as well as a base rate for each.

Unfortunately when an order is placed and you go to the checkout, it asks you to select a shipping method, but doesn't give you anything to select.
I am really stumped. Is anyone able to please shed some light on this? It's urgent :(
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 17, 2011, 14:26:09 pm
Hi CreativeDesigns,

can you post the postcode.cfg.php file and I can check the whole settings.

You're now the 3rd person to post about no choices being offered yet when I checked the other's configs in my dev site I got the correct choice. This is bugging me as there have been a lot of downloads of the module and most posters on here have got it working?!

Cheers,

Alan Brookland
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 18, 2011, 15:52:32 pm
Hi all,

just a heads up that I've updated the module on the VMED to version 1.5 which adds new functionality for setting a black/white list for products for each zone to disallow sending proscribed products to customers in certain areas.

This modification was requested and paid for by Ellmore Consultancy, http://www.ellmoregroup.com.

No need to upgrade unless you want the new functionality.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: jochenwe on February 22, 2011, 11:44:11 am
Hi Alan,

great work you have done, compliments for your skills!!

Maybe you have ideas for my "problem", too.
I have read all the thread and searched the forum,
and did not find a solution, yet.

I have different categories, each one is from a different producer,
and needs different shipping details, based on weight bands.

To be more clear, every brand (category) is shipped by a different carrier,
and with different weight bands and relative costs.
This is because we don't do the shipping, but the producers do it.

The questions to resolve are:
- when I buy 1 product, automatically the right carrier should be chosen by virtuemart.

- when I have more products from different brands (categories) in the cart,
I need to have all products from the same category grouped (with seperate weight addition for each category)and automatic assignment to the specific carrier.

Hoping to have explained the issue, my questions are:
I think I have to connect to each category or producer a different module.
Is this possible and, if yes, how to proceed?
Could this be an idea for your wish list?

Thanks for your help and/or advices,
Jochen
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 22, 2011, 12:12:58 pm
Hi Jochen,

The latest version (1.5) of my module allows you to set allowed products for zones so you could probably setup different instances of my module to handle the different categories but only if products from the same category are in the basket.

This approach wouldn't be able to handle more than one category of product in the same basket due to there's no way different shipping modules can interact as each shipping module can only output radio button choices to allow the customer to choose between the different shipping methods. This would only work then if you made it clear that only one category of product can be purchased at a time but you wouldn't be able to stop customers adding products from multiple categories and would only be able to inform the customer on the shipping choice part of the checkout. This would be a far from perfect user experience.

To get it to work how you want you would need one shipping module that could handle all product categories and worked out the shipping for the different categories. It might be possible to modify my module to work like that but it would require quite a lot of work to handle the configuration and zones for the different carrier/categories and then modify the calculation code to group the products and work out the rate for each group adding the seperate rates into one total rate outputting the final total shipping rate as the shipping option (probably with a detailed breakdown of Carriers and sub totals shown).

Sorry I can't offer simple answer,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mx5gr on February 24, 2011, 14:13:06 pm
Great module, indeed !!!

I have been trying to configure it to ship only within Greece and with two postal zones. If within the Attica region then charge 5 Euros, if outside Attica then charge 8 Euros, irrespective of product number and weight.

I have created the new zones within the module and I have enabled the country check as well. Alas, it does not work! Neither the user's country or postcode are recognised and the module's logic does not work. If I disable the country check and enable the default zone, then it works.

Inspecting the source of postcode.php, I found that the variables

Code: [Select]
        $dest_country = $db->f("country_2_code");
        $dest_postcode = $db->f("zip");

are not populated (around line #73) thus the module inoperability.

Any help?

My postcode.cfg.php is the following:

Code: [Select]
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die('Direct Access to this location is not allowed.');

if(!defined('POSTCODE')) {
    define('POSTCODE', 1);
    global $POSTCODE_CFG;

    $POSTCODE_CFG = array();

    $POSTCODE_CFG['POSTCODE_VERSION'] = 1.5;
    $POSTCODE_CFG['POSTCODE_CARRIER_NAME'] = 'Speedex';
    $POSTCODE_CFG['POSTCODE_TAX_RATE'] = '2';
    $POSTCODE_CFG['POSTCODE_ENABLE_DEFAULT'] = 1;
    $POSTCODE_CFG['POSTCODE_DEFAULT_NAME'] = 'Attica';
    $POSTCODE_CFG['POSTCODE_DEFAULT_RATE'] = '5';
    $POSTCODE_CFG['POSTCODE_NO_ZONE_MESSAGE'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE'] = 'flat';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_AMOUNT'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_TYPE'] = 'none';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_NAME'] = '';
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHT_PLURALISE'] = 0;
    $POSTCODE_CFG['POSTCODE_MAX_RATE'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING'] = '';
    $POSTCODE_CFG['POSTCODE_FREE_SHIPPING_OVERRIDE'] = 1;
    $POSTCODE_CFG['POSTCODE_COUNTRY_CHECK'] = 0;
    $POSTCODE_CFG['POSTCODE_COUNTRY'] = 'GRC';
    $POSTCODE_CFG['POSTCODE_NOT_COUNTRY_MESSAGE'] = 'We can only ship within Greece';
    $POSTCODE_CFG['POSTCODE_NOT_ALLOWED_MESSAGE'] = '';
    $POSTCODE_CFG['POSTCODE_NOT_ALLOWED_LIST'] = '0';
    $POSTCODE_CFG['POSTCODE_ZONE_TYPE'] = 'generic_postcode';
    $POSTCODE_CFG['POSTCODE_SHIP_ZONES']=array('full' => array());
    $POSTCODE_CFG['POSTCODE_MATCH_TYPES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_WEIGHTS']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_PRICES']=array();
    $POSTCODE_CFG['POSTCODE_RATE_TYPE_ITEMS']=array();
    $POSTCODE_CFG['POSTCODE_OPTIONS']=array();
$POSTCODE_CFG['POSTCODE_SHIP_ZONES']['full'][]=array('name' => 'Inside Attica', 'text' => '10000-19999', 'postcodes' => array('10000' => '', '10001' => '', '10002' => '',......., 'rate' => '5', 'free' => '', 'allowed_type' => 'disabled', 'allowed_ids_text' => '', 'allowed_ids' => array());
$POSTCODE_CFG['POSTCODE_SHIP_ZONES']['full'][]=array('name' => 'Outside Attica', 'text' => '20000-99999', 'postcodes' => array('20000' => '', '20001' => '', '20002' => '',......., 'rate' => '8', 'free' => '', 'allowed_type' => 'disabled', 'allowed_ids_text' => '', 'allowed_ids' => array());

I have amended the postcode arrays as they are quite large in length...
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 24, 2011, 14:59:40 pm
Inspecting the source of postcode.php, I found that the variables

Code: [Select]
        $dest_country = $db->f("country_2_code");
        $dest_postcode = $db->f("zip");

are not populated (around line #73) thus the module inoperability.

Looks like the database query is erroring. The query is constructed a few lines above:

Code: [Select]
        $db =& new ps_DB;
        $q  = "SELECT * FROM #__{vm}_user_info, #__{vm}_country, #__{vm}_state WHERE user_info_id='" . $d["ship_to_info_id"]."' AND ( country=country_2_code OR country=country_3_code) AND ( state=state_3_code OR state=state_2_code OR state='-')";
        $db->query($q);

You can check $db for errors with something like this or how ever you debug your code (I use Eclipse with xdebug on my dev system):

Code: [Select]
        echo "Query:<br/>$db->_sql<br /><br />Err No:<br />$db->errno<br /><br />Error Message:<br />$db->error";

Let me know if I'm right.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mx5gr on February 24, 2011, 15:06:47 pm

You can check $db for errors with something like this or how ever you debug your code (I use Eclipse with xdebug on my dev system):

Code: [Select]
        echo "Query:<br/>$db->_sql<br /><br />Err No:<br />$db->errno<br /><br />Error Message:<br />$db->error";

Let me know if I'm right.

Cheers,

Alan.

Hi Alan,

Thank you for the immediate response.

Just checked with the echo string you provided. The response is :

Code: [Select]
Query:
SELECT * FROM #__vm_user_info, #__vm_country, #__vm_state WHERE user_info_id='0a6c882405ebb7b0cd9e09b7e6503b18' AND ( country=country_2_code OR country=country_3_code) AND ( state=state_3_code OR state=state_2_code OR state='-')

Err No:
Error Message:

Thus no errors are reported. The inoperability surely has to do with this SQL query and/or variable handling, as if I pass fixed values to $dest_country & $dest_postcode (immediately below) then the module works fine.

What could cause this, as no errors are reported?
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 24, 2011, 15:11:22 pm
I guess the only thing left to look at is what are the actually values coming back from the query so try adding the following code after the variables are set.

Code: [Select]
        echo "Dest contry = '$dest_country', Dest postcode = '$dest_postcode'";

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mx5gr on February 24, 2011, 15:30:57 pm
I guess the only thing left to look at is what are the actually values coming back from the query so try adding the following code after the variables are set.

Code: [Select]
        echo "Dest contry = '$dest_country', Dest postcode = '$dest_postcode'";

Cheers,

Alan.

Here you are:

Dest country = '', Dest postcode = ''

Hence, the query returns null values..
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 24, 2011, 15:39:52 pm
So I suppose the only possibility is that the query is not matching on user_info_id='0a6c882405ebb7b0cd9e09b7e6503b18'.

Can you check in your database and find that entry in ac_vm_user_info? If so what happens if you run the query directly on the database (assuming you can do so)

Code: [Select]
SELECT * FROM ac_vm_user_info, ac_vm_country, ac_vm_state WHERE user_info_id='0a6c882405ebb7b0cd9e09b7e6503b18' AND ( country=country_2_code OR country=country_3_code) AND ( state=state_3_code OR state=state_2_code OR state='-')
You'll have to change the ac_ part of the table names if you didn't use the default prefix when setting up joomla.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mx5gr on February 24, 2011, 16:05:26 pm
The query

Code: [Select]
SELECT * FROM ac_vm_user_info, ac_vm_country, ac_vm_state WHERE user_info_id='0a6c882405ebb7b0cd9e09b7e6503b18'

returns 109,760 hits with the same details for the user_info_id='0a6c882405ebb7b0cd9e09b7e6503b18'

The columns shown include "country" and "zip" columns.

Here is an abridged list of a CSV export for the above query results:

Code: [Select]
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Afghanistan";"AFG";"AF";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Albania";"ALB";"AL";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Algeria";"DZA";"DZ";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"American Samoa";"ASM";"AS";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Andorra";"AND";"AD";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Angola";"AGO";"AO";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Anguilla";"AIA";"AI";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Antarctica";"ATA";"AQ";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Antigua and Barbuda";"ATG";"AG";"1";"223";"Alabama";"ALA";"AL"
"0a6c882405ebb7b0cd9e09b7e6503b18";"63";"BT";"-default-";;"Mr";"John";"Doe";;"2101324567";;;"32, Test st";;"Athens";" - ";"GRC";"15555";"info@test.com";NULL;NULL;NULL;NULL;NULL;"1297687439";"1298476183";"storeadmin";;;;;;;"1";;;"1";"1";"Argentina";"ARG";"AR";"1";"223";"Alabama";"ALA";"AL"

The query you sent:
Code: [Select]
SELECT * FROM ac_vm_user_info, ac_vm_country, ac_vm_state WHERE user_info_id='0a6c882405ebb7b0cd9e09b7e6503b18' AND ( country=country_2_code OR country=country_3_code) AND ( state=state_3_code OR state=state_2_code OR state='-')

returns no results within phpMyAdmin (with corrected table prefixes of course)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 24, 2011, 16:28:23 pm
Ok found the problem,

the state for you is set to " - " but my query is checking for "-" (which is what the state is set to for me when a state hasn't been set) I guess I need a more fool proof way of covering the situation where a state hasn't been selected.

To get the module working change the code to:

Code: [Select]
        $q  = "SELECT * FROM #__{vm}_user_info, #__{vm}_country, #__{vm}_state WHERE user_info_id='" . $d["ship_to_info_id"]."' AND ( country=country_2_code OR country=country_3_code) AND ( state=state_3_code OR state=state_2_code OR state='-' OR state=' - ')";
Hope that fixes it for you,

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on February 24, 2011, 17:02:57 pm
Hi all,

I've just done updated the module on the VMED to V1.51 with the following fixes:

Fixed error in sql selecting users shipping info where in some versions of VirtueMart the state field is set to " - " if a state is not selected instead of "-".

Fixed error where destination postcode was set in the description of the shipping rate even when match type was set to county or country code.

Added code to strip spaces from comma seperated lists which otherwise would cause items not to match.

Added javascript to validate the modifier parameters to highlight invalid user input.

Hopefully this fixes all the recent posts about no shipping options except default zone etc.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: mx5gr on February 24, 2011, 17:44:52 pm
Ok found the problem,

the state for you is set to " - " but my query is checking for "-" (which is what the state is set to for me when a state hasn't been set) I guess I need a more fool proof way of covering the situation where a state hasn't been selected.

To get the module working change the code to:

Code: [Select]
        $q  = "SELECT * FROM #__{vm}_user_info, #__{vm}_country, #__{vm}_state WHERE user_info_id='" . $d["ship_to_info_id"]."' AND ( country=country_2_code OR country=country_3_code) AND ( state=state_3_code OR state=state_2_code OR state='-' OR state=' - ')";
Hope that fixes it for you,

Cheers,

Alan.

Alan, you're great!

Worked like a charm!

Thank you again for the immediate support!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: TWD-Tony on March 04, 2011, 13:44:04 pm
Hi Alan, great shipping module you have created - spot on!

A quick question... Is there an easy way of stopping the module from working for order less than xxx in weight?
Basically I don't want to offer delivery (only collection) for small orders so I need to be able to say "if total weight < xxx don't offer delivery" or "if order >xxx offer delivery" (which ever is the easiest)????

There is already a built in check for postcode and country but not for weight, I don't mind hacking the code to add a simple switch..

Thanks!
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on March 04, 2011, 14:12:55 pm
Hi Tony,

first off thanks.

Adding in code to check the delivery weight or cost and not offer a shipping rate is easy however you will need to look at how it's going to work when you don't offer delivery.

I guess the module could output a "shipping option" that said something like "Pick up in store" with the shipping rate set to 0.

I would suggest you add the check near the start of the list_rates() function (line 83 or so). $d['weight'] contains the total weight for the order, $d['zone_qty'] contains the number of items in the order. $total is the cost for the order, $tax_total is the tax for the order.

The lines starting from 343 sets up the shipping option radio button html - I'd copy that and modify it to read as you want then echo out and return.

So pseudo code would be:

initial lines in list_rates() that get info...
Check country code...

if(weight < X) {
    create radio button html for "Collect in Store" option
    echo $radio_button_html;
    return;
}

switch that gets zone match
rest of code....

Hope that makes sense and helps,

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: TWD-Tony on March 04, 2011, 14:20:16 pm
Thanks Alan, I already have a "store pickup" option which is available for any order no matter how big or small, I just need your postcode module to show on orders over xxx weight. I can add in some text on the delivery options page showing "if delivery isn't available then you have not qualified" (or something similar)

Thanks

Tony
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on March 04, 2011, 14:28:23 pm
Hi Tony,

Ah right - so in that case it's just a matter of adding in the check for the minimum weight at the start and just returning without outputing a shipping option at all.

Cheers,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: alanB on March 04, 2011, 14:30:31 pm
Hi all,

I've created a new thread for this module as this has become so long and I hijacked someone elses thread in the first place.

Please can you start posting on http://forum.virtuemart.net/index.php?topic=82598.0 (http://forum.virtuemart.net/index.php?topic=82598.0).

Thanks,

Alan.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: TWD-Tony on March 05, 2011, 10:27:52 am
In case anyone needs to know how to disable the UK postcode module for order totals under a certain weight, this is how I did it:

Around line 84 in postcode.php add:

if($d['weight'] <250) {
      echo 'error message';
      
      return false;
      }

Just change <250 to whatever weight threshold you wish to set and change the error message to some text you want to display to tell the customer that the weight of their order does not qualify them for delivery...
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: ljr3233 on March 15, 2011, 01:16:49 am
Alan thanks for the shipping module you have created.
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: kleinbaas on April 19, 2011, 01:03:51 am
There was/is a fault in the original shipping tax calculation in that if you selected a country that had states, the shipping rate was not having the appropriate tax applied to it.  i.e. it was tax free.

Hi Alan and all

Was this tax issue ever fixed. I just tried out this extension, but alas no tax is being applied to shipping.

I spent all of Saturday getting tax to work on shipping (on the standard shipping module). The only way I got it to work was to force the user to select/enter a shipping address (removing the option to select same as billing address).

But even with this, I cant get tax to be added when using this extension.

Any ideas anyone?

Thanks
Al
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: IEdwards on January 09, 2012, 16:39:16 pm
AlanB I just wanted to post my thanks for offering this module. I have downloaded and installed on a test site and it appears to do everthing I needed. My main problem was seperating Northern Ireland shipping from the rest of the UK and I can do this with your mod using the "state" filter.

Thanks again.

Ian
estm.co.uk (http://estm.co.uk)
Title: Re: New UK Post code shipping module, needs ideas for a wish list
Post by: admiss on January 12, 2014, 16:16:21 pm
This module sounds great, and it would almost solve my problem. Unfortunately, it is compatible with VM 1.1 - I use VM 2.0
I'm looking for Royal mail shipping module, for VM 2.0, Joomla 2.5
It's a little bit irritating, that RM shipping module is worked out for e.g. Wordpress, Magento, Zen-cart, Osscommerce, Woocommerce, WP Ecommerce - but nothing for VIRTUEMART 2.0 or Joomla 2.5  >:(