How to add a description to the homepage latest products
Adding description text to the Homepage Latest Products similar to the product list on the Category pages, is fairly simple. It only required two files to be edited, one file in the core CubeCart system, and the other in the skin.
Core PHP Modification
Find: /includes/content/index.inc.php
Search for :
$latestProducts = $db->select("SELECT productId, image, price, name, sale_price FROM ".$glob['dbprefix']."CubeCart_inventory WHERE `showFeatured` = 1 ORDER BY productId DESC LIMIT ".$config['noLatestProds']);
Add 'description' to the query:
$latestProducts = $db->select("SELECT productId, description, image, price, name, sale_price FROM ".$glob['dbprefix']."CubeCart_inventory WHERE `showFeatured` = 1 ORDER BY productId DESC LIMIT ".$config['noLatestProds']);
Search for:
$index->assign("VAL_PRODUCT_NAME",validHTML($latestProducts[$i]['name']));
Add directly below:
// MOD to add LATEST PRODUCTS descriptions - BEGIN
$index->assign("TXT_DESC",substr(strip_tags($latestProducts[$i]['description']),0,$config['productPrecis'])."…");
// MOD to add LATEST PRODUCTS descriptions - END
Skin HTML Modification
Find: /skins/SKIN_NAME/styleTemplates/content/index.tpl
Search for:
<!-- BEGIN: repeat_prods -->
<div class="latestProds">
and
</div>
<!-- END: repeat_prods -->
Paste the following code somewhere between the BEGIN and END.
{TXT_DESC}
Positioning within that area, and the styling is up to you.
|