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

PikPak安卓最新版APP v1.46.2_免费会员兑换邀请码【508001】可替代115网盘_全平台支持Windows和苹果iOS&Mac_ipad_iphone -云主机博士 第1张

推荐阅读:

[AI-人工智能]免翻墙的AI利器:樱桃茶·智域GPT,让你轻松使用ChatGPT和Midjourney - 免费AIGC工具 - 拼车/合租账号 八折优惠码: AIGCJOEDISCOUNT2024

[AI-人工智能]银河录像局: 国内可靠的AI工具与流媒体的合租平台 高效省钱、现号秒发、翻车赔偿、无限续费|95折优惠码: AIGCJOE

[AI-人工智能]NexGenAI - 您的智能助手,最低价体验ChatGPT Plus共享账号

[AI-人工智能]边界AICHAT - 超级永久终身会员激活 史诗级神器,口碑炸裂!300万人都在用的AI平台

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 任意页面(商品页面)调用商品类型自定义属性 -云主机博士」评论列表

发表评论