VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: jchungerford on May 06, 2015, 23:57:47 PM

Title: No Products to Display in Sub Categories
Post by: jchungerford on May 06, 2015, 23:57:47 PM
Hi,

I am attempting to build a multi-vendor marketplace and there will be many times where products will not be listed within end-level sub-categories.  Currently, I have 3 category levels and am trying to figure out how I can list the phrase "There are currently no products to display within this category" on the frontend in bold font instead of just a blank area.  This should occur in the END-LEVEL sub category ONLY and not in any other upper categories.

Has anyone been successful in doing this?  Any advice would be most welcomed!


J3.4.1  VM3.0.8

Title: Re: No Products to Display in Sub Categories
Post by: GJC Web Design on May 07, 2015, 10:38:36 AM
something like


elseif (empty($this->products)&& empty($this->category->haschildren) ){

echo 'Nothing';


added after the

} elseif (!empty($this->keyword)) {
echo vmText::_ ('COM_VIRTUEMART_NO_RESULT') . ($this->keyword ? ' : (' . $this->keyword . ')' : '');
}


added in the category view template

untested
Title: Re: No Products to Display in Sub Categories
Post by: jchungerford on May 08, 2015, 00:31:23 AM
This works, kind of.   :o

There are three Levels to the VM Store.

1)  Homepage which has main categories

2) Sub Category of the Main Categories

3) Sub-sub categories of the 2nd Level Categories which contain products when these containers are selected.


NOW, with this code in place the "No Result" message shows like it is supposed to but unfortunately it shows in both 2) the 2nd level sub-categories, and 3) End level sub-sub categories.  I just need this message to show in the 3rd level sub-sub categories only as there will never be any products located within the 2nd level so that level should remain blank.

Any thoughts?
Title: Re: No Products to Display in Sub Categories
Post by: GJC Web Design on May 08, 2015, 09:22:58 AM
this is wrong->  empty($this->category->haschildren)

you need to check for products

perhaps  $this->showproducts   - look in the html.php of the view to see how this is deduced