You are here:  » Product description null or blank


Product description null or blank

Submitted by D.Tzortzis on Thu, 2015-06-11 07:33 in

Goodmorning,

I need a litle help when the Product Description is Null or Blank (no value), i need into the HTML View to return a text "No Product Description".

Thanks,
Dimitrios Tzortzis.

Submitted by support on Thu, 2015-06-11 08:02

Hello Dimitrios,

Probably the best thing to do, so you don't need to make any changes to your theme and it will apply wherever description is displayed, is to add a new filter - Search and Replace RegExp which can be found in this comment. With that in place, add a new Global Filter to the Description field, and in the Search box on the configuration page for the filter enter:

^$

...and in the Replace box, the alternative text you want to use:

No Product Description

In a regular expression, ^ is the beginning of line anchor, and $ is the end of line anchor so ^$ will only match an empty value.

If you would prefer to hard code the changes into your product page HTML module, simply edit html/product.php and look for the following code:

$mainProduct = $product["products"][0];

...and REPLACE with:

$mainProduct = $product["products"][0];if (!$mainProduct["description"]) $mainProduct["description"] = "No Product Description";

Cheers,
David.
--
PriceTapestry.com