Menu filter empty 500 DB Error instead of just not filtering. #605

Closed
opened 2020-09-25 10:32:35 +00:00 by TLWebdesign · 1 comment
TLWebdesign commented 2020-09-25 10:32:35 +00:00 (Migrated from github.com)

Steps to reproduce the issue

I'e created a category filter for a menu item per the instruction video of Mohamed Abdelaziz.
https://www.youtube.com/watch?v=YZc0fV-SOhs
In the menu item itself i didn't select any category because i want it to display all on a top level menu-items and then in the submenu items i want to filter this view with specific categories.

Expected result

To just display all items because there is no filter available.

Actual result

ERORR: 500 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 0, 20' at line 1

System information (as much as possible)

  • OS Name & Version:
  • MySql Version: Mariadb 10.3.x
  • Apache Version:
  • PHP Version: 7.3.x
  • Joomla Version: 3.9.21
  • JCB Version: 2.11.4
  • Browser: Firefox 80.0.1

Additional comments

in the dynamic get when adding the filter it does this:

	$array = $this->state->get('parameters.menu')->get('catid');
	if (isset($array) && [[[component]]]Helper::checkArray($array))
	{
		$query->where('a.catid IN (' . implode(',', $array) . ')');
	}
	else
	{
		return false;
	}

Why do we have that else return false? Because that is what is breaking things. commenting out return false gives me the expected behaviour.

### Steps to reproduce the issue I'e created a category filter for a menu item per the instruction video of Mohamed Abdelaziz. https://www.youtube.com/watch?v=YZc0fV-SOhs In the menu item itself i didn't select any category because i want it to display all on a top level menu-items and then in the submenu items i want to filter this view with specific categories. ### Expected result To just display all items because there is no filter available. ### Actual result ERORR: 500 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 0, 20' at line 1 ### System information (as much as possible) - OS Name & Version: - MySql Version: Mariadb 10.3.x - Apache Version: - PHP Version: 7.3.x - Joomla Version: 3.9.21 - JCB Version: 2.11.4 - Browser: Firefox 80.0.1 ### Additional comments in the dynamic get when adding the filter it does this: $array = $this->state->get('parameters.menu')->get('catid'); if (isset($array) && [[[component]]]Helper::checkArray($array)) { $query->where('a.catid IN (' . implode(',', $array) . ')'); } else { return false; } Why do we have that else return false? Because that is what is breaking things. commenting out return false gives me the expected behaviour.
TLWebdesign commented 2020-09-25 11:47:54 +00:00 (Migrated from github.com)

Nevermind. i didn't notice the allow empty option.... Wow i need a vacation!

Nevermind. i didn't notice the allow empty option.... Wow i need a vacation!
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#605
No description provided.