Error: 1064 when click serial button in frontend

  • Posts: 57
  • Thank you received: 0
8 years 7 months ago #234002

-- HikaShop version -- : latest
-- HikaMarket version -- : latest

Error: 1064 when click serial button in frontend
screencast.com/t/sqWUwK9g2E

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 ') OR (serial.serial_pack_id IN (1) AND hk_order.order_type = 'subsale' AND hk_or' at line 1 SQL=SELECT COUNT(serial.serial_id) as count, serial.serial_pack_id, serial.serial_status FROM jos_hikaserial_serial AS serial LEFT JOIN jos_hikashop_order AS hk_order ON (serial.serial_order_id > 0 AND serial.serial_order_id = hk_order.order_parent_id) WHERE serial.serial_pack_id IN () OR (serial.serial_pack_id IN (1) AND hk_order.order_type = 'subsale' AND hk_order.order_vendor_id = 2) GROUP BY serial.serial_pack_id, serial.serial_status;

PHP Version 5.5.33
joomla 3.4
mysql 5.5.32

Last edit: 8 years 7 months ago by skyfranky.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 7 months ago #234021

Hi,

Thanks for the report.
It looks like the user do not have any pack and it generates that SQL error.

The easier would be to edit the file "components/com_hikaserials/views/serialsmarket/view.html.php"
And to replace

			if($target_vendor_id == 0) {
				$query = 'SELECT COUNT(serial.serial_id) as count, serial.serial_pack_id, serial.serial_status FROM '.hikaserial::table('serial').' AS serial '.
					' WHERE serial.serial_pack_id IN ('.implode(',', $pack_ids).') '.
					' GROUP BY serial.serial_pack_id, serial.serial_status;';
			} else {
By
			if($target_vendor_id == 0) {
				$query = 'SELECT COUNT(serial.serial_id) as count, serial.serial_pack_id, serial.serial_status FROM '.hikaserial::table('serial').' AS serial '.
					' WHERE serial.serial_pack_id IN ('.implode(',', $pack_ids).') '.
					' GROUP BY serial.serial_pack_id, serial.serial_status;';
			} else {
				if(empty($own_packs))
					$own_packs = array(0);
It would avoid the SQL issue.
I will improve the patch in order to display a message to the user instead of displaying an "empty" page.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 57
  • Thank you received: 0
8 years 7 months ago #234042

fix works, thanks

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

Moderators: Obsidev
Time to create page: 0.059 seconds
Powered by Kunena Forum