本文整理汇总了PHP中package_goods函数的典型用法代码示例。如果您正苦于以下问题:PHP package_goods函数的具体用法?PHP package_goods怎么用?PHP package_goods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了package_goods函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quick_delivery
function quick_delivery($order_id, $invoice_no, $action_note = 'Wap端一键发货')
{
global $db, $ecs;
if (!empty($invoice_no)) {
$order_id = intval(trim($order_id));
$action_note = trim($action_note);
/* 查询:根据订单id查询订单信息 */
if (!empty($order_id)) {
$order = order_info($order_id);
} else {
die('order does not exist');
}
/* 查询:根据订单是否完成 检查权限 */
if (order_finished($order)) {
admin_priv('order_view_finished');
} else {
admin_priv('order_view');
}
/* 查询:如果管理员属于某个办事处,检查该订单是否也属于这个办事处 */
$sql = "SELECT agency_id FROM " . $ecs->table('supplier_admin_user') . " WHERE user_id = '{$_SESSION['supplier_user_id']}'";
$agency_id = $db->getOne($sql);
if ($agency_id > 0) {
if ($order['agency_id'] != $agency_id) {
sys_msg($_LANG['priv_error'], 0);
}
}
/* 查询:取得用户名 */
if ($order['user_id'] > 0) {
$user = user_info($order['user_id']);
if (!empty($user)) {
$order['user_name'] = $user['user_name'];
}
}
/* 查询:取得区域名 */
$order['region'] = $db->getOne($sql);
/* 查询:其他处理 */
$order['order_time'] = local_date($_CFG['time_format'], $order['add_time']);
$order['invoice_no'] = $order['shipping_status'] == SS_UNSHIPPED || $order['shipping_status'] == SS_PREPARING ? $_LANG['ss'][SS_UNSHIPPED] : $order['invoice_no'];
/* 查询:是否保价 */
$order['insure_yn'] = empty($order['insure_fee']) ? 0 : 1;
/* 查询:是否存在实体商品 */
$exist_real_goods = exist_real_goods($order_id);
/* 查询:取得订单商品 */
$_goods = get_order_goods(array('order_id' => $order['order_id'], 'order_sn' => $order['order_sn']));
$attr = $_goods['attr'];
$goods_list = $_goods['goods_list'];
unset($_goods);
/* 查询:商品已发货数量 此单可发货数量 */
if ($goods_list) {
foreach ($goods_list as $key => $goods_value) {
if (!$goods_value['goods_id']) {
continue;
}
/* 超级礼包 */
if ($goods_value['extension_code'] == 'package_buy' && count($goods_value['package_goods_list']) > 0) {
$goods_list[$key]['package_goods_list'] = package_goods($goods_value['package_goods_list'], $goods_value['goods_number'], $goods_value['order_id'], $goods_value['extension_code'], $goods_value['goods_id']);
foreach ($goods_list[$key]['package_goods_list'] as $pg_key => $pg_value) {
$goods_list[$key]['package_goods_list'][$pg_key]['readonly'] = '';
/* 使用库存 是否缺货 */
if ($pg_value['storage'] <= 0 && $_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_SHIP) {
$goods_list[$key]['package_goods_list'][$pg_key]['send'] = $_LANG['act_good_vacancy'];
$goods_list[$key]['package_goods_list'][$pg_key]['readonly'] = 'readonly="readonly"';
} elseif ($pg_value['send'] <= 0) {
$goods_list[$key]['package_goods_list'][$pg_key]['send'] = $_LANG['act_good_delivery'];
$goods_list[$key]['package_goods_list'][$pg_key]['readonly'] = 'readonly="readonly"';
}
}
} else {
$goods_list[$key]['sended'] = $goods_value['send_number'];
$goods_list[$key]['sended'] = $goods_value['goods_number'];
$goods_list[$key]['send'] = $goods_value['goods_number'] - $goods_value['send_number'];
$goods_list[$key]['readonly'] = '';
/* 是否缺货 */
if ($goods_value['storage'] <= 0 && $_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_SHIP) {
$goods_list[$key]['send'] = $_LANG['act_good_vacancy'];
$goods_list[$key]['readonly'] = 'readonly="readonly"';
} elseif ($goods_list[$key]['send'] <= 0) {
$goods_list[$key]['send'] = $_LANG['act_good_delivery'];
$goods_list[$key]['readonly'] = 'readonly="readonly"';
}
}
}
}
$suppliers_id = 0;
$delivery['order_sn'] = trim($order['order_sn']);
$delivery['add_time'] = trim($order['order_time']);
$delivery['user_id'] = intval(trim($order['user_id']));
$delivery['how_oos'] = trim($order['how_oos']);
$delivery['shipping_id'] = trim($order['shipping_id']);
$delivery['shipping_fee'] = trim($order['shipping_fee']);
$delivery['consignee'] = trim($order['consignee']);
$delivery['address'] = trim($order['address']);
$delivery['country'] = intval(trim($order['country']));
$delivery['province'] = intval(trim($order['province']));
$delivery['city'] = intval(trim($order['city']));
$delivery['district'] = intval(trim($order['district']));
$delivery['sign_building'] = trim($order['sign_building']);
$delivery['email'] = trim($order['email']);
$delivery['zipcode'] = trim($order['zipcode']);
$delivery['tel'] = trim($order['tel']);
//.........这里部分代码省略.........
示例2: update_order_goods
/**
* 更新订单商品信息
* @param int $order_id 订单 id
* @param array $_sended Array(‘商品id’ => ‘此单发货数量’)
* @param array $goods_list
* @return Bool
*/
function update_order_goods($order_id, $_sended, $goods_list = array())
{
if (!is_array($_sended) || empty($order_id)) {
return false;
}
foreach ($_sended as $key => $value) {
// 超值礼包
if (is_array($value)) {
if (!is_array($goods_list)) {
$goods_list = array();
}
foreach ($goods_list as $goods) {
if ($key != $goods['rec_id'] || (!isset($goods['package_goods_list']) || !is_array($goods['package_goods_list']))) {
continue;
}
$goods['package_goods_list'] = package_goods($goods['package_goods_list'], $goods['goods_number'], $goods['order_id'], $goods['extension_code'], $goods['goods_id']);
$pg_is_end = true;
foreach ($goods['package_goods_list'] as $pg_key => $pg_value) {
if ($pg_value['order_send_number'] != $pg_value['sended']) {
$pg_is_end = false;
// 此超值礼包,此商品未全部发货
break;
}
}
// 超值礼包商品全部发货后更新订单商品库存
if ($pg_is_end) {
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_goods') . "\n SET send_number = goods_number\n WHERE order_id = '{$order_id}'\n AND goods_id = '" . $goods['goods_id'] . "' ";
$GLOBALS['db']->query($sql, 'SILENT');
}
}
} elseif (!is_array($value)) {
/* 检查是否为商品(实货)(货品) */
foreach ($goods_list as $goods) {
if ($goods['rec_id'] == $key && $goods['is_real'] == 1) {
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_goods') . "\n SET send_number = send_number + {$value}\n WHERE order_id = '{$order_id}'\n AND rec_id = '{$key}' ";
$GLOBALS['db']->query($sql, 'SILENT');
break;
}
}
}
}
return true;
}
示例3: empty
// 如果是货品则键值为商品ID与货品ID的组合
$_key = empty($value['product_id']) ? $value['goods_id'] : $value['goods_id'] . '_' . $value['product_id'];
// 统计此单商品总发货数 合并计算相同ID商品或货品的发货数
if (empty($goods_no_package[$_key])) {
$goods_no_package[$_key] = $send_number[$value['rec_id']];
} else {
$goods_no_package[$_key] += $send_number[$value['rec_id']];
}
//去除
if ($send_number[$value['rec_id']] <= 0) {
unset($send_number[$value['rec_id']], $goods_list[$key]);
continue;
}
} else {
/* 组合超值礼包信息 */
$goods_list[$key]['package_goods_list'] = package_goods($value['package_goods_list'], $value['goods_number'], $value['order_id'], $value['extension_code'], $value['goods_id']);
/* 超值礼包 */
foreach ($value['package_goods_list'] as $pg_key => $pg_value) {
// 如果是货品则键值为商品ID与货品ID的组合
$_key = empty($pg_value['product_id']) ? $pg_value['goods_id'] : $pg_value['goods_id'] . '_' . $pg_value['product_id'];
//统计此单商品总发货数 合并计算相同ID产品的发货数
if (empty($goods_no_package[$_key])) {
$goods_no_package[$_key] = $send_number[$value['rec_id']][$pg_value['g_p']];
} else {
$goods_no_package[$_key] += $send_number[$value['rec_id']][$pg_value['g_p']];
}
//去除
if ($send_number[$value['rec_id']][$pg_value['g_p']] <= 0) {
unset($send_number[$value['rec_id']][$pg_value['g_p']], $goods_list[$key]['package_goods_list'][$pg_key]);
}
}