Ignore:
Timestamp:
2013/01/30 21:12:01 (11 years ago)
Author:
Seasoft
Message:

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
#2044 (無駄な処理を改善する for 2.12.4)

  • 不必要なインスタンス化
  • 不必要な値渡し
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/SC_Product.php

    r22484 r22486  
    545545     * 
    546546     * @param array $arrProducts 商品情報の配列 
    547      * @return array 税込金額を設定した商品情報の配列 
    548      */ 
    549     function setPriceTaxTo($arrProducts) { 
    550         foreach ($arrProducts as $key => $value) { 
    551             $arrProducts[$key]['price01_min_format'] = number_format($arrProducts[$key]['price01_min']); 
    552             $arrProducts[$key]['price01_max_format'] = number_format($arrProducts[$key]['price01_max']); 
    553             $arrProducts[$key]['price02_min_format'] = number_format($arrProducts[$key]['price02_min']); 
    554             $arrProducts[$key]['price02_max_format'] = number_format($arrProducts[$key]['price02_max']); 
    555  
    556             $arrProducts[$key]['price01_min_tax'] = SC_Helper_DB_Ex::sfCalcIncTax($arrProducts[$key]['price01_min']); 
    557             $arrProducts[$key]['price01_max_tax'] = SC_Helper_DB_Ex::sfCalcIncTax($arrProducts[$key]['price01_max']); 
    558             $arrProducts[$key]['price02_min_tax'] = SC_Helper_DB_Ex::sfCalcIncTax($arrProducts[$key]['price02_min']); 
    559             $arrProducts[$key]['price02_max_tax'] = SC_Helper_DB_Ex::sfCalcIncTax($arrProducts[$key]['price02_max']); 
    560  
    561             $arrProducts[$key]['price01_min_tax_format'] = number_format($arrProducts[$key]['price01_min_tax']); 
    562             $arrProducts[$key]['price01_max_tax_format'] = number_format($arrProducts[$key]['price01_max_tax']); 
    563             $arrProducts[$key]['price02_min_tax_format'] = number_format($arrProducts[$key]['price02_min_tax']); 
    564             $arrProducts[$key]['price02_max_tax_format'] = number_format($arrProducts[$key]['price02_max_tax']); 
    565         } 
     547     * @return array 旧バージョン互換用のデータ 
     548     */ 
     549    static function setPriceTaxTo(&$arrProducts) { 
     550        foreach ($arrProducts as &$arrProduct) { 
     551            $arrProduct['price01_min_format'] = number_format($arrProduct['price01_min']); 
     552            $arrProduct['price01_max_format'] = number_format($arrProduct['price01_max']); 
     553            $arrProduct['price02_min_format'] = number_format($arrProduct['price02_min']); 
     554            $arrProduct['price02_max_format'] = number_format($arrProduct['price02_max']); 
     555 
     556            SC_Product_Ex::setIncTaxToProduct($arrProduct); 
     557 
     558            $arrProduct['price01_min_inctax_format'] = number_format($arrProduct['price01_min_inctax']); 
     559            $arrProduct['price01_max_inctax_format'] = number_format($arrProduct['price01_max_inctax']); 
     560            $arrProduct['price02_min_inctax_format'] = number_format($arrProduct['price02_min_inctax']); 
     561            $arrProduct['price02_max_inctax_format'] = number_format($arrProduct['price02_max_inctax']); 
     562 
     563            // @deprecated 2.12.4 
     564            // 旧バージョン互換用 
     565            // 本来は、税額の代入で使用すべきキー名。 
     566            $arrProduct['price01_min_tax_format'] =& $arrProduct['price01_min_inctax_format']; 
     567            $arrProduct['price01_max_tax_format'] =& $arrProduct['price01_max_inctax_format']; 
     568            $arrProduct['price02_min_tax_format'] =& $arrProduct['price02_min_inctax_format']; 
     569            $arrProduct['price02_max_tax_format'] =& $arrProduct['price02_max_inctax_format']; 
     570        } 
     571        // @deprecated 2.12.4 
     572        // 旧バージョン互換用 
     573        // 現在は参照渡しで戻せる 
    566574        return $arrProducts; 
    567575    } 
Note: See TracChangeset for help on using the changeset viewer.