Use Product Name as Meta Description in ISC

Problem

By default, the Meta Description tag in Product page is always empty unless you define the meta description manually for each product.

<meta name="description" content="" />

Solution

Use product name to construct Meta Description tag automatically if the meta description is empty.

In /public_html/includes/classes/class.product.php

Find

$this->_prodmetadesc = $row['prodmetadesc'];

Replace

//===========================
// MOD START
// Use product name as meta deescription if meta deescription is empty
//===========================
// $this->_prodmetadesc = $row['prodmetadesc'];
if ($row['prodsaleprice'] > 0){
	$metaprice = $row['prodsaleprice'];
}else{
	$metaprice = $row['prodprice'];
}
$this->_prodmetadesc = 'Buy '.$row['prodname'].' for '.CurrencyConvertFormatPrice($metaprice).' with Free Shipping Worldwide (In Stock)';
// MOD END
//===========================

Result

<meta name="description" content="Buy IBM Lenovo Motherboard 11 Pin to Standard 9 Pin USB Adapter Cable for $9.99 with Free Shipping Worldwide (In Stock)">

1 Reply to “Use Product Name as Meta Description in ISC”

Leave a Reply

Your email address will not be published. Required fields are marked *