ecshop如何调用商品属性在任何页面方法
日期:2016-06-20
第一步:打开includes\lib_insert.php文件在最后面的?>上面加上:
{insert name='attr' aid=属性id gid=商品编号} 调用商品的属性值
{insert name='attr' aid=属性id} 调用商品的属性名
/** * 调用商品属性 * * @access public * @return string */ function insert_attr($arr) { static $static_NULL $aid = isset($arr['aid']) ? $arr['aid'] : 0; $gid = isset($arr['gid']) ? $arr['gid'] : 0; if ($aid == 0) { return ''; } if ($static_res[$aid][$gid] === NULL) { if ($gid > 0) { $static_res[$aid][$gid] = $GLOBALS['db']->getOne('SELECT attr_value FROM ' . $GLOBALS['ecs']->table('goods_attr') . " WHERE attr_id = '$aid' AND goods_id = '$gid'"); } else { $static_res[$aid][$gid] = $GLOBALS['db']->getOne('SELECT attr_name FROM ' . $GLOBALS['ecs']->table('attribute') . " WHERE attr_id = '$aid'"); } } return $static_res[$aid][$gid]; }第二步:直接在模板中,无论是dwt还是lib中调用,调用方法:
{insert name='attr' aid=属性id gid=商品编号} 调用商品的属性值
{insert name='attr' aid=属性id} 调用商品的属性名
本文原创地址:https://www.ecshopok.com/article-283.html
版权所有 © 转载时必须以链接形式注明出处!
觉得本文对您有用,想收藏下来!方法很简单:请点击-〉
我们一直坚持白天工作、晚上熬夜更新资源,付出了巨大的精力和时间,其中的辛酸难以言述。
暂无评论,来发表一个吧