Jump to content

Removing the ellipsis from a product's description


Guest james_starkie

Recommended Posts

Guest james_starkie

But it's not quite that simple, I only want the ellipsis to be removed when the product description is blank.

So it looks like this:

image1.jpg

image2.jpg

It's a minor detail, but I've been asked by a client if it's possible to do. I imagine it is, using an if statement, but my php knowledge isn't up to that standard.

Any help is appreciated.

(using latest version of CC btw.)

Link to comment
Share on other sites

Ok, this fix is off the top of my head and has not been tested, but it should work. :)

In /includes/content/viewCat.inc.php find this line:

$view_cat->assign("TXT_DESC",substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…");

Replace that line with these lines:

$tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…");

if($tmpdesc == "..." ) {

	$view_cat->assign("TXT_DESC","");

} else {

	$view_cat->assign("TXT_DESC",$tmpdesc);

}

:w00t:

Link to comment
Share on other sites

Ok, this fix is off the top of my head and has not been tested, but it should work. :)

In /includes/content/viewCat.inc.php find this line:

$view_cat->assign("TXT_DESC",substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…");

Replace that line with these lines:

:w00t:

$tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…");

if($tmpdesc == "..." ) {

	$view_cat->assign("TXT_DESC","");

} else {

	$view_cat->assign("TXT_DESC",$tmpdesc);

}




Nice Sir William, the "..." were buging me to. But there is an small error in this line:

$tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…");




the correct its this:


$tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis']."…");
Link to comment
Share on other sites

I think the correct is following:

$tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…";




OR just another condition




$tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis']);

if(empty($tmpdesc)) {

	$view_cat->assign("TXT_DESC","");

} else {

	$view_cat->assign("TXT_DESC",$tmpdesc."…");

}

SW made just programmer's typo, useless copied end parenthesis :w00t:

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...