- Posts: 205
- Thank you received: 12
Empty categories message
-- Joomla version -- : 3.9.25
-- PHP version -- : 7.4.14
Hello
Some of our product categories have not any products for sale yet.
Is there a way to show a message to visitors of these categories to inform them that there are no products in the parent category for the moment?
Something like.. "Currently there are no products in this category..."
Thank you
Please Log in or Create an account to join the conversation.
Could you provide more information on the situation ?
I checked on your link and tried to select about 15 different categories and they all had products in them.
So I also used the text search to reduce the results to 0 and I did get a "no products found" message:
i.imgur.com/BGiGqlJ.png
So if you just want to change that text, you could use a translation override, but I suspect that you're talking about something else...
Please Log in or Create an account to join the conversation.
Please foollow the bellow link:
OUR_SITE.com/hikashop-menu-for-categories-listing
Now select category Deck / Ropes (third from the bottom to the top)
When you open this category to view the products in it, it shows absolutely nothing. We want to show the message when someone goes there through the categories list.
Thank you.
Please Log in or Create an account to join the conversation.
First you have to understand how to customize your view file, via the HikaShop Override system, and so have a look on this documentation .
Then, we will guide you to perform this override, first you have to create an override view from the view Category/listing.
Around line 100, you will see this :
Hope this will help you to achieve what your requested.
Regards
Please Log in or Create an account to join the conversation.
Can we make it not show in the Brands categories?
Example...
When user is in a product details page, he sees the Manufacturer link. When clicking the manufacturer link he is transfered to a page that shows all the products from this manufacturer correctly, but right above the products it shows this message that is created by the modification you previously gave me.
Thank you
Please Log in or Create an account to join the conversation.
In order to refine our advice can you provide us with the following elements :
- An url to the context where the message is displayed when this isn't desired.
=> No need to have the current custom message display.
- A screenshot of this same context but with the Display view files option activate on Front-end
=> You will find this option from Main HikaShop Configuration => Advanced tab, first displayed option.
Awaiting your element to better answer you.
Regards
Please Log in or Create an account to join the conversation.
We need to show this message to all lowest level categories that do not have any products, no matter if you visit these categories by menu item or any other way.
Please Log in or Create an account to join the conversation.
Thanks for your elements, these allow us to progress on your subject, and so can you try this code :
Previously, I suggest you this :
Try this to see if that works better :
Hope this meet your expectations.
Regards
Please Log in or Create an account to join the conversation.
When i apply it in the script, the category listing page gives a page with the message... "0 syntax error, unexpected '}', expecting end of file".
I am not a coder, so is it possible to check?
Thank you
Please Log in or Create an account to join the conversation.
We check the code that we provide but it seems that our code didn't have any mistake or typo, from this and your reported error message it seems that you have forget an ";".
To be sure, go back to the default file, without modifications and just pasted this code (in the same line):
To have this, the addition of code is here in red :
...
if(!empty($html)) echo '<div class="hikashop_subcategories_listing">'.$html.'</div>';
if ((empty($html)) && (empty(!$this->module))) {
echo '<div class="hikashop_no_subcategories_listing">NO PRODUCT AVAILABLE</div>';
}
if(!$this->module){
...
We can highly recommend you to use a code editor, because this tool will spot this kind of little error.
Hope this will help you to progress.
Regards
Please Log in or Create an account to join the conversation.
Unfortunately with the new code the message does not show at all...
Here is the code as it has been entered to listing.php
Let me try to explain better what we need.
We have a multi level category tree and only the bottom level categories contain products.
Example:
Category1
- Subcategory1
- Sub-Subcategory1
- Sub-Subcategory2
- Sub-Subcategory3
- ...
Only Sub-Subcategories contain products
Visitors can access these Sub-Subcategories 2 ways.
- By clicking on a menu item that links directly to the Sub-Subcategory
- By following the categories list menu item, and reach the Sub-Subcategory step by step
Example:
Menu item link to Sub-Subcategory: There is no message at all. The page shows nothing!
Step by step following the categories till we reach the bottom level category: There is no message at all. The page shows nothing!
Thank you
Please Log in or Create an account to join the conversation.
Sorry for this but I have made a mistake, really sorry for this, I analyze deeper the solution let's restart from scratch, follow me step by step :
- First don't use category/Listing view but rather the product/Listing
- Go around line 270, find this code :
Code view :
The part underlined in red is the one that must be deleted.
- Remove the part after the "...|| $ctrl == 'category') && $task == 'listing' ", to have this :
This solution is a little tricky but must better fit your needs, and will display automatically a message thanks to this code :
Regards
Please Log in or Create an account to join the conversation.
Thank you! Everything is Ok now and no worries. What matters is that you have the will to help.
Thank you again.
Please Log in or Create an account to join the conversation.
1. Did as you wrote.
But for some reason it does not show correctly.
For some reason, the text does not say that there is no such product.
____________________________________________________
2. How to make sure that by entering these two searches, if the product is written incorrectly, it will be written: "There is no such product in this category"?
Please Log in or Create an account to join the conversation.
You have a translation issue.
The icon there will only display if there are no results and in that case, it will display the text for the translation key HIKASHOP_NO_RESULT next to it.
So that means that in your HikaShop translation file, you have the line:
HIKASHOP_NO_RESULT=""
which results in no message displayed.
But in the HikaShop English translation file (the main one), we have this:
HIKASHOP_NO_RESULT="No products found."
So you need to check your translations under the tab "Languages" of the HikaShop configuration and search for that translation key.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
You can try 2 differents solutions :
1. First in the relative Item Menu (with the Id 2723), go to Categories options tab, and in Category data display
=> Define the "Only with products" on "Yes"
Il the previous solution didn't work :
2. A custom css command to directl hide this part for required context.
Example :
.required_context_id1 .hikashop_submodules,
.required_context_id2 .hikashop_submodules {
// To hide unwanted "no product found" message
display: none;
}
Hope this will you to achieved what you need.
Regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I think it comes from the code in product / listing.php
By default you should now have:
Please Log in or Create an account to join the conversation.