Latest News: (loading..)
Alpha Ray

UK-Based: Default osCommerce Installation.

150 posts in this topic

UK-BASED, DEFAULT OSCOMMERCE INSTALLATION.

 

For osCommerce 2.2 Milestone 2 (12th July 2003).

 

Wouldn't it be great if the default osCommerce installation is configured for UK businesses by default?

 

What about UK address layout?

What about UK date format?

What about the missing UK Counties, currency and VAT example?

 

Please Note:

This package is intended to be a UK-Based osCommerce DEFAULT installation and NOT a "loaded" installation.

This allows users to have the freedom of choosing their own contributions without additional compatibility problems.

 

Features:

- Added UK counties of England, Wales, Scotland, Northern Ireland and Channel Islands.

- UK date format for Admin section.

- UK date format for Catalog section.

- UK address layout in create_account.php, address_book_process.php and checkout_shipping_address.php

- Updated date format related error constants.

- Added British Currency (default).

- Updated the sample catalog's price database.

- VAT.

- VAT zones.

 

Screenshots are also included.

 

In addition, this original osCommerce 2.2 bug is fixed.

http://www.oscommerce.com/community/bugs,1426/search,country

 

Installation:

Replace the US based installation files with the UK based files included in this package.

Install osCommerce in the usual manner.

 

Contribution Package: http://www.oscommerce.com/community/contributions,2816

 

All UK related questions, comments and suggestions are welcome.

Edited by Alpha Ray

Share this post


Link to post
Share on other sites
UK-BASED, DEFAULT OSCOMMERCE INSTALLATION.

 

For osCommerce 2.2 Milestone 2 (12th July 2003).

 

Wouldn't it be great if the default osCommerce installation is configured for UK businesses by default?

 

What about UK address layout?

What about UK date format?

What about the missing UK Counties, currency and VAT example?

 

Please Note:

This package is intended to be a UK-Based osCommerce DEFAULT installation and NOT a "loaded" installation.

This allows users to have the freedom of choosing their own contributions without additional compatibility problems.

 

Features:

- Added UK counties of England, Wales, Scotland, Northern Ireland and Channel Islands.

- UK date format for Admin section.

- UK date format for Catalog section.

- UK address layout in create_account.php, address_book_process.php and checkout_shipping_address.php

- Updated date format related error constants.

- Added British Currency (default).

- Updated the sample catalog's price database.

- VAT.

- VAT zones.

 

Screenshots are also included.

 

In addition, this original osCommerce 2.2 bug is fixed.

http://www.oscommerce.com/community/bugs,1426/search,country

 

Installation:

Replace the US based installation files with the UK based files included in this package.

Install osCommerce in the usual manner.

 

Contribution Package:  http://www.oscommerce.com/community/contributions,2816

 

All UK related questions, comments and suggestions are welcome.

 

Hi Alpha Ray great work but you missed out the UK Credit/Debit cards.

Share this post


Link to post
Share on other sites
Hi Alpha Ray great work but you missed out the UK Credit/Debit cards.

Hi Daz, Credit modules will have to be release seperately. As they can easily be installed at any stage of osCommerce development with minimal conflicts against other contributions. This is the case because unlike localise setups, the credit modules are more "encapsulated" or "self-contained". There are also many credit module related problems that still have yet to be inditified and solved for each of the merchant vendors.

 

For the above reasons I've decided to release a "fresh" UK-Based Installation Pack. In the mean time, if any have additional problems, solutions, tips & tricks on credit card modules for UK. List them here, I'll combine them into an all-in-one solution.

 

Currently I'm working on making Switch (now know as Maestro) fully compatible with the CC Modules. So the more questions & solutions we collect here, the faster the development of UK CC Modules will be.

Share this post


Link to post
Share on other sites

i am in the process of setting up my shop, i have added in other peoples contributions etc but would love to have a full correct uk setup.

 

is tehre any way i can do this now or do i have to start again from scratch with this version.

 

I also have about 40 products added would i loose these and have to re-add or would these stay.

 

