Author Topic: New UK Post code shipping module, needs ideas for a wish list  (Read 91355 times)

asphole

  • Beginner
  • *
  • Posts: 20
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #30 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.

asphole

  • Beginner
  • *
  • Posts: 20
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #31 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)

asphole

  • Beginner
  • *
  • Posts: 20
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #32 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!

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #33 on: May 07, 2010, 12:06:06 pm »
can you maybe share your hack? Im not using weight option but others might need.

cheers

alanB

  • Jr. Member
  • **
  • Posts: 101
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #34 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

heywood79

  • Beginner
  • *
  • Posts: 8
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #35 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

alanB

  • Jr. Member
  • **
  • Posts: 101
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #36 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.

alanB

  • Jr. Member
  • **
  • Posts: 101
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #37 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]

asphole

  • Beginner
  • *
  • Posts: 20
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #38 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!

alanB

  • Jr. Member
  • **
  • Posts: 101
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #39 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]

asphole

  • Beginner
  • *
  • Posts: 20
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #40 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?

alanB

  • Jr. Member
  • **
  • Posts: 101
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #41 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.

asphole

  • Beginner
  • *
  • Posts: 20
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #42 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!

alanB

  • Jr. Member
  • **
  • Posts: 101
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #43 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]

asphole

  • Beginner
  • *
  • Posts: 20
Re: New UK Post code shipping module, needs ideas for a wish list
« Reply #44 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?