Skip to main content

Add Message In Empty Category

More
13 years 9 months ago #82130 by MyWorld
Is it possible to add a message when there are no products in a category? I know I can hide the category if there are no products but the client does not want to hide it instead would prefer a message something like "Sorry no products at this time".

Thanks!!

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

More
13 years 9 months ago #82315 by Xavier
Yes it's possible, you have to edit the view "category / listing" in HikaShop > Display > views and if there is no elements in the var "$this->fields" then display the message.

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

More
13 years 8 months ago #86823 by MyWorld
Sorry but I'm looking at the code but not sure what to do :huh:

I see the below what should I do here?

if(!empty($this->fields)){ ?>


Thanks!!

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

More
13 years 8 months ago #86879 by Xavier
Try to use this code:
Code:
if(empty($this->fields)) echo JText::_('NO_PRODUCTS_AT_THIS_TIME');

And add the translation: NO_PRODUCTS_AT_THIS_TIME="Sorry no products at this time"
in the translation override file:
www.hikashop.com/fr/support/documentation/faq.html#translation

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

More
13 years 7 months ago #92712 by MyWorld
Hi Xavier,

I add the code you provided as per below and it works but it's also add the line "Additional Information" not sure why that is?
Code:
<?php } if(empty($this->fields)) echo JText::_('NO_PRODUCTS_AT_THIS_TIME');{ ?>

Sorry no products at this time
Additional information

Thanks!!

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

More
13 years 6 months ago #92826 by Xavier
First of all, you have to remove the "{" at the end of your code, it will return an error.
Or use:
Code:
if(empty($this->fields)){ echo JText::_('NO_PRODUCTS_AT_THIS_TIME'); }

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

More
11 years 6 months ago #196744 by MiloW
Replied by MiloW on topic Add Message In Empty Category
Hello,

I changed line 70 or something
if(empty($this->fields)) echo JText::_('NO_PRODUCTS_AT_THIS_TIME');

and added translation but now it shows on every page, not only on category page without products. Where's my error?

I edited category > listing.

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

More
11 years 6 months ago #196748 by Xavier
Hi,

The error is that this modification allow to display a message if there is no subcategories, not if there is no products in the category.

So in your case the edition of the view "product / listing" seems to be more appropriate.
You should find existing topics about that in the forum :)

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

More
11 years 6 months ago #196835 by MiloW
Replied by MiloW on topic Add Message In Empty Category
Couldn't find any. Too many with vague topics.

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

More
11 years 6 months ago #196896 by Xavier
Hi,

Please add the following code at the end of the view:
Code:
if(($this->module || (!$this->module && empty($this->modules))) && empty($this->rows)) echo 'here';
The following user(s) said Thank You: MiloW

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

More
11 years 6 months ago #196918 by MiloW
Replied by MiloW on topic Add Message In Empty Category
Great, thank you!

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

Time to create page: 0.242 seconds
Powered by Kunena Forum