當前位置: 首頁>>代碼示例>>PHP>>正文


PHP package_goods函數代碼示例

本文整理匯總了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']);
//.........這裏部分代碼省略.........
開發者ID:seanguo166,項目名稱:yinoos,代碼行數:101,代碼來源:order.php

示例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;
}
開發者ID:norain2050,項目名稱:benhu,代碼行數:50,代碼來源:order.php

示例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]);
         }
     }
開發者ID:shiruolin,項目名稱:hzzshop,代碼行數:31,代碼來源:split.php


注:本文中的package_goods函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。