[SOLVED] PhocaCart: show a text if a Category is empty

Phoca Cart - complex e-commerce extension
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 26 Oct 2015, 15:51

[SOLVED] PhocaCart: show a text if a Category is empty

Post by fab966 » 12 Nov 2020, 17:09

As usual, customers want something that not exist...
They asked me to show a text message in Category Description if the Category has no published Products.
They want to show the Category even without Products (for a few days).

This is my solution:

I did an override of this file:
and I wrote this conditional at the end of PHP script, just before PHP closing TAG "?>":

Code: Select all

if (empty($this->items)) {
	echo '<p class="empty-category">' . JText::_('COM_PHOCACART_CAT_NO_PRODUCTS') . '</p>';
I had get this IF(...) from the file: components/com_phocacart/views/category/tmpl/default.php.

Than you have just to create a Language Override (on Site side) in Language Manager of Joomla.
Some easy and fine CSS rules and... Finish!

I hope it can be helpful for others.
PhocaCart Ver. 3.4.0, but it is the same on 3.5.3 too.

Great Extension!!!!


User avatar
Phoca Hero
Phoca Hero
Posts: 44104
Joined: 10 Nov 2007, 18:23
Location: Czech Republic

Re: [SOLVED] PhocaCart: show a text if a Category is empty

Post by Jan » 12 Nov 2020, 20:10

Hi, thank you for your guide.

If you find Phoca extensions useful, please support the project

Post Reply