卖家推荐
/**
* 调用浏览历史
*
* @access public
* @return string
*/
function insert_history()
{
$str = '';
if (!empty($_COOKIE['ECS']['history']))
{
$where = db_create_in($_COOKIE['ECS']['history'], 'goods_id');
$sql = 'SELECT goods_id, goods_name, goods_thumb FROM ' . $GLOBALS['ecs']->table('goods') .
" WHERE $where AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0";
$query = $GLOBALS['db']->query($sql);
$res = array();
while ($row = $GLOBALS['db']->fetch_array($query))
{
$res[$row['goods_id']] = $row;
}
$tureorder = explode(',', $_COOKIE['ECS']['history']);
foreach ($tureorder AS $key => $val)
{
$goods_name = htmlspecialchars($res[$val]['goods_name']);
$goods_thumb = htmlspecialchars($res[$val]['goods_thumb']);
if ($goods_name)
{
$short_name = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($goods_name, $GLOBALS['_CFG']['goods_name_length']) : $goods_name;
$str .= '

' . $short_name . '';
}
}
}
return $str;
}