|
Many times this has been asked how to get short desciption for product listing. Here it is in simple steps. Note: Besure to backup your files before making any changes. 1. Copy piece of code in includes/function/general.php // product description function tep_get_products_description($product_id, $language = '') { global $languages_id; if (empty($language)) $language = $languages_id; $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'"); $product = tep_db_fetch_array($product_query); return $product['products_description']; } // end product description 2. Modify templates/TEMPLATE_NAME/mainpage_modules/new_products.php Find, while ($new_products = tep_db_fetch_array($new_products_query)) { Add below it, $new_products_description = tep_get_products_description($new_products['products_id']); Find, $new_products['products_name'] . '<br>' . $products_price); Modify like below, $new_products['products_name'] . '<br>' . $products_price . '' . preg_replace('/sS*$/i', '', substr($new_products_description, 0, 200)) . '...'); * In above mod, I am setting product description to first 200 charecters. If you need more charecters, change 200 to required value. Note: Do not use, short description, if you are using tables, many formatted text in product desciption, that will damage layout. For support post your queries in CRE Loaded Forums
|