Skip to main content

SQL error message on filters

10 years 3 months ago #246156 by jouwnaambord.nl
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.5.9
-- Error-message(debug-mod must be tuned on) -- : 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 ':: DESC LIMIT 0, 8' at line 1 SQL=SELECT DISTINCT b.* FROM #__hikashop_product_category AS a LEFT JOIN #__hikashop_product AS b ON a.product_id=b.product_id WHERE b.product_published=1 AND b.product_type = 'main' AND a.category_id IN (39,97,16,115,29,31,34,50,51,52,78,77,75,74,76,79,84,83,82,87,88,89,91,93,94,92,95,98,99,100,101,102,103,106,114,108,109,116,117,118,119,120,123,124,127,126,128,2) AND b.product_quantity!=0 AND (b.product_access = 'all' OR b.product_access LIKE '%,9,%') ORDER BY 30:: DESC LIMIT 0, 8

I get several SQL errors on different Filters. Some work fine, others don't (see Error message above). Can't figure out what's wrong?

Please Log in or Create an account to join the conversation.

10 years 3 months ago #246181 by nicolas
Hi,

Could you provide a link to the page with the filter so that we could reproduce the problem ?
Because we don't have the problem on our end with a filter configured like that.

What you could try changing is the code:
Code:
if(!empty($case)){ $select2.=' ,'.$case.' as product_'.$type.'_normalized'; if($infos[1]=='lth'){ $order= ' ORDER BY product_'.$type.'_normalized*1 ASC'; }else{ $order= ' ORDER BY product_'.$type.'_normalized*1 DESC'; } }else{ if($infos[1]=='lth'){ $order= ' ORDER BY '.$type.' ASC'; }else{ $order= ' ORDER BY '.$type.' DESC'; } }
to:
Code:
if(!empty($case)){ $select2.=' ,'.$case.' as product_'.$type.'_normalized'; if($infos[1]=='lth'){ $order= ' ORDER BY product_'.$type.'_normalized*1 ASC'; }elseif($infos[1]=='ftl'){ $order= ' ORDER BY product_'.$type.'_normalized*1 DESC'; } }else{ if($infos[1]=='lth'){ $order= ' ORDER BY '.$type.' ASC'; }elseif($infos[1]=='htl'){ $order= ' ORDER BY '.$type.' DESC'; } }
in the file administrator/components/com_hikashop/classes/filter.php
The following user(s) said Thank You: jouwnaambord.nl

Please Log in or Create an account to join the conversation.

10 years 3 months ago #246266 by jouwnaambord.nl
Hi, Nicolas,

Thanks, this works fine!
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.042 seconds
Powered by Kunena Forum