Guest Posted September 14, 2005 Share Posted September 14, 2005 It seems that when I go into a category without products in it it give me that message, I guest there is no products to show and the script goes bezurk! following is the error message in my new product box, only when in sub-categories without product, you can also see it at http://www.xtreme-medias.com/e-commerce/ :'( Can anyone help me. ************************* 1064 - You have an error in your SQL syntax near 'distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, ' at line 1 select distinct p.products_date_added, distinct p.products_id, p.products_image, p.products_tax_class_id, 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_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '21' and p.products_status = '1' and TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < '30' order by p.products_date_added desc limit 3 [TEP STOP] Link to comment Share on other sites More sharing options...
♥Vger Posted September 14, 2005 Share Posted September 14, 2005 Read the '1064' link below my name. Vger Link to comment Share on other sites More sharing options...
Guest Posted September 14, 2005 Share Posted September 14, 2005 Read the '1064' link below my name. Vger <{POST_SNAPBACK}> I did it and it still says an error message; I did it as so; :'( $current_page_number = $num_pages; } if ($offset < 0) { $offset = ($max_rows_per_page * ($current_page_number - 1)); $sql_query .= " limit " . $offset . ", " . $max_rows_per_page; $offset = 0 ; } } function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '', $page_name = 'page') { global $PHP_SELF; Thank anyway! ;) Link to comment Share on other sites More sharing options...
FalseDawn Posted September 14, 2005 Share Posted September 14, 2005 select distinct p.products_date_added, distinct p.products_id you have the keyword "distinct" twice - remove the 2nd one and you should be ok. Edit: The thread you were pointed to is for a different error that cases the same error number, but not relevant in your case. Link to comment Share on other sites More sharing options...
Guest Posted September 14, 2005 Share Posted September 14, 2005 select distinct p.products_date_added, distinct p.products_id you have the keyword "distinct" twice - remove the 2nd one and you should be ok. Edit: The thread you were pointed to is for a different error that cases the same error number, but not relevant in your case. <{POST_SNAPBACK}> Do you know the page it should be in .... ???? :rolleyes: Link to comment Share on other sites More sharing options...
FalseDawn Posted September 14, 2005 Share Posted September 14, 2005 index.php by the looks of it - you'll have to find the code where it is building up this SQL string. Link to comment Share on other sites More sharing options...
Guest Posted September 14, 2005 Share Posted September 14, 2005 index.php by the looks of it - you'll have to find the code where it is building up this SQL string. <{POST_SNAPBACK}> Still looking, not in catalog/index.php. :huh: :huh: Link to comment Share on other sites More sharing options...
Guest Posted September 15, 2005 Share Posted September 15, 2005 Still looking, not in catalog/index.php. :huh: :huh: <{POST_SNAPBACK}> Still need help ! error message still on..... Someone, please help me in PHP. see at : http://www.xtreme-medias.com/e-commerce :( Link to comment Share on other sites More sharing options...
dahui Posted September 15, 2005 Share Posted September 15, 2005 Still need help ! error message still on.....Someone, please help me in PHP. see at : http://www.xtreme-medias.com/e-commerce :( <{POST_SNAPBACK}> you sure you looked right, make a serach on distinct in index.php and check where you find he code with double distinct in the same select dahui Link to comment Share on other sites More sharing options...
Guest Posted September 15, 2005 Share Posted September 15, 2005 you sure you looked right, make a serach on distinct in index.php and check where you find he code with double distinct in the same select dahui <{POST_SNAPBACK}> I really did, If you want I can send a zip files to check it out, I even went in most of my files to search for it, without results; the only code near it is the following; ******* // show the products of a specified manufacturer if (isset($HTTP_GET_VARS['manufacturers_id'])) { if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only a specific category // p.products_date_added to query for New Product Icon contribution $listing_sql = "select " . $select_column_list . " p.products_date_added, 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'] . "'"; } else { // We show them all // p.products_date_added to query for New Product Icon contribution $listing_sql = "select " . $select_column_list . " p.products_date_added, 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'] . "'"; } } else { // show the products in a given categorie if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only specific catgeory // p.products_date_added to query for New Product Icon contribution $listing_sql = "select " . $select_column_list . " p.products_date_added,p. products_id, p.manufacturers_id, m.manufacturers_name, 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 . "'"; } else { // We show them all // p.products_date_added to query for New Product Icon contribution $listing_sql = "select " . $select_column_list . " p.products_date_added, 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 . "'"; } } *********** :'( thanks again, it seems like it keeps going wrong, Problem # 2 now I do not see my computer quotes in the french basket, if I switch to english its all there, in french I only see a total price and buttons. What do you want, NEWBIEEEESSSSSSSS in PHP. :-" THanks for all your help !!!!1 Link to comment Share on other sites More sharing options...
Guest Posted September 15, 2005 Share Posted September 15, 2005 thanks again, it seems like it keeps going wrong, Problem # 2 now I do not see my computer quotes in the french basket, if I switch to english its all there, in french I only see a total price and buttons. What do you want, NEWBIEEEESSSSSSSS in PHP. :-" THanks for all your help !!!!1 <{POST_SNAPBACK}> *********** Not freaking bad for a newbie ! Yeee ! I solved my problem, thanks to all the folks that replied, all together I managed to solve it. The first solution was not right ! but I left it there anyway, As for the other the second distinct call was indeed wrong and needed to be taken out, but where the hell was it, I searched everywhere to finallly read something ressembling my problem, that was occuring in new products. So I checked the file as per bug list and saw what::::: distinct *******, distinct ***** and it works ! :) :lol: :rolleyes: :D :thumbsup: The files was in catalog/includes/modules/new_products.php and code was: **************** // added for New Product Icon contribution $today_time = time(); // end addition for New Product Icon contribution $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); new contentBoxHeading($info_box_contents); if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { // p.products_date_added to query for New Product Icon contribution $new_products_query = tep_db_query("select p.products_date_added, p.products_id, p.products_image, p.products_tax_class_id, 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 where products_status = '1' and TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < '" . NEW_PRODUCT_DAYS . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { // p.products_date_added to query for New Product Icon contribution $new_products_query = tep_db_query("select distinct p.products_date_added, p.products_id, p.products_image, p.products_tax_class_id, 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_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 TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < '" . NEW_PRODUCT_DAYS . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.