ECshop 任意页面(商品页面)调用商品类型自定义属性 -云主机博士

ECshop 任意页面(商品页面)调用商品类型自定义属性 -云主机博士 第1张

ECshop 默认的商品自定义属性是一次性输出的,想要单独调用某个属性就需要动动手术了。

第一步:打开 includes\lib_insert.php 文件,在最后面 ?> 前面加入以下代码:注意,在在 ?> 前面。

/*调用商品属性*/
function insert_attr(ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: arr)
{
staticstatic_res = NULL;
aid= isset(aid=isset(arr['aid'])?arr['aid']:0;arr[′aid′]:0;gid= isset(arr['gid'])?arr[′gid′])?arr['gid']:0;
if(aid==0) return '';if (aid==0)return′′;if(static_res[aid][aid][gid] === NULL)
{
if(ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: gid>0)
{static_res[aid][aid][gid] = GLOBALS['db']->getOne('select attr_value from ' .GLOBALS[′db′]−>getOne(′selectattrvaluefrom′.GLOBALS['ecs']->table('goods_attr') . " where attr_id ='aid' and goods_id='aid′andgoodsid=′gid' "); 
}
else
{
static_res[staticres[aid][gid] =gid]=GLOBALS['db']->getOne('select attr_name from ' . GLOBALS['ecs']->table('attribute') . " where attr_id ='GLOBALS[′ecs′]−>table(′attribute′)."whereattrid=′aid' ");
}
}

return static_res[staticres[aid][$gid];
}

每二步:在模板里调用,支持dwt与lib。
属性名称:{insert name='attr' aid=属性ID}
属性值:{insert name='attr' aid=属性ID gid=$goods_id}

$goods_id 是调用商品编号,也就是ID,不是货号。

宝塔服务器面板,一键全能部署及管理,送你3188元礼包,点我领取


iproyal.png
原文链接:,转发请注明来源!
「ECshop 任意页面(商品页面)调用商品类型自定义属性 -云主机博士」评论列表

发表评论