Jump to content



Photo
* * * * - 1 votes

UK-Based: Default osCommerce Installation.


  • Please log in to reply
149 replies to this topic

#1   Alpha Ray

Alpha Ray
  • Members
  • 1,377 posts
  • Real Name:Alpha Ray

Posted 13 January 2005 - 21:28

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.oscommerc.../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.oscommerc...tributions,2816

All UK related questions, comments and suggestions are welcome.

Edited by Alpha Ray, 13 January 2005 - 21:30.


#2   PappaS

PappaS
  • Members
  • 10 posts
  • Real Name:Daz

Posted 14 January 2005 - 00:49

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.oscommerc.../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.oscommerc...tributions,2816

All UK related questions, comments and suggestions are welcome.

<{POST_SNAPBACK}>


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

#3   Alpha Ray

Alpha Ray
  • Members
  • 1,377 posts
  • Real Name:Alpha Ray

Posted 14 January 2005 - 11:00

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

<{POST_SNAPBACK}>

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.

#4   Calotherm

Calotherm
  • Members
  • 14 posts
  • Real Name:Andy Hadland

Posted 14 January 2005 - 18:43

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

#5   Alpha Ray

Alpha Ray
  • Members
  • 1,377 posts
  • Real Name:Alpha Ray

Posted 14 January 2005 - 20:42

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

<{POST_SNAPBACK}>


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). /biggrin.gif' class='bbc_emoticon' alt=':D' />

#6   Calotherm

Calotherm
  • Members
  • 14 posts
  • Real Name:Andy Hadland

Posted 15 January 2005 - 04:18

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 /smile.gif' class='bbc_emoticon' alt=':)' />

#7   Alpha Ray

Alpha Ray
  • Members
  • 1,377 posts
  • Real Name:Alpha Ray

Posted 15 January 2005 - 05:23

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. /cool.gif' class='bbc_emoticon' alt='B)' />

#8   JonoB

JonoB
  • Members
  • 159 posts
  • Real Name:Jon

Posted 16 January 2005 - 20:50

great great mod.

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

#9   Bean Boy

Bean Boy
  • Members
  • 9 posts
  • Real Name:N B

Posted 17 January 2005 - 14:50

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????

#10   Alpha Ray

Alpha Ray
  • Members
  • 1,377 posts
  • Real Name:Alpha Ray

Posted 17 January 2005 - 21:57

great great mod.

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

<{POST_SNAPBACK}>

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.

#11   Alpha Ray

Alpha Ray
  • Members
  • 1,377 posts
  • Real Name:Alpha Ray

Posted 17 January 2005 - 21:59

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????

<{POST_SNAPBACK}>

More tutorials are coming very soon!

#12   Calotherm

Calotherm
  • Members
  • 14 posts
  • Real Name:Andy Hadland

Posted 18 January 2005 - 00:03

Hey !

Thanks again its all working great /biggrin.gif' class='bbc_emoticon' alt=':D' />

#13   Alpha Ray

Alpha Ray
  • Members
  • 1,377 posts
  • Real Name:Alpha Ray

Posted 19 January 2005 - 00:14

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).

#14   Alpha Ray

Alpha Ray
  • Members
  • 1,377 posts
  • Real Name:Alpha Ray

Posted 19 January 2005 - 01:03

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.oscommerc.../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']) . '&nbsp;' . (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']) . '&nbsp;' . (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']) . '&nbsp;' . (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).

#15   Calotherm

Calotherm
  • Members
  • 14 posts
  • Real Name:Andy Hadland

Posted 19 January 2005 - 02:53

Thanks /biggrin.gif' class='bbc_emoticon' alt=':D' />

#16   Coopco

Coopco
  • Members
  • 9,557 posts
  • Real Name:Leslie Cooper
  • Gender:Male
  • Location:Sea Lake, Victoria, Australia

Posted 19 January 2005 - 11:38

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?

#17   JoeMcManus

JoeMcManus
  • Members
  • 168 posts
  • Real Name:Joe McManus

Posted 21 January 2005 - 16:22

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.
Johan a.k.a. T0PS3O elsewhere.

Contributed Barclay's ePDQ Payment Module though not originally mine. Made it work though...

#18   JoeMcManus

JoeMcManus
  • Members
  • 168 posts
  • Real Name:Joe McManus

Posted 21 January 2005 - 16:58

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

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']) . '&nbsp;' . (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']) . '&nbsp;' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
          </tr>


Same for the catalog/create_account.php file.
Johan a.k.a. T0PS3O elsewhere.

Contributed Barclay's ePDQ Payment Module though not originally mine. Made it work though...

#19   CMOTD

CMOTD
  • Members
  • 433 posts
  • Real Name:Richard Bentley

Posted 22 January 2005 - 12:02

////
// 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, 22 January 2005 - 12:03.


#20   CMOTD

CMOTD
  • Members
  • 433 posts
  • Real Name:Richard Bentley

Posted 22 January 2005 - 12:11

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

<{POST_SNAPBACK}>

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, 22 January 2005 - 12:15.