Pubwebhost.com - Free Web Hosting Services
 
Register Domains
Free Hosting
Web Hosting
OSC Hosting
Reseller Business
.IN Registration
SSL Certificates
 

Problem: Users of osCommerce shopping carts (OSC) face MySQL Error Message - 1054 - Unknown column 'p.products_id' in 'on clause' in index.php, advanced_search_results.php, and categories.php in admin section.

Cause: If the web hosting company has upgraded MySQL from version 4.x to version 5.x, these errors show up in cart home page, while doing advanced search, or in admin section when you go to view categories. MySQL 5.0 introduces Server SQL modes as part of its SQL 2003 standards support, and uses a more stricter approach to executing SQL queries. This is performed by default with setting STRICT_TRANS_TABLES as a Server SQL mode.

Due to this new setting, MySQL fails on certain SQL queries and produces error messages on the screen

      Error Message - 1054 - Unknown column 'p.products_id' in 'on clause'

Resolution: Existing queries in affected pages namely index.php, advanced_search_results.php, and in admin section categories.php have to be changed.

You may use any of the following methods if you encounter these errors on your site
1. Download modified files here. [If you have modified your site using contributions, this is NOT Recommended, since these files are from OSC 2.2MS.]
2. Replace the queries as listed on this page below.*
3. If you are not familiar with PHP, or don't want to get into the technical arena, contact me for professional help.

 
File Name index.php : Line No 175 Location : server_root/catalog
Original Query
Query compatible with MySQL 5
 
index.php Line 178  
Original Query
Query compatible with MySQL 5
 
index.php Line 184  
Original Query
Query compatible with MySQL 5
 
index.php Line 187  
Original Query
Query compatible with MySQL 5
 
File Name /catalog/admin/categories.php  
Original Query
Query compatible with MySQL 5
 
File Name catalog/advanced_search_result.php Lines 213 - 223
Original Query

Query compatible with MySQL 5
 
Final Modifications

Apart from changes mentioned above in index.php, application_search_result.php and /admin/categories.php, we also need to run 3 SQL Queries for oscommerce cart to function properly.

In order to achieve that, you need to be familiar with phpmyadmin (browser based utility to connect to your database). Using phpmyadmin execute following 3 queries.

1
ALTER TABLE whos_online MODIFY COLUMN last_page_url VARCHAR(255) NOT NULL;
2
ALTER TABLE customers MODIFY COLUMN customers_default_address_id INTEGER;
3
ALTER TABLE customers_basket MODIFY COLUMN final_price DECIMAL(15,4);
 
Warning & Disclaimer : While every attempt has been made to ensure that information presented on this web page is accurate and of use, these resolutions may not always resolve the problem on your oscommerce installation. I take no responsiblity of any failure, fault or issues on your site if you follow the instructions here and encounter problems. This solution worked on my store located here and my sincere advice to all you folks is to take a back-up of each page, before you modify them. It is also a best practice to take regular backups of your oscommerce installation including backup of your database.
 
Tips on other issues
1

Modify Home Page (Index page after installing OSC) [Coming Soon]

2

Session Warning [Coming Soon]

3

SAFE MODE [Coming Soon]

4

Sessions.php Warning [Coming Soon]

5

USPS Doesn't Work [Coming Soon]

 
If you have any suggestion or looking for something particular, do drop me a mail [pubdomains AT gmail.com]
 
Register Domains
Work From Home
Web Hosting
OSC Hosting
Reseller Business
.IN Registration
SSL Certificates