前台商品详情都可以正常显示属性信息,但是打印订单和后台订单查询,都无法显示属性。
请帮忙解决。
___________________________________________________________________
order.php代码
$goods_attr[] = explode(' ', trim($row['goods_attr'])); //将商品属性拆分为一个数组
$goods_list[] = $row;
}
$attr = array();
$arr = array();
foreach ($goods_attr AS $index => $array_val)
{
foreach ($array_val AS $value)
{
$arr = explode(':', $value);//以 : 号将属性拆开
$attr[$index][] = @array('name' => $arr[0], 'value' => $arr[1]);
}
}
$smarty->assign('goods_attr', $attr);
$smarty->assign('goods_list', $goods_list);
————————————————————————————————————————————
{
/* 取得订单商品 */
$goods_list = order_goods($order_id);
foreach ($goods_list AS $key => $goods)
{
/* 计算属性数 */
$attr = $goods['goods_attr'];
if ($attr == '')
{
$goods_list[$key]['rows'] = 1;
}
else
{
$goods_list[$key]['rows'] = count(explode(chr(13), $attr));
}
}
$smarty->assign('goods_list', $goods_list);
————————————————————————————————————————————
order_pritn.html代码
<td><!-- 商品属性 -->
<!-- {foreach key=key from=$goods_attr[$key] item=attr} -->
<!-- {if $attr.name} --> {$goods.attr_name}:{$goods.attr_value} <!-- {/if} -->
<!-- {/foreach} --> </td>
新闻热点
疑难解答