1064 error when filter is switched on

  • Posts: 377
  • Thank you received: 7
11 years 1 month ago #127344

-- url of the page with the problem -- : tradeheatingspares.com/new2/Alpha-Boiler...ts/boiler-parts.html
-- HikaShop version -- : 2.2.2
-- Joomla version -- : 3.15

Hi, for some reason when i have my filter module published, on those pages i get a 404 error (attached). What i have done is create a new field type for product with checkbox as the select type and have added two values. I then created a module and selected my filter i wanted to display and published this on the front end however if i now navigate to any page it is supposed to be published on i get a 1064 error when trying to load it. I have tried adjusting a few bits to see if i can get it to show at all and it doesn't seem to want to show it.

I also have sh404 sef setup however if i turn this off that doesn't fix the error.

Any ideas would be great thanks as this is the first time i have tried working with custom field filters.

Thanks

Attachments:

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

  • Posts: 377
  • Thank you received: 7
11 years 1 month ago #127345

For your information i haven't left it published as this doesn't allow me to work on any other area of the site however if it needs to be turned on to figure out what is causing this then let me know and i will turn it on and leave it for you guys to evaluate.

Thanks.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 month ago #127394

Hi,

1064 error is a mysql error.
You should take a look in your PHP error log in order to have more details about the error.
You can also activate the joomla debug mode to see directly the error in the page and not redirect to an error 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: 377
  • Thank you received: 7
11 years 1 month ago #127403

Hi,

I have switched this on and there is a lot of information on there, I have also attached the error log. I am still none the wiser to be honest.

tradeheatingspares.com/new2/Worcester-Bo...cbi-natural-gas.html

Any ideas would be amazing thanks as i really don't know what is causing the issue.

Thanks

Alex

Attachments:
Last edit: 11 years 1 month ago by Dibben.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 month ago #127411

Hi,

The mysql error is not in your PHP error log.
But I saw some strange lines about the helper image that I will investigate.

Thanks to the Joomla debug mode, I found the SQL request with the error.
Please edit the file: "administrator/com_hikashop/classes/filter.php" and replace the code

		if(!empty($datas['products'])){
			$left=' LEFT JOIN '.hikashop_table('variant').' AS b ON a.characteristic_id=b.variant_characteristic_id ';
			foreach($datas['products'] as $data){
				$option_pid[$data->product_id]=$data->product_id;
			}
			$query='SELECT product_id FROM '.hikashop_table('product').' WHERE product_parent_id IN ('.implode(',',$option_pid).')';
			$database->setQuery($query);
			$results=$database->loadObjectList();
			foreach($results as $result){
				$result_pid[]=$result->product_id;
			}
			$optionElement='AND b.variant_product_id IN ('.implode(',', $result_pid).')';
		}
By:
		if(!empty($datas['products'])){
			$left=' LEFT JOIN '.hikashop_table('variant').' AS b ON a.characteristic_id=b.variant_characteristic_id ';
			$option_pid = array();
			foreach($datas['products'] as $data){
				$option_pid[$data->product_id]=$data->product_id;
			}
			$query='SELECT product_id FROM '.hikashop_table('product').' WHERE product_parent_id IN ('.implode(',',$option_pid).')';
			$database->setQuery($query);
			$results = $database->loadObjectList();
			$result_pid = array();
			foreach($results as $result){
				$result_pid[] = $result->product_id;
			}
			if(!empty($result_pid))
				$optionElement='AND b.variant_product_id IN ('.implode(',', $result_pid).')';
		}
It should fix your problem.

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: 377
  • Thank you received: 7
11 years 1 month ago #127415

Hi Jerome,

This doesn't seem to have worked.

I have attached the file i have edited just so you can see i edited correctly?

Thanks

Attachments:

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 month ago #127419

Hi,

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 'ORDER BY a.characteristic_ordering ASC' at line 1 SQL=EXPLAIN SELECT DISTINCT a.* FROM dkibz_hikashop_characteristic AS a LEFT JOIN dkibz_hikashop_variant AS b ON a.characteristic_id=b.variant_characteristic_id WHERE characteristic_parent_id= ORDER BY a.characteristic_ordering ASC

For this, I can't give you any code fix.

It looks like you doesn't set an option "filter_charac" in your filter.
So, because there is characteristic configured, the SQL request can't work.

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: 377
  • Thank you received: 7
11 years 1 month ago #127464

I see,

What i am trying to do is set a custom field so that when someone clicks to a product listing they can show only the 'burners' or show only the 'heat exchangers' to save the person time from looking through all the pages.

So what i have done so far is create a custom field - and added it to the product table (i guess this is the best place?) I have then also added a couple of test values to this custom field so that i can go add then to my product pages.

In the filter however i see no link between the drop down 'apply on' that relate to my custom field that i setup above.

But then in my module (attached) i have also added the 'product_types' filter to this...

My problem seems to be in linking the custom field to the filter...

Thanks

Alex

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 1 month ago #127521

Hi,

If you want to do a filter on a custom field, then you should select "custom field" in the "apply on" option of the filter.
I tried on my end with the 2.2.2 and I can select it. If you select characteristic instead, then you won't be able to have your filter on your custom field.

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

  • Posts: 377
  • Thank you received: 7
11 years 1 month ago #127672

Hi I see the custom field drop down, but this doesn't allow me to select my custom field, instead it is asking me to add new options. So if i put a few values in then great it shows on the front end but these values don't have any relationship to the products so i don't really understand again how i link the filer to the custom field and therefore filter the products based on this custom field? Do i need to re-enter the same values that match the values in the custom field? Sorry i did look at the documentation but it doesn't seem to go into that much detail on filtering.

Thanks

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 1 month ago #127704

You should keep the values empty and select the custom field in the "custom field" option that you can see in your screenshot.

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

  • Posts: 377
  • Thank you received: 7
11 years 1 month ago #127744

Hi Nicolas.

Thats what i was expecting to be able to do but the drop down is empty. I cannot see my custom field in there. Please see attached. Did i add my custom field to the wrong table or something?

Thanks

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
11 years 1 month ago #127807

Hi,

You should save your filter at least one time, then your filter will be able to load all the custom fields through the "custom fields" option.

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

Time to create page: 0.088 seconds
Powered by Kunena Forum