News:

Looking for documentation? Take a look on our wiki

Main Menu

Display category description in categories with no products

Started by barbara, October 16, 2021, 20:40:44 PM

Previous topic - Next topic

barbara

Hi
I`m sure this is an easy fix, but I cant seem to find it.

I have several categories which do not have products in them - but I would like the category description to load when the category is selected.

right now if i click on a category which has no products from the categories browse page the category page url loads, but there is no description for the category.

As soon as I add a product the description loads.

Any help getting the description to load without active products would be greatly appreciated.

GJC Web Design

standard template?

try removing the

if(!empty($this->category)) {

line 56  components\com_virtuemart\views\category\tmpl\default.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

vmfyelloq19

- Make a template override for com_virtuemart (never edit core files as you will loose any changes on next update)
- Edit .../htdocs/templates/[yourtemplate]/html/com_virtuemart/category/default.php
- Look for if (!empty($this->products)) around line 167
- Look for the corresponding line } elseif ($this->keyword !== false) { around line 182
- Before or after the following line echo vmText::_ ('COM_VIRTUEMART_NO_RESULT') . ($this->keyword ? ' : (' . $this->keyword . ')' : '');
add
echo '<div class"category-description no-products">' . $this->category->category_description . '</div>';
(Use $this->category->category_name if you want that too)
- In your template's CSS file use .category-description.no-products { [your css declarations] } if required