Any help / instructions wuold be great.

 

Cheers

andy

Share this post


Link to post
Share on other sites
i am in the process of setting up my shop, i have added in other peoples contributions etc but would love to have a full correct uk setup.

 

is tehre any way i can do this now or do i have to start again from scratch with this version.

 

I also have about 40 products added would i loose these and have to re-add or would these stay.

 

Any help / instructions wuold be great.

 

Cheers

andy

 

No, you don't have to do it again from scratch. But it will take quit a bit of work.

 

A good place to start for uk set up is to change the date format from US's (mm/dd/yyyy) to UK's (dd/mm/yyyy).

 

Here's how to do it. (remember to backup before any modification)

 

********************************************************************

* Open catalog/includes/languages/english.php (this is for your catalog section)

* The changes are highlighted.

********************************************************************

@setlocale(LC_TIME, 'en_UK.ISO_8859-1');

 

define('DATE_FORMAT_SHORT', '%d/%m/%Y'); // this is used for strftime()

define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()

define('DATE_FORMAT', 'd/m/Y'); // this is used for date()

define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');

 

////

// Return date in raw format

// $date should be in format mm/dd/yyyy

// raw date is in format YYYYMMDD, or DDMMYYYY

function tep_date_raw($date, $reverse = false) {

if ($reverse) {

return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);

} else {

return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);

}

}

 

*********************

Also change the following

*********************

 

define('ENTRY_DATE_OF_BIRTH_ERROR', 'Your Date of Birth must be in this format: MM/DD/YYYY (eg 05/21/1970)');

to

define('ENTRY_DATE_OF_BIRTH_ERROR', 'Your Date of Birth must be in this format: DD/MM/YYYY (eg 21/05/1970)');

 

define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 05/21/1970)');

to

define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 21/05/1970)');

 

define('DOB_FORMAT_STRING', 'mm/dd/yyyy');

to

define('DOB_FORMAT_STRING', 'dd/mm/yyyy');

 

After you have done the above you'll also have to

- Change date format in the Admin section. (optional)

- Add UK counties. (optional)

- Change the address layout. (recommended)

- Add UK currency. (required)

- Add UK tax information (if needed)

 

Good news, most of the modifications don not take as long as the one shown above.

 

When you finish the above, let me know. I'll write a step-by-step guide for the next one (of your chice). :D

Share this post


Link to post
Share on other sites

Wow thank you very much, i have just changed my DOB and it is working perfectly thanks !

 

The tutorial i would be most interested in is the address modification so not to have state or suburb in the fields.

 

Thanks alot, its really appreciated :)

Share this post


Link to post
Share on other sites

Here we go:

 

Again open catalog/includes/languages/english.php and change:

 

define('ENTRY_STREET_ADDRESS', 'Street Address:');

to

define('ENTRY_STREET_ADDRESS', 'Address Line 1:');

 

define('ENTRY_STREET_ADDRESS_ERROR', 'Your Street Address must contain a minimum of ' . ENTRY_STREET_ADDRESS_MIN_LENGTH . ' characters.');

to

define('ENTRY_STREET_ADDRESS_ERROR', 'Your Address Line 1 must contain a minimum of ' . ENTRY_STREET_ADDRESS_MIN_LENGTH . ' characters.');

 

define('ENTRY_SUBURB', 'Suburb:');

to

define('ENTRY_SUBURB', 'Address Line 2:');

 

define('ENTRY_STATE', 'State/Province:');

to

define('ENTRY_STATE', 'County/State:');

*** You can use just County instead of County/State if you don't intend to sell internationally***

 

define('ENTRY_STATE_ERROR', 'Your State must contain a minimum of ' . ENTRY_STATE_MIN_LENGTH . ' characters.');

to

define('ENTRY_STATE_ERROR', 'Your County/State must contain a minimum of ' . ENTRY_STATE_MIN_LENGTH . ' characters.');

 

define('ENTRY_STATE_ERROR_SELECT', 'Please select a  from the States pull down menu.');

to

