Ignore:
Timestamp:
2007/08/03 21:21:31 (17 years ago)
Author:
nanasess
Message:

SC_Helper_DB クラス新規追加
SC_Utils クラスの SC_DbConn インスタンスを生成する関数を SC_Helper_DB クラスへ移動

Location:
branches/feature-module-update/data/class
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/util/SC_Utils.php

    r15155 r15176  
    14251425    } 
    14261426 
    1427     /* 商品規格情報の取得 */ 
    1428     function sfGetProductsClass($arrID) { 
    1429         list($product_id, $classcategory_id1, $classcategory_id2) = $arrID; 
    1430  
    1431         if($classcategory_id1 == "") { 
    1432             $classcategory_id1 = '0'; 
    1433         } 
    1434         if($classcategory_id2 == "") { 
    1435             $classcategory_id2 = '0'; 
    1436         } 
    1437  
    1438         // 商品規格取得 
    1439         $objQuery = new SC_Query(); 
    1440         $col = "product_id, deliv_fee, name, product_code, main_list_image, main_image, price01, price02, point_rate, product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, sale_limit, sale_unlimited"; 
    1441         $table = "vw_product_class AS prdcls"; 
    1442         $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?"; 
    1443         $objQuery->setorder("rank1 DESC, rank2 DESC"); 
    1444         $arrRet = $objQuery->select($col, $table, $where, array($product_id, $classcategory_id1, $classcategory_id2)); 
    1445         return $arrRet[0]; 
    1446     } 
    1447  
    14481427    /* 集計情報を元に最終計算 */ 
    14491428    function sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer = "") { 
     
    14671446        if (OPTION_DELIV_FEE == 1) { 
    14681447            // 送料の合計を計算する 
    1469             $arrData['deliv_fee']+= sfGetDelivFee($arrData['deliv_pref'], $arrData['payment_id']); 
     1448            $arrData['deliv_fee']+= SC_Utils::sfGetDelivFee($arrData['deliv_pref'], $arrData['payment_id']); 
    14701449        } 
    14711450 
     
    14921471        $arrData['payment_total'] = $arrData['total'] - ($arrData['use_point'] * POINT_VALUE); 
    14931472        // 加算ポイントの計算 
    1494         $arrData['add_point'] = sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo); 
     1473        $arrData['add_point'] = SC_Utils::sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo); 
    14951474 
    14961475        if($objCustomer != "") { 
     
    15071486 
    15081487        return $arrData; 
    1509     } 
    1510  
    1511     /* カート内商品の集計処理 */ 
    1512     function sfTotalCart($objPage, $objCartSess, $arrInfo) { 
    1513         // 規格名一覧 
    1514         $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 
    1515         // 規格分類名一覧 
    1516         $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
    1517  
    1518         $objPage->tpl_total_pretax = 0;     // 費用合計(税込み) 
    1519         $objPage->tpl_total_tax = 0;        // 消費税合計 
    1520         $objPage->tpl_total_point = 0;      // ポイント合計 
    1521  
    1522         // カート内情報の取得 
    1523         $arrCart = $objCartSess->getCartList(); 
    1524         $max = count($arrCart); 
    1525         $cnt = 0; 
    1526  
    1527         for ($i = 0; $i < $max; $i++) { 
    1528             // 商品規格情報の取得 
    1529             $arrData = sfGetProductsClass($arrCart[$i]['id']); 
    1530             $limit = ""; 
    1531             // DBに存在する商品 
    1532             if (count($arrData) > 0) { 
    1533  
    1534                 // 購入制限数を求める。 
    1535                 if ($arrData['stock_unlimited'] != '1' && $arrData['sale_unlimited'] != '1') { 
    1536                     if($arrData['sale_limit'] < $arrData['stock']) { 
    1537                         $limit = $arrData['sale_limit']; 
    1538                     } else { 
    1539                         $limit = $arrData['stock']; 
    1540                     } 
    1541                 } else { 
    1542                     if ($arrData['sale_unlimited'] != '1') { 
    1543                         $limit = $arrData['sale_limit']; 
    1544                     } 
    1545                     if ($arrData['stock_unlimited'] != '1') { 
    1546                         $limit = $arrData['stock']; 
    1547                     } 
    1548                 } 
    1549  
    1550                 if($limit != "" && $limit < $arrCart[$i]['quantity']) { 
    1551                     // カート内商品数を制限に合わせる 
    1552                     $objCartSess->setProductValue($arrCart[$i]['id'], 'quantity', $limit); 
    1553                     $quantity = $limit; 
    1554                     $objPage->tpl_message = "※「" . $arrData['name'] . "」は販売制限しております、一度にこれ以上の購入はできません。"; 
    1555                 } else { 
    1556                     $quantity = $arrCart[$i]['quantity']; 
    1557                 } 
    1558  
    1559                 $objPage->arrProductsClass[$cnt] = $arrData; 
    1560                 $objPage->arrProductsClass[$cnt]['quantity'] = $quantity; 
    1561                 $objPage->arrProductsClass[$cnt]['cart_no'] = $arrCart[$i]['cart_no']; 
    1562                 $objPage->arrProductsClass[$cnt]['class_name1'] = $arrClassName[$arrData['class_id1']]; 
    1563                 $objPage->arrProductsClass[$cnt]['class_name2'] = $arrClassName[$arrData['class_id2']]; 
    1564                 $objPage->arrProductsClass[$cnt]['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']]; 
    1565                 $objPage->arrProductsClass[$cnt]['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']]; 
    1566  
    1567                 // 画像サイズ 
    1568                 list($image_width, $image_height) = getimagesize(IMAGE_SAVE_DIR . basename($objPage->arrProductsClass[$cnt]["main_image"])); 
    1569                 $objPage->arrProductsClass[$cnt]["tpl_image_width"] = $image_width + 60; 
    1570                 $objPage->arrProductsClass[$cnt]["tpl_image_height"] = $image_height + 80; 
    1571  
    1572                 // 価格の登録 
    1573                 if ($arrData['price02'] != "") { 
    1574                     $objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price02']); 
    1575                     $objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price02']; 
    1576                 } else { 
    1577                     $objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price01']); 
    1578                     $objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price01']; 
    1579                 } 
    1580                 // ポイント付与率の登録 
    1581                 $objCartSess->setProductValue($arrCart[$i]['id'], 'point_rate', $arrData['point_rate']); 
    1582                 // 商品ごとの合計金額 
    1583                 $objPage->arrProductsClass[$cnt]['total_pretax'] = $objCartSess->getProductTotal($arrInfo, $arrCart[$i]['id']); 
    1584                 // 送料の合計を計算する 
    1585                 $objPage->tpl_total_deliv_fee+= ($arrData['deliv_fee'] * $arrCart[$i]['quantity']); 
    1586                 $cnt++; 
    1587             } else { 
    1588                 // DBに商品が見つからない場合はカート商品の削除 
    1589                 $objCartSess->delProductKey('id', $arrCart[$i]['id']); 
    1590             } 
    1591         } 
    1592  
    1593         // 全商品合計金額(税込み) 
    1594         $objPage->tpl_total_pretax = $objCartSess->getAllProductsTotal($arrInfo); 
    1595         // 全商品合計消費税 
    1596         $objPage->tpl_total_tax = $objCartSess->getAllProductsTax($arrInfo); 
    1597         // 全商品合計ポイント 
    1598         $objPage->tpl_total_point = $objCartSess->getAllProductsPoint(); 
    1599  
    1600         return $objPage; 
    16011488    } 
    16021489 
     
    20711958    function sfGetUniqRandomId($head = "") { 
    20721959        // 予測されないようにランダム文字列を付与する。 
    2073         $random = gfMakePassword(8); 
     1960        $random = GC_Utils_Ex::gfMakePassword(8); 
    20741961        // 同一ホスト内で一意なIDを生成 
    20751962        $id = uniqid($head); 
Note: See TracChangeset for help on using the changeset viewer.