Jump to content

Oscommerce Patch To Work On Php/mysql 5


TCH-Alex

Recommended Posts

Here is the fix for OSCommerce to work with php/mysql 5

 

>Lines 213-223 in advanced_search_result.php must be changed from:

$from_str = "from " . TABLE_PRODUCTS . " p left join " .
TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " .
TABLE_SPECIALS . " s on p.products_id = s.products_id, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c";



if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) ||
tep_not_null($pto)) ) {

 if (!tep_session_is_registered('customer_country_id')) {

   $customer_country_id = STORE_COUNTRY;

   $customer_zone_id = STORE_ZONE;

 }

 $from_str .= " left join " . TABLE_TAX_RATES . " tr on
p.products_tax_class_id = tr.tax_class_id left join " .
TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and
(gz.zone_country_id is null or gz.zone_country_id = '0' or
gz.zone_country_id = '" . (int)$customer_country_id . "') and
(gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" .
(int)$customer_zone_id . "')";

}



$where_str = " where p.products_status = '1' and p.products_id =
pd.products_id and pd.language_id = '" . (int)$languages_id . "' and
p.products_id = p2c.products_id and p2c.categories_id = c.categories_id
";




to:



$from_str = "from " . TABLE_PRODUCTS . " p left join " .
TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " .
TABLE_SPECIALS . " s on p.products_id = s.products_id";



if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) ||
tep_not_null($pto)) ) {

 if (!tep_session_is_registered('customer_country_id')) {

   $customer_country_id = STORE_COUNTRY;

   $customer_zone_id = STORE_ZONE;

 }

 $from_str .= " left join " . TABLE_TAX_RATES . " tr on
p.products_tax_class_id = tr.tax_class_id left join " .
TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and
(gz.zone_country_id is null or gz.zone_country_id = '0' or
gz.zone_country_id = '" . (int)$customer_country_id . "') and
(gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" .
(int)$customer_zone_id . "')";

}



$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";



$where_str = " where p.products_status = '1' and p.products_id =
pd.products_id and pd.language_id = '" . (int)$languages_id . "' and
p.products_id = p2c.products_id and p2c.categories_id = c.categories_id
";



The following lines must be replaced in index.php:

Line 175, from:


$listing_sql = "select " . $select_column_list . " p.products_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF
(s.status, s.specials_new_products_price, NULL) as
specials_new_products_price, IF(s.status, s.specials_new_products_price,
p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id where p.products_status = '1' and
p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" .
(int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id =
p2c.products_id and pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id = '" .
(int)$HTTP_GET_VARS['filter_id'] . "'";



to:



$listing_sql = "select " . $select_column_list . " p.products_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF
(s.status, s.specials_new_products_price, NULL) as
specials_new_products_price, IF(s.status, s.specials_new_products_price,
p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join
" . TABLE_SPECIALS . " s on p.products_id = s.products_id, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and
p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" .
(int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id =
p2c.products_id and pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id = '" .
(int)$HTTP_GET_VARS['filter_id'] . "'";



Line 178, from:



$listing_sql = "select " . $select_column_list . " p.products_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF
(s.status, s.specials_new_products_price, NULL) as
specials_new_products_price, IF(s.status, s.specials_new_products_price,
p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left
join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where
p.products_status = '1' and pd.products_id = p.products_id and
pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id =
m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS
['manufacturers_id'] . "'";



to:



$listing_sql = "select " . $select_column_list . " p.products_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF
(s.status, s.specials_new_products_price, NULL) as
specials_new_products_price, IF(s.status, s.specials_new_products_price,
p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join
" . TABLE_SPECIALS . " s on p.products_id = s.products_id, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where
p.products_status = '1' and pd.products_id = p.products_id and
pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id =
m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS
['manufacturers_id'] . "'";



Line 184, from:



$listing_sql = "select " . $select_column_list . " p.products_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF
(s.status, s.specials_new_products_price, NULL) as
specials_new_products_price, IF(s.status, s.specials_new_products_price,
p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id where p.products_status = '1' and
p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" .
(int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id =
p2c.products_id and pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id = '" .
(int)$current_category_id . "'";



to:



$listing_sql = "select " . $select_column_list . " p.products_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF
(s.status, s.specials_new_products_price, NULL) as
specials_new_products_price, IF(s.status, s.specials_new_products_price,
p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join
" . TABLE_SPECIALS . " s on p.products_id = s.products_id, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and
p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" .
(int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id =
p2c.products_id and pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id = '" .
(int)$current_category_id . "'";



Line 187, from:



$listing_sql = "select " . $select_column_list . " p.products_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF
(s.status, s.specials_new_products_price, NULL) as
specials_new_products_price, IF(s.status, s.specials_new_products_price,
p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . "
pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on
p.manufacturers_id = m.manufacturers_id, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id where p.products_status = '1' and
p.products_id = p2c.products_id and pd.products_id = p2c.products_id and
pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id =
'" . (int)$current_category_id . "'";



to:



$listing_sql = "select " . $select_column_list . " p.products_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF
(s.status, s.specials_new_products_price, NULL) as
specials_new_products_price, IF(s.status, s.specials_new_products_price,
p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . "
pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on
p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . "
p2c where p.products_status = '1' and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id and pd.language_id = '" .
(int)$languages_id . "' and p2c.categories_id = '" .
(int)$current_category_id . "'";



Line 292 in admin/categories.php must be changed from:



tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity,
products_model,products_image, products_price, products_date_added,
products_date_available, products_weight, products_status,
products_tax_class_id, manufacturers_id) values ('" . tep_db_input
($product['products_quantity']) . "', '" . tep_db_input($product
['products_model']) . "', '" . tep_db_input($product
['products_image']) . "', '" . tep_db_input($product
['products_price']) . "',  now(), '" . tep_db_input($product
['products_date_available']) . "', '" . tep_db_input($product
['products_weight']) . "', '0', '" . (int)$product
['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] .
"')");



to:



tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity,
products_model,products_image, products_price, products_date_added,
products_date_available, products_weight, products_status,
products_tax_class_id, manufacturers_id) values ('" . tep_db_input
($product['products_quantity']) . "', '" . tep_db_input($product
['products_model']) . "', '" . tep_db_input($product
['products_image']) . "', '" . tep_db_input($product
['products_price']) . "',  now(), " . (empty($product
['products_date_available']) ? "null" : "'" . tep_db_input($product
['products_date_available']) . "'") . ", '" . tep_db_input($product
['products_weight']) . "', '0', '" . (int)$product
['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] .
"')");


 

The following SQL queries need to be performed on the OSCommerce database

 

>ALTER TABLE whos_online MODIFY COLUMN last_page_url VARCHAR(255) NOT NULL;


ALTER TABLE customers MODIFY COLUMN customers_default_address_id INTEGER;


ALTER TABLE customers_basket MODIFY COLUMN final_price DECIMAL(15,4);

Link to comment
Share on other sites

The total problem with OSCOMMERCE is as follows:

 

There are 3 major versions in frequent use:

=============================

- (1a) OSCOMMERCE (from oscommerce.org since summer 2007 compliant with PHP 5.x and MySQL 5.x

- (1b) OSCOMMERCE by Fantastico - in the TCH version not yet compliant - the specified patches will probably settle this

(I imagine that this is probably meantime done on the pre-installed version).

Extremely easy for programmers, but I guess that average shop owners will have some difficulties with it.

- (2s) Variant CRE-LO (not named in full here in this forum, due to some competition aspect in the field of hosting)

I have THIS one in use on TCH, it has 30++ extension packages inside, and has far more PHP 5.x probllems in old verions 2004 or so

- (2b) CRE-LO 6.2 / current download : should be compliant, was implemented just now on TCH server, dides NOT work

properly, I cancelled the efforts for debugging, but think it is o.k., just a strange single config problem.

- (3) XT-Commerce / current 3.04 , apparently already based on current original OSCOMMERCE 3.x alpha test.

I just implemented this on TCH. It works but has various set backs.

- (4) and there are some other variants with own names.

 

Resume + Opinion

====================

Oscommerce has become old and has problems, doesn't matter from which side you try to take it.

Apparently, lack of financial user support (hence shop owner egoism) has discouraged the programmers.

The marketing for the derived variants is of much higher quality than the programmers' add-ons -

perhaps the marketing people did not leave enough money for the brains?

 

Consequently, I will soon leave OSCCOMMEWRCE and close this chapter forever.

Update support is below the minimal needs but this is caused by shop owner egoism.

 

While definitely replacing OSCOMMERCE here (probably by some own software /will become freeware),

I am trying to enable for others the creation of coherent shop owner support service for OS-COMMERCE

I have implemented a starting point for this on the Wiki : infos7.org

Type there into the search field : ENXEN MENU OSCOMMERCE

(If such an information is not wanted on this forum, this post can be wiped out by the administrator.)

 

There shop owners and developers can add experience with the goal of step-by-step creation

of a handbook for the major current shop owner problems with all major variants of OSCOMMERCE.

This is the last thing which I will do in favor ot OSCOMMERCE, in order to pay my thanks for the many

years of service for one of my business partners.

Link to comment
Share on other sites

  • 2 months later...

From the original post;

 

>Line 292 in admin/categories.php must be changed from:

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity,
products_model,products_image, products_price, products_date_added,
products_date_available, products_weight, products_status,
products_tax_class_id, manufacturers_id) values ('" . tep_db_input
($product['products_quantity']) . "', '" . tep_db_input($product
['products_model']) . "', '" . tep_db_input($product
['products_image']) . "', '" . tep_db_input($product
['products_price']) . "', now(), '" . tep_db_input($product
['products_date_available']) . "', '" . tep_db_input($product
['products_weight']) . "', '0', '" . (int)$product
['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] .
"')");



to:



tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity,
products_model,products_image, products_price, products_date_added,
products_date_available, products_weight, products_status,
products_tax_class_id, manufacturers_id) values ('" . tep_db_input
($product['products_quantity']) . "', '" . tep_db_input($product
['products_model']) . "', '" . tep_db_input($product
['products_image']) . "', '" . tep_db_input($product
['products_price']) . "', now(), " . (empty($product
['products_date_available']) ? "null" : "'" . tep_db_input($product
['products_date_available']) . "'") . ", '" . tep_db_input($product
['products_weight']) . "', '0', '" . (int)$product
['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] .
"')");

 

Remember to scroll down fully.

Link to comment
Share on other sites

  • The topic was unpinned

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...