define('ENTRY_STATE_ERROR_SELECT', 'Please select a county/state from the County/State pull down menu.');

 

If you don't encounter any problems we will change the address layout next. B)

Share this post


Link to post
Share on other sites

Ok. Great Stuff. All is implemented and working fine so far.

 

Now, How to change the Address layout on create_account.php, plus adding those counties????

Share this post


Link to post
Share on other sites
great great mod.

 

Just wish it was around when I first set up my UK store!

Thanks Jon. I'll be keeping an eye on the CVS and will make sure that complete UK-Based setup will be available as soon as MS3 is out.

Share this post


Link to post
Share on other sites
Ok. Great Stuff. All is implemented and working fine so far.

 

Now, How to change the Address layout on create_account.php, plus adding those counties????

More tutorials are coming very soon!

Share this post


Link to post
Share on other sites

Changing Date Format in Admin's section:

 

We've changed the Date format in the Catalog section last time, so let's change the Admin section as well. Please note that the date format codes in the Admin section is very similar to the one in Catalog section but NOT the same.

 

********************************************************************

* Open catalog/admin/includes/languages/english.php (this is for your admin section)

* The changes are highlighted.

********************************************************************

setlocale(LC_TIME, 'en_UK.ISO_8859-1');

define('DATE_FORMAT_SHORT', '%d/%m/%Y'); // this is used for strftime()

define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()

define('DATE_FORMAT', 'd/m/Y'); // this is used for date()

define('PHP_DATE_TIME_FORMAT', 'd/m/Y H:i:s'); // this is used for date()

define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');

 

////

// Return date in raw format

// $date should be in format mm/dd/yyyy

// raw date is in format YYYYMMDD, or DDMMYYYY

function tep_date_raw($date, $reverse = false) {

if ($reverse) {

return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);

} else {

return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);

}

}

 

*********************

Also change the following

*********************

 

define('DOB_FORMAT_STRING', 'mm/dd/yyyy');

to

define('DOB_FORMAT_STRING', 'dd/mm/yyyy');

 

Very quick and simple.

 

Next time we'll change the Layout of address_book_process.php (aka Update Address Book Entry page).

Share this post


Link to post
Share on other sites

Changing the layout of address_book_process.php (aka Update Address Book Entry page or New Address Book Entry page).

 

This is where your customers can change/update or add their addresses.

 

Warning: osCommerce 2.2 has a bug in this page so the first thing in this tutorial that we are going to do is fix it! More information can also be found at http://www.oscommerce.com/community/bugs,1426/search,country

 

Credits for fixing this bug goes to Amanda aka boxtel

 

********************************************************************

*In catalog/includes/modules/address_book_details.php

********************************************************************

 

Add

<?php
if ($country != '') {
$entry['entry_country_id'] = $country;
}
?>

before

          <tr>
           <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
           <td class="main"><?php echo tep_get_country_list('country', $entry['entry_country_id']) . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
         </tr>

Now that the bug is dead, we'll start rearranging the address format!

 

********************************************************************

*Open catalog/includes/modules/address_book_details.php

*(catalog/address_book_process.php uses this file)

********************************************************************

 

Locate and Cut this code section (using Ctrl+X or an equivalent on your OS)

          <tr>
           <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
           <td class="main"><?php echo tep_draw_input_field('postcode', $entry['entry_postcode']) . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
         </tr>

You want to Paste it just above the following section (using Ctrl+V etc.)

          <tr>
           <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
           <td class="main"><?php echo tep_get_country_list('country', $entry['entry_country_id']) . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
         </tr>

 

That's it! That's all you have to do in this page.

 

Next time we'll change the Layout of checkout_shipping_address.php (aka Delivery Information page).

Share this post


Link to post
Share on other sites

Calotherm

I think that the World Zones contribution is pretty well complete. It works for me.

 

Alpha Ray

Great tutorials.

Does the state/contry selector contribution remove the bug?

Share this post


Link to post
Share on other sites

Related to this, I have the following modification.

 

