Page 1 of 1

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

Posted: 12 Nov 2020, 17:09
by fab966
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:
components/com_phocacart/views/category/tmpl/default_header.php
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!!!!

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

Posted: 12 Nov 2020, 20:10
by Jan
Hi, thank you for your guide.

Jan