big_z Posted April 8, 2004 Posted April 8, 2004 Hello, I am implementing Contribution 815: http://www.oscommerce.com/community/contributions,815 Everything is in place but I am getting the following error when I click on the "Printable Catalog" link on my site: A new window comes up (which is supposed to be the printable catalog) and has this error: 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 'select p.products_id, pd.products_name, pd.products_descript select count(select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, cd.categories_name, m.manufacturers_name from products p left join products_to_categories p2c on p.products_id=p2c.products_id left join categories c on p2c.categories_id=c.categories_id left join categories_description cd on c.parent_id=\'0\' and c.categories_id=cd.categories_id left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = \'1\' left join specials s on p.products_id = s.products_id where products_status = \'1\' order by cd.categories_name, c.parent_id, c.sort_order, c.categories_id, pd.products_name) as total [TEP STOP] The function is able to pull my Store Name and Address but not the product info. Has anyone had this error or know of a possible fix? Thanks :) Big Z
bluepony Posted April 8, 2004 Posted April 8, 2004 I'm not sure what you are trying to do with the Count: select count(select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, cd.categories_name, m.manufacturers_name from products p left join products_to_categories p2c on p.products_id=p2c.products_id left join categories c on p2c.categories_id=c.categories_id left join categories_description cd on c.parent_id=\'0\' and c.categories_id=cd.categories_id left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = \'1\' left join specials s on p.products_id = s.products_id where products_status = \'1\' order by cd.categories_name, c.parent_id, c.sort_order, c.categories_id, pd.products_name) as total Drop that Count and the rest should work correctly. This is what is listed in the contrib code: $print_catalog_query_raw = "select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, cd.categories_name, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id=p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id=c.categories_id left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on c.parent_id='0' and c.categories_id=cd.categories_id left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by cd.categories_name, c.parent_id, c.sort_order, c.categories_id, pd.products_name"; I'd rather be flying!
big_z Posted April 8, 2004 Author Posted April 8, 2004 Yep, that code in the contrib is exactly what is in my code... that select count.... as total is not there.. it is only there when the page loads.
big_z Posted April 8, 2004 Author Posted April 8, 2004 I have checked everything I know.. I have know idea where this "select count( and )as total is coming from. Any ideas?
bluepony Posted April 8, 2004 Posted April 8, 2004 That comes from the split_page_results.php in catalog/includes/classes Did you make any changes in there? It *should* just be creating a "select count(" . $count_string . ") as total". But it seems to be using in your entire SQL statement. I'd rather be flying!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.