Ignore:
Timestamp:
2014/05/08 18:40:00 (10 years ago)
Author:
Seasoft
Message:

#2539 (商品一覧画面 SC_Helper_TaxRule#getTaxRule 経由で頻繁なDB処理が発生している)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/class/helper/SC_Helper_TaxRule.php

    r23334 r23405  
    122122     * @return array   税設定情報 
    123123     */ 
    124     public function getTaxRule ($product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) 
    125     { 
     124    public function getTaxRule($product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) 
     125    { 
     126        // 複数回呼出があるのでキャッシュ化 
     127        static $data_c = array(); 
     128 
    126129        // 初期化 
    127130        $product_id = $product_id > 0 ? $product_id : 0; 
     
    129132        $pref_id = $pref_id > 0 ? $pref_id : 0; 
    130133        $country_id = $country_id > 0 ? $country_id : 0; 
    131         // ログイン済み会員で国と地域指定が無い場合は、会員情報をデフォルトで利用。管理画面では利用しない 
    132         if (!(defined('ADMIN_FUNCTION') && ADMIN_FUNCTION == true)) { 
    133             $objCustomer = new SC_Customer_Ex(); 
    134             if ($objCustomer->isLoginSuccess(true)) { 
    135                 if ($country_id == 0) { 
    136                     $country_id = $objCustomer->getValue('country_id'); 
    137                 } 
    138                 if ($pref_id == 0) { 
    139                     $pref_id = $objCustomer->getValue('pref'); 
    140                 } 
    141             } 
    142         } 
    143134 
    144135        // 一覧画面の速度向上のため商品単位税率設定がOFFの時はキャッシュキーを丸めてしまう 
     
    149140        } 
    150141 
    151         // 複数回呼出があるのでキャッシュ化 
    152         static $data_c = array(); 
    153  
    154142        if (empty($data_c[$cache_key])) { 
     143            // ログイン済み会員で国と地域指定が無い場合は、会員情報をデフォルトで利用。管理画面では利用しない 
     144            if (!(defined('ADMIN_FUNCTION') && ADMIN_FUNCTION == true)) { 
     145                $objCustomer = new SC_Customer_Ex(); 
     146                if ($objCustomer->isLoginSuccess(true)) { 
     147                    if ($country_id == 0) { 
     148                        $country_id = $objCustomer->getValue('country_id'); 
     149                    } 
     150                    if ($pref_id == 0) { 
     151                        $pref_id = $objCustomer->getValue('pref'); 
     152                    } 
     153                } 
     154            } 
     155 
    155156            $arrRet = array(); 
    156157            // リクエストの配列化 
Note: See TracChangeset for help on using the changeset viewer.