- Posts: 256
- Thank you received: 2
How To Display A Message When Category Is Empty
- dancingkazzaf
-
Topic Author
- Offline
Less
More
11 years 9 months ago #183677
by dancingkazzaf
How To Display A Message When Category Is Empty was created by dancingkazzaf
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
Is it possible to automatically show a message when there aren't any products in a category? Something like "We're sorry, there aren't any products here at the moment, please check back later".
I've tried a few solutions from other (older) posts but none of them worked with this version of HikaShop.
Any help would be greatly appreciated,
Thanks.
-- Joomla version -- : 3.3.6
Is it possible to automatically show a message when there aren't any products in a category? Something like "We're sorry, there aren't any products here at the moment, please check back later".
I've tried a few solutions from other (older) posts but none of them worked with this version of HikaShop.
Any help would be greatly appreciated,
Thanks.
Please Log in or Create an account to join the conversation.
11 years 9 months ago - 11 years 9 months ago #183686
by Xavier
Replied by Xavier on topic How To Display A Message When Category Is Empty
Hi,
You can potentially edit the view "product / listing_div" and at the end add:
You can potentially edit the view "product / listing_div" and at the end add:
Code:
<?php else{echo "We're sorry, there aren't any products here at the moment, please check back later";} ?>
Last edit: 11 years 9 months ago by Mohamed Thelji.
The following user(s) said Thank You: dancingkazzaf
Please Log in or Create an account to join the conversation.
- dancingkazzaf
-
Topic Author
- Offline
Less
More
- Posts: 256
- Thank you received: 2
11 years 9 months ago #183927
by dancingkazzaf
Replied by dancingkazzaf on topic How To Display A Message When Category Is Empty
Hi Xavier,
Thanks for your reply. I've just tried this but when I add the code at the bottom of the file it make the pages lose all formatting and they seem to lose all CSS styling too (see attached screenshots of before and after).
Do you have any other ideas?
Thank you.
Thanks for your reply. I've just tried this but when I add the code at the bottom of the file it make the pages lose all formatting and they seem to lose all CSS styling too (see attached screenshots of before and after).
Do you have any other ideas?
Thank you.
Please Log in or Create an account to join the conversation.
11 years 9 months ago #183939
by nicolas
Replied by nicolas on topic How To Display A Message When Category Is Empty
Hi,
This indicates an error in the code.
Please do a screenshot of the modification you made in the listing_div view file so that we can see what you did.
This indicates an error in the code.
Please do a screenshot of the modification you made in the listing_div view file so that we can see what you did.
The following user(s) said Thank You: dancingkazzaf
Please Log in or Create an account to join the conversation.
- dancingkazzaf
-
Topic Author
- Offline
Less
More
- Posts: 256
- Thank you received: 2
11 years 9 months ago #184098
by dancingkazzaf
Replied by dancingkazzaf on topic How To Display A Message When Category Is Empty
Here is the screenshot of how I implemented the code. I put the code at the end of the file as suggested earlier.
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
11 years 9 months ago #184113
by Mohamed Thelji
Replied by Mohamed Thelji on topic How To Display A Message When Category Is Empty
Can you replace that line :
By :
Code:
<?php else{echo "We're sorry, there aren't any products here at the moment, please check back later"} ?>
Code:
<?php else{echo "We're sorry, there aren't any products here at the moment, please check back later";} ?>
The following user(s) said Thank You: dancingkazzaf
Please Log in or Create an account to join the conversation.
- dancingkazzaf
-
Topic Author
- Offline
Less
More
- Posts: 256
- Thank you received: 2
11 years 9 months ago #184220
by dancingkazzaf
Replied by dancingkazzaf on topic How To Display A Message When Category Is Empty
Hi, thanks for your reply.
Unfortunately this code brings the same error as before. Is it possible i've put the code in the wrong place? It is right at the end of the listing_div file as seen in my earlier post.
Thanks.
Unfortunately this code brings the same error as before. Is it possible i've put the code in the wrong place? It is right at the end of the listing_div file as seen in my earlier post.
Thanks.
Please Log in or Create an account to join the conversation.
11 years 9 months ago #184228
by nicolas
Replied by nicolas on topic How To Display A Message When Category Is Empty
Try to remove the code:
?>
<?php
before the echo after doing your modification.
Maybe PHP doesn't like having the else statement cut from the if statement like that
?>
<?php
before the echo after doing your modification.
Maybe PHP doesn't like having the else statement cut from the if statement like that
The following user(s) said Thank You: dancingkazzaf
Please Log in or Create an account to join the conversation.
- dancingkazzaf
-
Topic Author
- Offline
Less
More
- Posts: 256
- Thank you received: 2
11 years 8 months ago #185543
by dancingkazzaf
Replied by dancingkazzaf on topic How To Display A Message When Category Is Empty
Thank you for your reply, I have the message appearing now, although it is also appearing on the 'categories listing' pages too (see link:
www.treasurefindersuk.com/our-products/jewellery-and-gold
) where as we only need it to show on 'product listing' pages.
Is there anything I can do to stop it showing on the 'categories listing' pages?
Is there anything I can do to stop it showing on the 'categories listing' pages?
Please Log in or Create an account to join the conversation.
11 years 8 months ago #185579
by Xavier
Replied by Xavier on topic How To Display A Message When Category Is Empty
Hi,
You can potentially use that code instead:
And in the array, you can add more values for the parent categories, for example add the id of the parent categories of the categories "Gold Jewellery, Silver Jewellery, Gold Collectables", etc.
You can potentially use that code instead:
Code:
elseif(!in_array(hikashop_getCID('category'),array('2'))){
echo "We're sorry, there aren't any products here at the moment, please check back later";
}
And in the array, you can add more values for the parent categories, for example add the id of the parent categories of the categories "Gold Jewellery, Silver Jewellery, Gold Collectables", etc.
The following user(s) said Thank You: dancingkazzaf
Please Log in or Create an account to join the conversation.
- dancingkazzaf
-
Topic Author
- Offline
Less
More
- Posts: 256
- Thank you received: 2
11 years 8 months ago #186308
by dancingkazzaf
Replied by dancingkazzaf on topic How To Display A Message When Category Is Empty
Thank you very much, this is working perfectly!
Please Log in or Create an account to join the conversation.
Time to create page: 0.227 seconds