I installed a list of UK counties from the contribs, but during checkout_payment and shipping etc. it shows as SURR, instead of Surrey for example.

 

To get the state_name instead of this state_code, just alter line 446ish in /catalog/includes/functions/general.php

 

Change:

if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {
       $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state);

 

Into:

if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {
       $state = tep_get_zone_name($address['country_id'], $address['zone_id'], $state);

 

Instead of calling tep_get_zone_code you'll call tep_get_zone_name.

 

Hope this is useful to you people.

Share this post


Link to post
Share on other sites
********************************************

 

Locate and Cut this code section (using Ctrl+X or an equivalent on your OS)

          <tr>
           <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
           <td class="main"><?php echo tep_draw_input_field('postcode', $entry['entry_postcode']) . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
         </tr>

You want to Paste it just above the following section (using Ctrl+V etc.)

          <tr>
           <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
           <td class="main"><?php echo tep_get_country_list('country', $entry['entry_country_id']) . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
         </tr>

 

Same for the catalog/create_account.php file.

Share this post


Link to post
Share on other sites
////

// Return date in raw format

// $date should be in format mm/dd/yyyy

// raw date is in format YYYYMMDD, or DDMMYYYY

function tep_date_raw($date, $reverse = false) {

  if ($reverse) {

    return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);

  } else {

    return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);

  }

}

Are you sure this change is required (swapping the month and day round) ? Even with the date definitions updated in the database ?

 

I change the 'address_format' table (use phpMyAdmin to do this) to the following values (the record marked 'x' is probably already correct from the default installation, and the '|' is just my syntax for seperating the two fields in the record) :

 

1 $firstname $lastname$cr$streets$cr$city$cr$statecomma$postcode$cr$country | $city / $country

x 2 $firstname $lastname$cr$streets$cr$city, $state $postcode$cr$country | $city, $state / $country

3 $firstname $lastname$cr$streets$cr$city$cr$statecomma$postcode$cr$country | $state / $country

4 $firstname $lastname$cr$streets$cr$city$cr$postcode$cr$country | $postcode / $country

5 $firstname $lastname$cr$streets$cr$city$postcode$cr$country | $city / $country

 

Rich.

Edited by CMOTD

Share this post


Link to post
Share on other sites
Are you sure this change is required (swapping the month and day round) ? Even with the date definitions updated in the database ?

Errr, "yes you do" is the answer ! (bloody stupid question to ask wasn't it ?)

 

I never noticed this problem before because I never ask my customers for the DOB - it's none of by business !

 

Rich.

Edited by CMOTD

Share this post


Link to post
Share on other sites

Is it easy to remove the entire Date format so the customer can type it (or anything else) in any format he want?s?

 

My plan is to use the date-of-birth column to company number (vat number) and as this is an global shop there are all kinds of different formats.

Share this post


Link to post
Share on other sites

Nice mod. I found a problem with London/Londonderry, basically the validation couldn't distinguish between the two if you put in London as your zone, and so it just went round and round trying to validate the address. I made the following modification to line 105 in catalog/address_book_process.php:

 

$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name='" . tep_db_input($state) . "' or zone_name like '" . tep_db_input($state) . "' or zone_code like '%" . tep_db_input($state) . "%')");

 

I don't know whether this is a good way to do things but it seems to fix the problem.

 

Tom

Share this post


Link to post
Share on other sites

Boy this is just what I need Ray! (btw I'm in London and it's past 1am now :blink: )

 

I've been having problems trying to set up UK shipping rates (Royal Mail n all that) but it's just not working grrrr

 

 

I'll have to come back to this tomorrow and hope I don't mess up my osc :D

Share this post


Link to post
Share on other sites

Great tutorials Ray! I'm up to date now.

 

Please keep em coming :thumbsup:

Share this post


Link to post
Share on other sites

I am quite well advanced om making my shop for the UK. Just found this complete package which could have saved me time !

 

Have manually made changes to date format etc.

 

Downloaded UK Counties; BUT; it may seem silly; how do I get them into OSC ?

 

HELP ! Please !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now