jampjamp Posted November 10, 2017 Share Posted November 10, 2017 Hello, this problem is well known, but i would rather prefer to avoid installing any addons. I think it's doable by simple change in query. My problem is that in attribute list they are shown by ID so if I'll add it like 1 ID = aaa 2 ID = ccc 3 ID = ddd Then everything is shown right, but if I'll add later 4 ID = bbb it won't be shown between 1 and 2 ID's. I guess it's all about query in product_info.php Quote $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); So i'm trying to add somewhere Quote ORDER BY `products_options_values`.`products_options_values_name` ASC But i'm not sure where to put it right cause this query is a little bit complicated. And actually i'm not sure if this "order by..." is correct because it looks like those tables are not recognized? Quote 1054 - Unknown column 'products_options_values.products_options_values_name' in 'order clause' I've tried also something like that: Quote $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' ORDER BY " . TABLE_PRODUCTS_OPTIONS_VALUES_NAME ." FROM " . TABLE_PRODUCTS_OPTIONS_VALUES . " ASC"); But it causes an error 1064 (SQL Syntax) Link to comment Share on other sites More sharing options...
Dan Cole Posted November 10, 2017 Share Posted November 10, 2017 @jampjamp Mick, doesn't that query just count the attributes? Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Omar_one Posted November 10, 2017 Share Posted November 10, 2017 @jampjamp Try find this $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$_GET['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); replace it with this $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$_GET['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . " ' ORDER BY pov.products_options_values_name ASC"); BR Omar Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
jampjamp Posted November 10, 2017 Author Share Posted November 10, 2017 Thanks @Omar_one I have in this part of code (int)$this->products_id instead of (int)$_GET['products_id'] but after this little change all works as I wanted. Thank you. Link to comment Share on other sites More sharing options...
Omar_one Posted November 10, 2017 Share Posted November 10, 2017 @jampjamp you are welcome.. you was close to get it work but you looked in the wrong places, as @Dan Cole asked about it Get the latest Responsive osCommerce CE (community edition) here . Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.