Add latest comments to Ecshop, Ecshop add latest comments
I write the procedure directly, look at the idea, I believe we will also
The first step:
Build a custom function inside includes/lib_goods.php
Copy the Code code as follows:
/**
* Get Recent comments
*
* @return Array
*/
function get_latest_comment ($limit _num)
{
$sql = "Select C.content,c.add_time,g.goods_id,g.goods_name from". $GLOBALS [' ECS ']->table (' comment '). As C
Left JOIN ". $GLOBALS [' ECS ']->table (' goods ')." As G on c.id_value=g.goods_id
WHERE C.status=1
LIMIT ". $limit _num;
$res = $GLOBALS [' db ']->getall ($sql);
return $res;
}
Step Two:
In the root directory of the goods.php $smarty->assign (' Goods_rank ', Get_goods_rank ($goods _id)); Sales ranking of products
Add the following code below
Copy the Code code as follows:
$smarty->assign (' Comments_latest ', Get_latest_comment (10)); Get the latest product theory
Step Three:
Create a Comments_latest.lbi file in the library directory
Fourth Step:
Use the following code in the template file goods.dwt to invoke the "latest comment" in the Product detail page
Copy the Code code as follows:
http://www.bkjia.com/PHPjc/939408.html www.bkjia.com true http://www.bkjia.com/PHPjc/939408.html techarticle Add the latest comments to Ecshop, ecshop Add the latest comments I directly write on the operation of the steps, look at the idea, I believe you will also be the first step: Build a custom inside the includes/lib_goods.php ...