本文整理汇总了PHP中add_package_to_cart函数的典型用法代码示例。如果您正苦于以下问题:PHP add_package_to_cart函数的具体用法?PHP add_package_to_cart怎么用?PHP add_package_to_cart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_package_to_cart函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
if (empty($_POST['package_info'])) {
$result['error'] = 1;
die($json->encode($result));
}
$package = $json->decode($_POST['package_info']);
/* 如果是一步购物,先清空购物车 */
if ($_CFG['one_step_buy'] == '1') {
clear_cart();
}
/* 商品数量是否合法 */
if (!is_numeric($package->number) || intval($package->number) <= 0) {
$result['error'] = 1;
$result['message'] = $_LANG['invalid_number'];
} else {
/* 添加到购物车 */
if (add_package_to_cart($package->package_id, $package->number)) {
if ($_CFG['cart_confirm'] > 2) {
$result['message'] = '';
} else {
$result['message'] = $_CFG['cart_confirm'] == 1 ? $_LANG['addto_cart_success_1'] : $_LANG['addto_cart_success_2'];
}
$result['content'] = insert_cart_info();
$result['one_step_buy'] = $_CFG['one_step_buy'];
} else {
$result['message'] = $err->last_message();
$result['error'] = $err->error_no;
$result['package_id'] = stripslashes($package->package_id);
}
}
$result['confirm_type'] = !empty($_CFG['cart_confirm']) ? $_CFG['cart_confirm'] : 2;
die($json->encode($result));
示例2: die
if (empty($_POST['package_info'])) {
$result['error'] = 1;
die($json->encode($result));
}
$package = $json->decode($_POST['package_info']);
/* 如果是一步购物,先清空购物车 */
if ($_CFG['one_step_buy'] == '1') {
clear_cart();
}
/* 商品数量是否合法 */
if (!is_numeric($package->number) || intval($package->number) <= 0) {
$result['error'] = 1;
$result['message'] = $_LANG['invalid_number'];
} else {
/* 添加到购物车 修改 by. 增加两个参数 */
if (add_package_to_cart($package->package_id, $package->number, $package->package_attr_id, $package->package_prices)) {
if ($_CFG['cart_confirm'] > 2) {
$result['message'] = '';
} else {
$result['message'] = $_CFG['cart_confirm'] == 1 ? $_LANG['addto_cart_success_1'] : $_LANG['addto_cart_success_2'];
}
$result['content'] = insert_cart_info();
$result['one_step_buy'] = $_CFG['one_step_buy'];
} else {
$result['message'] = $err->last_message();
$result['error'] = $err->error_no;
$result['package_id'] = stripslashes($package->package_id);
}
}
$result['confirm_type'] = !empty($_CFG['cart_confirm']) ? $_CFG['cart_confirm'] : 2;
die($json->encode($result));