ecs_header("Location: ./\n"); exit; } $goods_info['goods_name'] = encode_output($goods_info['goods_name']); $goods_info['goods_brief'] = encode_output($goods_info['goods_brief']); $goods_info['promote_price'] = encode_output($goods_info['promote_price']); $goods_info['market_price'] = encode_output($goods_info['market_price']); $goods_info['shop_price'] = encode_output($goods_info['shop_price']); $goods_info['shop_price_formated'] = encode_output($goods_info['shop_price_formated']); $goods_info['goods_number'] = encode_output($goods_info['goods_number']); $smarty->assign('goods_info', $goods_info); $shop_price = $goods_info['shop_price']; $smarty->assign('rank_prices', get_user_rank_prices($goods_id, $shop_price)); // 会员等级价格 $smarty->assign('goods_info2', get_goods_info2($goods_id)); $smarty->assign('related_goods', get_linked_goods($goods_id)); $properties = get_goods_properties($goods_id); // 获得商品的规格和属性 $smarty->assign('properties', $properties['pro']); // 商品属性 $smarty->assign('footer', get_footer()); /* 查看商品图片操作 */ if ($act == 'view_img') { $smarty->assign('goods_desc', $goods_info['goods_desc']); $smarty->display('goods_img.dwt'); exit; } /* 检查是否有商品品牌 */ if (!empty($goods_info['brand_id'])) { $brand_name = $db->getOne("SELECT brand_name FROM " . $ecs->table('brand') . " WHERE brand_id={$goods_info['brand_id']}"); $smarty->assign('brand_name', encode_output($brand_name));
//获得投标记录 //$repayrecord = get_goods_repay($goods_id); //获得还款记录 /* 获取所属大类的名称 */ /*$sql = 'select a.cat_name from'.$ecs->table("category").' as a,'.$ecs->table("category").' as b where a.cat_id = b.parent_id and b.cat_id='.$goods["cat_id"]; $goods_row = $db->getRow($sql); $goods_row_catname = $goods_row['cat_name'];*/ if ($goods === false) { /* 如果没有找到任何记录则跳回到首页 */ ecs_header("Location: ./\n"); exit; } else { if ($goods['brand_id'] > 0) { $goods['goods_brand_url'] = build_uri('brand', array('bid' => $goods['brand_id']), $goods['goods_brand']); } $shop_price = $goods['shop_price']; $linked_goods = get_linked_goods($goods_id); $goods['goods_style_name'] = add_style($goods['goods_name'], $goods['goods_name_style']); /* 购买该商品可以得到多少钱的红包 */ if ($goods['bonus_type_id'] > 0) { $time = gmtime(); $sql = "SELECT type_money FROM " . $ecs->table('bonus_type') . " WHERE type_id = '{$goods['bonus_type_id']}' " . " AND send_type = '" . SEND_BY_GOODS . "' " . " AND send_start_date <= '{$time}'" . " AND send_end_date >= '{$time}'"; $goods['bonus_money'] = floatval($db->getOne($sql)); if ($goods['bonus_money'] > 0) { $goods['bonus_money'] = price_format($goods['bonus_money']); } } $smarty->assign('goods', $goods); $smarty->assign('goods_id', $goods['goods_id']); $smarty->assign('bid_record', $bidrecord); $smarty->assign('promote_end_time', $goods['gmt_end_time']); $smarty->assign('categories', get_categories_tree());
$db->query($sql); $sql = "SELECT 0 AS goods_id, attr_id, attr_value, attr_price " . "FROM " . $ecs->table('goods_attr') . " WHERE goods_id = '{$_REQUEST['goods_id']}' "; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $db->autoExecute($ecs->table('goods_attr'), addslashes_deep($row), 'INSERT'); } } // 扩展分类 $other_cat_list = array(); $sql = "SELECT cat_id FROM " . $ecs->table('goods_cat') . " WHERE goods_id = '{$_REQUEST['goods_id']}'"; $goods['other_cat'] = $db->getCol($sql); foreach ($goods['other_cat'] as $cat_id) { $other_cat_list[$cat_id] = cat_list(0, $cat_id); } $smarty->assign('other_cat_list', $other_cat_list); $link_goods_list = get_linked_goods($goods['goods_id']); // 关联商品 $group_goods_list = get_group_goods($goods['goods_id']); // 配件 $goods_article_list = get_goods_articles($goods['goods_id']); // 关联文章 /* 商品图片路径 */ if (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 10 && !empty($goods['original_img'])) { $goods['goods_img'] = get_image_path($_REQUEST['goods_id'], $goods['goods_img']); $goods['goods_thumb'] = get_image_path($_REQUEST['goods_id'], $goods['goods_thumb'], true); } /* 图片列表 */ $sql = "SELECT * FROM " . $ecs->table('goods_gallery') . " WHERE goods_id = '{$goods['goods_id']}'"; $img_list = $db->getAll($sql); /* 格式化相册图片路径 */ if (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 0) {