Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Please help - osC 3.2.1 new install SQL Error


nobodyfamous

Recommended Posts

I get this error displayed only when viewing a category with subcategories in the catalog. This is a fresh install, all I have added in the basic "Random Products Images" (edit new_products.php) and the CKEditor to the Admin side.

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= pd.products_id and pd.language_id = '1' order by p.products_date_added desc li' at line 1

 

select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join specials s on p.products_id = s.products_id, products_description pd, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '1' and p.products_status = '1' order by rand() limit = pd.products_id and pd.language_id = '1' order by p.products_date_added desc limit 9

 

[TEP STOP]

 

I have made the change to the split_page_results.php in admin/includes/classes/

 

I didn't think that would help as the problem is only on the catalog side.

 

server info:

Server OS: Linux 2.6.18-194.32.1.el5PAE

Database: MySQL 5.0.91-log

HTTP Server: Apache

PHP Version: 5.2.17 (Zend: 2.2.0)

Link to comment
Share on other sites

You have an error here : 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= pd.products_id and pd.language_id = '1' order by p.products_date_added desc li' at line 1

 

It should be limit ,while you were editing you have removed "mit" from your new_products.php file

Link to comment
Share on other sites

I wish it was that simple. I took a look, and it seems that is not the issue.

 

attached is the file I am working on.

 

line 20, 21, 24, 25 are the ones in question. The commented out lines (20, 24) are the modified lines that produce the error.

 

Lines 14 to 19 are also added as per the mod.

 

Any more suggestions? (this mod is for 2.2, I am running 2.3.1)

new_productsMOD.php

Link to comment
Share on other sites

as I thought about this a little more, I realized, the random products is working fine on the home page, the error is when the "new_products.php" is called into a categories listing.

 

What changes between these 2 environments that would cause the error? (FYI - the demo stuff is still installed in the catalog)

Link to comment
Share on other sites

Change commented-out line from

// $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,

if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " .

TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .

TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" .

(int)$new_products_category_id . "' and p.products_status = '1' order by rand() limit = pd.products_id and

pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

to

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,

if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " .

TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .

TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" .

(int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and

pd.language_id = '" . (int)$languages_id . "' order by rand() limit " . MAX_DISPLAY_NEW_PRODUCTS);

Somehow the random display order code got put in the wrong place. That's assuming all you want to do is change the sort order from date added (newest to oldest) to random order.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...