Category Filter not working correctly

  • Posts: 356
  • Thank you received: 7
  • Hikashop Business
1 year 9 months ago #343109

-- HikaShop version -- : 4.6.1
-- Joomla version -- : 4.1.5
-- PHP version -- : 7.4

When you try to select either category and press filter, it doesn't work. This also may be related to my other post

https://www.hikashop.com/forum/filters-search/904712-issue-with-displaying-all-the-categories-in-the-filter.html

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
1 year 9 months ago #343110

Hi,

I'm not sure why it's doing that. It's as if the server doesn't see the selection of the filter.
Could you provide a screenshot of the settings of the filter ?

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

  • Posts: 356
  • Thank you received: 7
  • Hikashop Business
1 year 9 months ago #343116

Hi please see attached.

Attachments:

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
1 year 9 months ago #343119

Can you empty the first "category" setting on the top left of the screen ?

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

  • Posts: 356
  • Thank you received: 7
  • Hikashop Business
1 year 9 months ago #343137

Hi,

When I do that, the filter filters products from that top level category and not any sub categories. Also again, on the front end it only shows two categories.

Attachments:

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
1 year 9 months ago #343139

Hi,

You also need to empty the "category" setting on the bottom right corner too. That should display all the categories.

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

  • Posts: 356
  • Thank you received: 7
  • Hikashop Business
1 year 9 months ago #343150

Hi,

Yes, but if I do that, I get the attached on the front end.

Attachments:

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
1 year 9 months ago #343165

Hi,

Ok. Add the code:

		} else {
			$filters[]='a.category_type='.$database->Quote('product');
after the line:
$orderby = 'a.category_ordering ASC';
in the file administrator/components/com_hikashop/classes/filter.php
That should make it display only the product categories and not other types of categories.

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

  • Posts: 356
  • Thank you received: 7
  • Hikashop Business
1 year 9 months ago #343181

HI,

I get:

Error:
Call to a member function Quote() on null

  at /home/sec/public_html/administrator/components/com_hikashop/classes/filter.php:1536
  at hikashopFilterTypeClass->getCategories(object(stdClass), '')
     (/home/sec/public_html/administrator/components/com_hikashop/classes/filter.php:1991)
  at hikashopRadioClass->display(object(stdClass), 'module_315', object(ProductViewProduct), '', 'checkbox', '[]')
     (/home/sec/public_html/administrator/components/com_hikashop/classes/filter.php:2725)
  at hikashopCheckboxClass->display(object(stdClass), 'module_315', object(ProductViewProduct), array('products' => array(object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass)), 'limits' => object(stdClass)))
     (/home/sec/public_html/administrator/components/com_hikashop/classes/filter.php:386)
  at hikashopFilterClass->displayFilter(object(stdClass), 'module_315', object(ProductViewProduct), array('products' => array(object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass)), 'limits' => object(stdClass)))
     (/home/sec/public_html/components/com_hikashop/views/product/tmpl/filter.php:144)
  at include('/home/sec/public_html/components/com_hikashop/views/product/tmpl/filter.php')
     (/home/sec/public_html/libraries/src/MVC/View/HtmlView.php:436)
  at Joomla\CMS\MVC\View\HtmlView->loadTemplate(null)
     (/home/sec/public_html/administrator/components/com_hikashop/helpers/helper.php:2722)
  at hikashopView->loadTemplate(null)
     (/home/sec/public_html/libraries/src/MVC/View/HtmlView.php:220)
  at Joomla\CMS\MVC\View\HtmlView->display(null)
     (/home/sec/public_html/administrator/components/com_hikashop/helpers/helper.php:2677)
  at hikashopView->display(null)
     (/home/sec/public_html/components/com_hikashop/views/product/view.html.php:29)
  at ProductViewProduct->display(null, object(Registry))
     (/home/sec/public_html/administrator/components/com_hikashop/helpers/helper.php:864)
  at hikashop_getLayout(object(hikashopBridgeController), 'filter', object(Registry), '')
     (/home/sec/public_html/modules/mod_hikashop_filter/mod_hikashop_filter.php:30)
  at include('/home/sec/public_html/modules/mod_hikashop_filter/mod_hikashop_filter.php')
     (/home/sec/public_html/libraries/src/Dispatcher/ModuleDispatcher.php:54)
  at Joomla\CMS\Dispatcher\ModuleDispatcher::Joomla\CMS\Dispatcher\{closure}('/home/sec/public_html/modules/mod_hikashop_filter/mod_hikashop_filter.php', null)
     (/home/sec/public_html/libraries/src/Dispatcher/ModuleDispatcher.php:57)
  at Joomla\CMS\Dispatcher\ModuleDispatcher->dispatch()
     (/home/sec/public_html/libraries/src/Helper/ModuleHelper.php:295)
  at Joomla\CMS\Helper\ModuleHelper::renderRawModule(object(stdClass), object(Registry), array('style' => 'gantry'))
     (/home/sec/public_html/libraries/src/Helper/ModuleHelper.php:167)
  at Joomla\CMS\Helper\ModuleHelper::renderModule(object(stdClass), array('style' => 'gantry'))
     (/home/sec/public_html/libraries/src/Document/Renderer/Html/ModuleRenderer.php:102)
  at Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render(object(stdClass), array('style' => 'gantry'))
     (/home/sec/public_html/libraries/gantry5/src/classes/Gantry/Framework/Platform.php:294)
  at Gantry\Framework\Platform->displayModule(object(stdClass), array('style' => 'gantry'))
     (/home/sec/public_html/libraries/gantry5/src/classes/Gantry/Framework/Platform.php:342)
  at Gantry\Framework\Platform->displayModules('sidebar-a', array('style' => 'gantry'))
     (/home/sec/public_html/libraries/gantry5/compat/vendor/twig/twig/src/Template.php:702)
  at Twig\Template->getAttribute(object(Platform), 'displayModules', array('sidebar-a', array('style' => 'gantry')), 'method')
     (/home/sec/public_html/cache/gantry5/rt_orion/twig/af/afed67b45f4d986ed8f880b95ad082b3bbd2740898e80f99878be270fe88762f.php:43)

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
1 year 9 months ago #343182

Ah right, you also need to move the line

		$database = JFactory::getDBO();
in that same function before the line:
$orderby = 'a.category_name ASC';

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

  • Posts: 356
  • Thank you received: 7
  • Hikashop Business
1 year 9 months ago #343202

Hi Nicolas,

Yes that worked thank you.

There are some more issues. See attached - "product category" still appears, is there any way to remove that? So the base level is product category then all sub categories.

Also, checking any category only shows the direct sub elements, not a All sub elements as the menu item is set to show? Is there a way to do that?

Attachments:

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
1 year 9 months ago #343203

Hi,

Unpublish that category and it won't appear there.

There is no option to make it show sub category products. The category filter can only filter using categories directly linked to the products.

You might want to do it differently. Instead of using a category filter, you could use a HikaShop content module configured to display your categories like the "categories on 2 levels" module which is preinstalled for you by HikaShop. Normally, you just have to enable it in the position you want via the Joomla modules manager.

The following user(s) said Thank You: grayt7

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

  • Posts: 356
  • Thank you received: 7
  • Hikashop Business
1 year 9 months ago #343243

Yeah that worked thanks.

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

Time to create page: 0.081 seconds
Powered by Kunena Forum