Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use ECShop to call the latest comments in the product details page

Shulou Source: shulou.com Published: 2022-06-03 18:51:36 10月02日 Update

This article introduces the knowledge of "how to use ECShop to call the latest comments in the product details page". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Let me just write down the operation steps and take a look at the train of thought. I believe you will also know it.

Step one:

Building custom functions in includes/lib_goods.php

The copy code is as follows:

/ * *

* get recent comments

*

* @ return array

, /

Function get_latest_comment ($limit_num)

{

$sql = "SELECT c. Contentrec. Addmaitytime.g.goodstimedline g.goodstimename 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 2:

$smarty- > assign ('goods_rank', get_goods_rank ($goods_id)) of goods.php in the root directory; / / ranking of sales of goods

Add the following code

The copy code is as follows:

$smarty- > assign ('comments_latest', get_latest_comment (10)); / / get the latest reviews

Step 3:

Create a comments_latest.lbi file in the library directory

Step 4:

Use the following code in the template file goods.dwt to call "latest comments" on the item details page

The copy code is as follows:

This is the end of the content of "how to use ECShop to invoke the latest comments on the product details page". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Code goods comments details pages content documents more knowledge practicality learning and then functions available in dilemmas actual ideas situations articles new products Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Microsoft Huawei MySQL Xiaomi