date format from mm/dd/yyyy to dd/mm/yyyy

Posted by admin on August 18, 2009 under osCommerce Tips | Be the First to Comment

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

Also change the country code to match yours (this example uses GB for UK)

********************************************************************
* Open catalog/includes/languages/english.php (this is for your catalog section)
* The changes are highlighted.
********************************************************************
@setlocale(LC_TIME, ‘en_GB.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
*********************

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

CODE
define(‘ENTRY_DATE_OF_BIRTH_TEXT’, ‘* (eg. 05/21/1970)’);
to
CODE
define(‘ENTRY_DATE_OF_BIRTH_TEXT’, ‘* (eg. 21/05/1970)’);

CODE
define(‘DOB_FORMAT_STRING’, ‘mm/dd/yyyy’);
to
CODE
define(‘DOB_FORMAT_STRING’, ‘dd/mm/yyyy’);

Model Number field in oscommerce

Posted by admin on July 31, 2009 under osCommerce Tips | Be the First to Comment

How to Change Product Model Length
The default 12 character limit for product model strings may be too short for certain needs, and can be easily increased with phpMyAdmin or directly with MySQL.

Two database tables need to be modified when changing the length of the product model
field: products, and orders_products.

Using phpMyAdmin

Select the products table on the left side of phpMyAdmin
Select the product_model check box
Click on the Change button
Set the new size value under the Length/Values field, and click on the Save button. The same steps need to be reproduced for the orders_products table.

Using MySQL
alter table products change products_model products_model varchar(255);
alter table orders_products change products_model products_model varchar(255);