define(*IN_ECS*, true);
define(*ECS_ADMIN*, true);
require(dirname(__FILE__) . */includes/init.php*);
require(ROOT_PATH . *mobile/includes/lib_wxch.php*);
$goods_id = !empty($_GET[*id*]) ? intval($_GET[*id*]) : **;
$act = !empty($_GET[*act*]) ? $_GET[*act*] : **;
if ($_SESSION[*user_id*] > 0)
{
$smarty->assign(*user_name*, $_SESSION[*user_name*]);
}
/*------------------------------------------------------ */
//-- 改变属性、数量时重新计算商品价格
/*------------------------------------------------------ */
if (!empty($_REQUEST[*act*]) && $_REQUEST[*act*] == *price*)
{
include(*includes/cls_json.php*);
$json = new JSON;
$res = array(*err_msg* => **, *result* => **, *qty* => 1);
$attr_id = isset($_REQUEST[*attr*]) ? explode(*,*, $_REQUEST[*attr*]) : array();
$number = (isset($_REQUEST[*number*])) ? intval($_REQUEST[*number*]) : 1;
if ($goods_id == 0)
{
$res[*err_msg*] = "没有找到指定的商品或者没有找到指定的商品属性。";
$res[*err_no*] = 1;
}
else
{
if ($number == 0)
{
$res[*qty*] = $number = 1;
}
else
{
$res[*qty*] = $number;
}
$shop_price = get_final_price($goods_id, $number, true, $attr_id);
$res[*result*] = price_format($shop_price * $number);
}
die($json->encode($res));
}
$_LANG[*kilogram*] = *千克*;
$_LANG[*gram*] = *克*;
$_LANG[*home*] = *首页*;
$_LANG[*goods_attr*] = **;
$smarty->assign(*goods_id*, $goods_id);
$goods_info = get_goods_info($goods_id);
if ($goods_info === false)
{
/* 如果没有找到任何记录则跳回到首页 */
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));// 会员等级价格
print_r( get_user_rank_prices($goods_id, $shop_price));
exit();
print_r的结果是array( );但是换另外一个模板会员等级是有值,请高手看一下这是哪里错了
define(*ECS_ADMIN*, true);
require(dirname(__FILE__) . */includes/init.php*);
require(ROOT_PATH . *mobile/includes/lib_wxch.php*);
$goods_id = !empty($_GET[*id*]) ? intval($_GET[*id*]) : **;
$act = !empty($_GET[*act*]) ? $_GET[*act*] : **;
if ($_SESSION[*user_id*] > 0)
{
$smarty->assign(*user_name*, $_SESSION[*user_name*]);
}
/*------------------------------------------------------ */
//-- 改变属性、数量时重新计算商品价格
/*------------------------------------------------------ */
if (!empty($_REQUEST[*act*]) && $_REQUEST[*act*] == *price*)
{
include(*includes/cls_json.php*);
$json = new JSON;
$res = array(*err_msg* => **, *result* => **, *qty* => 1);
$attr_id = isset($_REQUEST[*attr*]) ? explode(*,*, $_REQUEST[*attr*]) : array();
$number = (isset($_REQUEST[*number*])) ? intval($_REQUEST[*number*]) : 1;
if ($goods_id == 0)
{
$res[*err_msg*] = "没有找到指定的商品或者没有找到指定的商品属性。";
$res[*err_no*] = 1;
}
else
{
if ($number == 0)
{
$res[*qty*] = $number = 1;
}
else
{
$res[*qty*] = $number;
}
$shop_price = get_final_price($goods_id, $number, true, $attr_id);
$res[*result*] = price_format($shop_price * $number);
}
die($json->encode($res));
}
$_LANG[*kilogram*] = *千克*;
$_LANG[*gram*] = *克*;
$_LANG[*home*] = *首页*;
$_LANG[*goods_attr*] = **;
$smarty->assign(*goods_id*, $goods_id);
$goods_info = get_goods_info($goods_id);
if ($goods_info === false)
{
/* 如果没有找到任何记录则跳回到首页 */
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));// 会员等级价格
print_r( get_user_rank_prices($goods_id, $shop_price));
exit();
print_r的结果是array( );但是换另外一个模板会员等级是有值,请高手看一下这是哪里错了