VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: gpullen on August 29, 2012, 14:19:47 PM

Title: Message displayed for Empty Categories?
Post by: gpullen on August 29, 2012, 14:19:47 PM
Hi,

Is it possible to display a message when a category is empty?? I have searched but not found any answer for VM2!!

Please see the site in development here: http://new.bfplantsales.com/stock
When you go to an empty category, you just get a blank page!!

Thanks
Gareth
Title: Re: Message displayed for Empty Categories?
Post by: ivus on August 29, 2012, 17:03:31 PM
nice link. deosn't work.
Title: Re: Message displayed for Empty Categories?
Post by: gpullen on August 30, 2012, 13:43:05 PM
Hi,  sorry the temp domain was removed and site went live... please try   http://www.bfplantsales.com/stock

thanks
Title: Re: Message displayed for Empty Categories?
Post by: gpullen on September 04, 2012, 17:48:43 PM
Any ideas? thanks
Title: Re: Message displayed for Empty Categories?
Post by: ivus on September 05, 2012, 02:39:30 AM
Hi gpullen,

yeah you need to edit the following file "/components/com_virtuemart/views/category/tmpl/default.php" @ line 319 (right at the bottom). Look for :



<?php } elseif ($this->search !==null ) echo JText::_('COM_VIRTUEMART_NO_RESULT').($this->keyword' : ('$this->keyword')' '')
?>




change to :



<?php
} elseif ($this->search !==null ) {
echo JText::_('COM_VIRTUEMART_NO_RESULT').($this->keyword' : ('$this->keyword')' '');
} else {
echo 'CATEGORY EMPTY';
};
?>




I hope this helps.
Title: Re: Message displayed for Empty Categories?
Post by: Cornel on September 05, 2012, 07:47:11 AM
Why is this code NOT into the product yet........... every shop owner wants to give info to their customer.

Can this be proposed, so it will be in the next VM version ?
Title: Re: Message displayed for Empty Categories?
Post by: ocean1 on October 21, 2012, 21:43:58 PM
This is a better code I think.
Because when there are Child category's the text should not be visible for me.


<?php
} elseif ($this->search !==null ) {
echo JText::_('COM_VIRTUEMART_NO_RESULT').($this->keyword' : ('$this->keyword')' '');
} elseif (!
$this->category->haschildren) {
echo 'CATEGORY EMPTY<br><a href = "javascript:history.back()">Back to previous page</a>';
};
?>

Title: Re: Message displayed for Empty Categories?
Post by: burnego on December 09, 2013, 13:58:18 PM
thanks ocean1. works great