How to Add 'No Products to Display' Text for an Empty Category

  • Posts: 73
  • Thank you received: 8
  • Hikaserial Standard Hikashop Business Hikashop Essential
3 years 7 months ago #322759

I have been searching this forum for an answer but couldn't find anything that worked, so I wonder if someone can help me with this...

I want to add a message that says 'There are no products in this category' or something like that when the user looks at an empty category.

I got as far as creating a line in the language file called NO_PRODUCTS_AT_THIS_TIME with a value and guess it needs to go in views > product > listing.php but I really don't know how or where to add it.

I'd be so grateful for any help.

Thanks
Leila

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

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
3 years 7 months ago #322761

Hi,

There is already such code in product / listing.php:

echo '<div class="hk-well hika_no_products"><i class="fa fa-search"></i> ' . JText::_('HIKASHOP_NO_RESULT') . '</div>';
However, it is set to display only after you use a filter, not when there are no products in the category.
But you can change that.
For it to appear also when there are products in the category, you can change the line:
} elseif(( !$this->module || hikaInput::get()->getVar('hikashop_front_end_main',0) ) && ($ctrl == 'product'  || $ctrl == 'category') && $task == 'listing' && !empty($this->filters) && is_array($this->filters) && count($this->filters) && !empty($this->filter_set)) {
to:
} elseif(( !$this->module || hikaInput::get()->getVar('hikashop_front_end_main',0) ) && ($ctrl == 'product'  || $ctrl == 'category') && $task == 'listing') {

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

  • Posts: 73
  • Thank you received: 8
  • Hikaserial Standard Hikashop Business Hikashop Essential
3 years 7 months ago #322795

Perfect! Thank you Nicolas.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum