Post by mazman » Thu Dec 12, 2024 5:40 am

Version 3.0.4.0
Is there a way to remove the text "There are no products to list in this category"?
I have a category that is all custom made and so there are no actual products to show, but I have a slide show on that page showing some different past products.
Last edited by mazman on Sat Dec 14, 2024 5:47 am, edited 1 time in total.

New member

Posts

Joined
Sun Apr 03, 2022 5:20 am

Post by by mona » Thu Dec 12, 2024 4:56 pm

In the template file ( catalog/view/theme/default/template/product/category.twig ) it is this

Code: Select all

 	{% if not categories and not products %}
      <p>{{ text_empty }}</p>
      <div class="buttons">
        <div class="pull-right"><a href="{{ continue }}" class="btn btn-primary">{{ button_continue }}</a></div>
      </div>
      {% endif %}
In the language file (catalog/language/en-gb/product/category.php ) it is this

Code: Select all

$_['text_empty']        = 'There are no products to list in this category.';

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by paulfeakins » Fri Dec 13, 2024 8:22 pm

Can we consider this [SOLVED]?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by mazman » Fri Dec 13, 2024 9:33 pm

by mona wrote:
Thu Dec 12, 2024 4:56 pm
In the template file ( catalog/view/theme/default/template/product/category.twig ) it is this

Code: Select all

 	{% if not categories and not products %}
      <p>{{ text_empty }}</p>
      <div class="buttons">
        <div class="pull-right"><a href="{{ continue }}" class="btn btn-primary">{{ button_continue }}</a></div>
      </div>
      {% endif %}
In the language file (catalog/language/en-gb/product/category.php ) it is this

Code: Select all

$_['text_empty']        = 'There are no products to list in this category.';
Hmmm. First I blanked out the text in the category.php file listed and it had no effect at all. So second, I went to the category.twig file and commented out the code mentioned above and still no difference. Other changes that I've made to the page show up but that line remains.
I've cleared the cache in my browser, switched to a different browser, even checked on a phone that has never been to the site and it is still there.
It's not the end of the world, but its just a little aggrivation.

New member

Posts

Joined
Sun Apr 03, 2022 5:20 am

Post by nonnedelectari » Fri Dec 13, 2024 10:04 pm

clear your twig cache.

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by Joe1234 » Fri Dec 13, 2024 10:12 pm

The same thing annoyed me like crazy. I suggest you get an extension that hides the category itself if it is empty...my opinion...it's just as bad seeing an empty category as seeing that message...to me as a shopper screams poor upkeep with the shop.

If you've made edits cleared cache and not seeing a change sounds like you're editing the original file instead of the ocmod version in your storage directory.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by by mona » Sat Dec 14, 2024 12:35 am

mazman wrote:
Fri Dec 13, 2024 9:33 pm
Hmmm. First I blanked out the text in the category.php file listed and it had no effect at all. So second, I went to the category.twig file and commented out the code mentioned above and still no difference. Other changes that I've made to the page show up but that line remains.
I've cleared the cache in my browser, switched to a different browser, even checked on a phone that has never been to the site and it is still there.
It's not the end of the world, but its just a little aggrivation.
Definitely the right code. The issue is elsewhere.

1. A theme? this would change the /default/ part of the file path.
2. Using theme editor and OCMOD (and vqmod) ? - if you dont know exactly what everything does, it is best not to use them together as they can conflict.
3. Installed Lightning speed? - Need to refresh it for things to take effect.
4. Server caching? Your server may cache your site also.
5. Did not refresh modifications to take effect?
6. Made changes to the modification file and did refresh modifications.

There are many possibilities of where it is could be going wrong depending on your particular set up.
The code is right, so start there. You only need to do one (which you know) - I would prefer to comment out the twig myself, but either will work.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by mazman » Sat Dec 14, 2024 1:59 am

by mona wrote:
Sat Dec 14, 2024 12:35 am
mazman wrote:
Fri Dec 13, 2024 9:33 pm
Hmmm. First I blanked out the text in the category.php file listed and it had no effect at all. So second, I went to the category.twig file and commented out the code mentioned above and still no difference. Other changes that I've made to the page show up but that line remains.
I've cleared the cache in my browser, switched to a different browser, even checked on a phone that has never been to the site and it is still there.
It's not the end of the world, but its just a little aggrivation.
Definitely the right code. The issue is elsewhere.

1. A theme? this would change the /default/ part of the file path.
2. Using theme editor and OCMOD (and vqmod) ? - if you dont know exactly what everything does, it is best not to use them together as they can conflict.
3. Installed Lightning speed? - Need to refresh it for things to take effect.
4. Server caching? Your server may cache your site also.
5. Did not refresh modifications to take effect?
6. Made changes to the modification file and did refresh modifications.

There are many possibilities of where it is could be going wrong depending on your particular set up.
The code is right, so start there. You only need to do one (which you know) - I would prefer to comment out the twig myself, but either will work.
Going through options 1-6 above, the only question mark is #4. All others I've done or do not apply. Is there actually an extenstion that does this?

New member

Posts

Joined
Sun Apr 03, 2022 5:20 am

Post by mazman » Sat Dec 14, 2024 5:45 am

Well I was editing the files directly through FTP when things were not working.
I went into the admin>design>theme editor>product>category.twig, made the edit there and it worked immediately.
Thanks as always for all the input!

New member

Posts

Joined
Sun Apr 03, 2022 5:20 am
Who is online

Users browsing this forum: Bing [Bot] and 25 guests