dedecms中调用ecshop产品

功能需求:在dedecms中调用ecshop系统中的产品

dedecms v5.7 + ecshop v2.7.2

/include/taglib/ecsonegood.lib.php

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

/**

* ecshop 单个产品调用

*

* @author http://www.heui.org

*/

function lib_ecsonegood(&$ctag,&$refObj)

{

global $dsql,$cfg_basehost;

$attlist="limit|1";

FillAttsDefault($ctag->CAttribute->Items,$attlist);

extract($ctag->CAttribute->Items, EXTR_SKIP);

$revalue = '';

$sql = "SELECT * FROM `ecs_goods` ORDER BY rand( ) LIMIT " . $limit;

$dsql->SetQuery($sql);

$dsql->Execute();

while($dbrow=$dsql->GetObject())

{

$url = $cfg_basehost.'/goods-'.$dbrow->goods_id.'.html';

$img = $cfg_basehost.'/'.$dbrow->goods_thumb;

$alt = cn_substr($dbrow->goods_name,$titlelen);

$revalue .= '<a href="'.$url.'" target="_blank"><img src="'.$img.'"

alt="'.$alt.'"></a>';

}

return $revalue;

}

模版标签如下:{dede:ecsonegood /}

http://www.heui.org/2011/05/dedecms%e4%b8%ad%e8%b0%83%e7%94%a8ecshop%e4%ba%a7%e5%93%81/

生气是拿别人做错的事来惩罚自己

dedecms中调用ecshop产品

相关文章:

你感兴趣的文章:

标签云: