Regions

Contrib type: 
Module
Status: 
awaiting

Downloads

Compatibility: 
Ubercart 1.x

Helper module for the world quotes module.

Allows you to define regions which are one or more countries.

installation instructions:
unzip into modules/ubercart/shipping/

configuration is under home>administer>store administration>configuration>methods

PreviewAttachmentSize
uc_regions.zip4.06 KB
zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1195
Re: Regions

Hi, thanks for this module !

I have errors on install : see worldquote post

Edit :

In addition, I think there is a little error in your .install file :

you have db_query("CREATE TABLE {uc_wolrdquote_regions}

it should be db_query("CREATE TABLE {uc_regions} ( no ?

I tried to change it, but it doesn't remove the SQL error on the linked post.

Edit 2 : I find the problem for the worldquote module, but I think the patch to make above is still active no ?

arbel's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 08/12/2007
Juice: 331
Re: Re: Regions

yeh, the install had a small bug, updated the zip file...I don't quite understand the edit 2.

Idan

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6855
Regions module review

Regions module review
This is just based on looking at the code. I haven't actually installed or tested it yet. That said, it looks like it should work properly. Good job.

Things to fix:

  • Table name in uc_regions_install() is 'uc__regions', should have only one underscore.
  • The calls to db_query() on lines 182 and 193 are open to an SQL Injection Attack. Parameterize the data.
  • The unit conversion constants are define()d in uc_store.module, and do not need to be here.
  • MENU_CALLBACK_ITEM is not defined, MENU_CALLBACK is. My fault for writing modules that way before.
  • I think it's a good idea to remove the version and CVS information added by Drupal in the .info file. We've had version confusion because of that.
  • Please style the code according to the Drupal coding standards. Specifically, use two spaces instead of tabs to indent code. This keeps indentations consistent across text editors.
  • Remove extra files from the .zip archive (.M, .php). I was a little confused by them. *shrug*
arbel's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 08/12/2007
Juice: 331
Re: Regions module review

thanks, like with the worldquote, updated everything other than the sql injection thing...need help sorting that out.

intersol's picture
Offline
Bug Finder
Joined: 10/04/2007
Juice: 35
Re: Re: Regions module review

The modules does not create database tables on alpha7e

Still no error is reported at install time.

After converting line endings to Linux style (from WIN), diabling module, uninstalling module, installing again it seams to work.

Seams to me line-ending problem. Switching to LINUX stype wold resolv the problem for all platforms.

arbel's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 08/12/2007
Juice: 331
Hi, I'm really not sure what

Hi,

I'm really not sure what that means, a bit of an amature coder...

I've updated the file with a new version, fixed sql injection risk.

Let me know what you think and if there are any bugs, and i'll fix them asap.

Idan

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6855
Re: Hi, I'm really not sure what

Traditionally, files created and used by DOS and Windows used "\r\n" to denote line endings (carriage return + new line). Unix used "\n", and Macintosh used "\r".

Decent text editors will let you change which characters are used when you hit the Enter key. Programmers are nearly always taught to use "\n" as the newline, and it's become the standard for multi-platform applications. Like Drupal. Smiling

arbel's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 08/12/2007
Juice: 331
Re: Re: Hi, I'm really not sure what

I used dreamweaver to edit this...i'll take a look and see if I can file that setup somewhere.

yhager's picture
Offline
Joined: 10/01/2007
Juice: 59
Missing CSS

On line 44 of the module you have:

    drupal_add_css(drupal_get_path('module', 'uc_regions') .'/uc_regions.css');

There is no such file in the distribution, and all this works without any error, until you try and use the mimemail.module, which assume all the files added by 'drupal_add_css()' exists - and an error is generated.

While mimemail.module needs to do better checks against the file system, I suggest to remove that line if the CSS file does not exist.

CpILL's picture
Offline
Early adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/08/2007
Juice: 550
Re: Regions

I was having problems just entering a value in the regions. I looked at the code and the form seemed to be a 'multistep' form but there was only one step. Drupals handling of multi-step forms is ... problematic as I found out doing the 'uc_import_csv' module so changed it to a simple form, added a TAPIr table and some other little bits and pieces. My version is attached. Perhaps you can merge with the main version if you like it.

Also, the uc_regions table is a bit ugly in that the 'countries' column should be replaced with its own table which would just be a join between the 'uc_countires' table and the 'uc_regions' table.

This module needs some cleaning up database wise. I hope my changes are a step in the right direction.

AttachmentSize
uc_regions.module 9.57 KB

Uberdevelopment www.tsd.net.au/blog

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4111
Re: Re: Regions

Hey guys, I wanted to download this contrib, but the .module file is nothing but this:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /files/uc_regions.module
on this server.</p>
<hr>
<address>Apache Server at www.ubercart.org Port 80</address>
</body></html>

Halp! Smiling

--
Help directly fund development: Donate via PayPal!

CpILL's picture
Offline
Early adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/08/2007
Juice: 550
Re: Re: Re: Regions

Looks like the ubercart.org site is not letting you download it Sad Maybe Ryan has something to say about it?

Uberdevelopment www.tsd.net.au/blog

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15453
Re: Re: Re: Re: Regions

It's Drupal's .htaccess. If you could zip that up and reattach it to your comment, it should be fine.

CpILL's picture
Offline
Early adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/08/2007
Juice: 550
Re: Re: Re: Re: Re: Regions

Thanks Ryan, will do. See attachment. I also added a verion number to make tracking bugs easier.

AttachmentSize
uc_regions_v1.0.zip 5.48 KB

Uberdevelopment www.tsd.net.au/blog

hedac's picture
Offline
Joined: 12/14/2007
Juice: 144
very nice the regions a bug

very nice the regions

a bug I have is that editing a region doesn't edit it but adds another new region.

hedac's picture
Offline
Joined: 12/14/2007
Juice: 144
Re: very nice the regions a bug

oh that seemed a small bug but it is big.. because I updated a region adding a country... it created a new region... so I said.. ok let's delete the previous one since the name is the same... but it didn't work... because the calculations are based on the ID of the region not on the displayed name... so I had to change the ID in the database manually to be the same as in the worldquote settings. That wouldn't have been a problem if editing a region edits it without adding a new one...

rolandk's picture
Offline
Joined: 02/06/2008
Juice: 240
Any update on this ?

Has there been any update on this ? Which version of uc_regions should we install ?

half_brick's picture
Offline
Joined: 02/04/2008
Juice: 82
V3

Well if you would like to be somewhat of a guinea pig Smiling you can install this version.
I've replaced the pipe separated countries field with a join table.
If you notice any bugs that you can't/don't want to fix, let me know and i'll try to correct them.

Is this module in CVS yet? I haven't really gotten into contributing on CVS, but if it hasn't been done I could have a go.

AttachmentSize
uc_regions_v3.zip 5.11 KB
rolandk's picture
Offline
Joined: 02/06/2008
Juice: 240
Re: V3

guinea pig is my middle name. Thanks ! Can we also re-enable the older stable version please ?

mccraic's picture
Offline
Joined: 11/05/2007
Juice: 62
Defining Regions

Hello,

Is it possible to define a region that consists of states instead of countries? I need to set up shipping costs based on quantity (or weight if necessary), state where the order will be shipped and type of shipping (air or ground). Multiple states fall into the same shipping rate so I would like to set up different regions which contain the one or more states. For example

Region1 = CA
Region2 = OR,NV
Region3 = AZ,CO,ID,MT,NM,WA,WY

Ground
Qty Region1 Region2 Region3
1 $12.62 $12.99 $13.16
2 $13.45 $14.21 $14.50
3 $14.67 $15.33 $15.67

Air
Qty Region1 Region2 Region3
1 $14.35 $16.80 $17.50
2 $18.00 $21.95 $22.65
3 $21.80 $27.25 $28.00

Thanks for your help,

Patrick

Bartezz's picture
Offline
Joined: 04/18/2008
Juice: 104
Re: Re: very nice the regionsa bug

I can confirm this bug... and tested the v3.zip (http://www.ubercart.org/contrib/850#comment-12359) which doesn't save the regions in the database at all?!?!

Hmmz better do some phpmyadmin changes for now...

dbzoo's picture
Offline
Joined: 11/30/2008
Juice: 2
Re: Re: Re: very nice the regionsa bug

Yep I noticed a few bugs in the uc_region_v3.zip code. I've fixed what I've found.

AttachmentSize
uc_regions_v3.1.zip 4.09 KB
ragavendra_bn's picture
Offline
Joined: 01/10/2009
Juice: 68
Re: Re: Re: Re: very nice the regionsa bug

Is the D6 version of this module availaible............