Displaying products from specific custom field

  • Posts: 232
  • Thank you received: 4
  • Hikaserial Standard Hikashop Business
7 years 6 months ago #282509

-- url of the page with the problem -- : thhs.under-development.info/
-- HikaShop version -- : 3.2.1
-- Joomla version -- : 3.8.2

Hello,
I have created a custom field within the products table. This will either be a 1 or 0 value entered.

I then have a HikaShop content module set to display the products ordered on that field. I have limited the display to only 10 products but more than this have been assigned the 1 value in the custom field.

Is it possible to randomly select and display those products that have been assigned the 1 value in the custom field?

When I choose random items as Yes it does not display only those products with the 1 value but random products from across all my categories.

Thanks

Attachments:

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

  • Posts: 83779
  • Thank you received: 13567
  • MODERATOR
7 years 6 months ago #282512

Hi,

With the random option turned off and the ordering direction in descending order, you'll get the products with 1 in that field before the products with 0 so that's a way of filtering.
But then, you can't have them display randomly.
If you configure a menu item instead of a module, with filters, it's possible to force such rule thanks to parameters in the URL.
For for a module, it's not possible to do that as filters only apply to menu items.
The last option is to develop a small hikashop plugin implementing the onBeforeProductListingLoad trigger to add your extra condition on that custom field when you want it:
www.hikashop.com/support/documentation/6...reProductListingLoad

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

  • Posts: 232
  • Thank you received: 4
  • Hikaserial Standard Hikashop Business
7 years 5 months ago #282829

Nicolas,
Thanks for the reply, most appreciated. I'm testing with a menu and cannot get it to display only the products with 1 in the custom field.

Could you advise on the menu options I need?

Lee

Attachments:

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

  • Posts: 83779
  • Thank you received: 13567
  • MODERATOR
7 years 5 months ago #282831

Hi,

You need to set the "sub element filter" setting to "all sub elements". Otherwise, it will only take into account the products directly linked to the category "product category" and not the products linked to sub categories of that category.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum