偷得浮生半日闲 发表于 2012-4-18 10:50:53

dede模板中调用ecshop产品

怎么在dedecms模板中调用ecshop系统中的产品呢?可以使用下面的调用:
环境:dedecms v5.7 + ecshop v2.7.2
找到/include/taglib/ecsonegood.lib.php

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



/**
* ecshop 单个产品调用
*
* @author http://www.XXX.com */

functionlib_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,
                                    
         分页标题#e#$titlelen);

      $revalue.= '';
    }
    return$revalue;
}
页: [1]
查看完整版本: dede模板中调用ecshop产品