Add latest comments to Ecshop, Ecshop add latest comments _php Tutorials

Source: Internet
Author: User

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.