Changeset 21131


Ignore:
Timestamp:
2011/08/04 22:26:45 (9 years ago)
Author:
nanasess
bzr:base-revision:
ohkouchi@loop-az.jp-20110804124503-7j3sw9sn2u4myhwv
bzr:committer:
Kentaro Ohkouchi <ohkouchi@loop-az.jp>
bzr:file-ids:

data/class/SC_Product.php 18277@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcomu-ver2%2Fdata%2Fclass%2FSC_Product.php
data/class/pages/mypage/LC_Page_Mypage_Favorite.php 17162@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcomu-ver2%2Fdata%2Fclass%2Fpages%2Fmypage%2FLC_Page_Mypage_Favorite.php
data/class/pages/products/LC_Page_Products_List.php 15154@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fproducts%2FLC_Page_Products_List.php
bzr:mapping-version:
v4
bzr:merge:

ohkouchi@loop-az.jp-20110804132616-m89fi11n0f2f52u8
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
ohkouchi@loop-az.jp-20110804132642-eqw8w3yoam3h8ux0
bzr:revno:
3834
bzr:revprop:branch-nick:
branches/version-2_11-dev
bzr:root:
branches/version-2_11-dev
bzr:testament:

bazaar-ng testament short form 2.1
revision-id: ohkouchi@loop-az.jp-20110804132642-eqw8w3yoam3h8ux0
sha1: ad563299326e9642a36b9d8ef2129c61ed8656c6
bzr:text-parents:

data/class/SC_Product.php svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_11-dev:21005
data/class/pages/mypage/LC_Page_Mypage_Favorite.php ohkouchi@loop-az.jp-20110804121602-8bnaips8h02f50m9
data/class/pages/products/LC_Page_Products_List.php svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_11-dev:21049
bzr:timestamp:
2011-08-04 22:26:42.322999954 +0900
bzr:user-agent:
bzr2.3.1+bzr-svn1.1.0dev0
Message:

#1413 リファクタリング

Location:
branches/version-2_11-dev/data/class
Files:
3 edited

Legend:

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

    r21005 r21131  
    603603 
    604604        return true; 
     605    } 
     606 
     607    /** 
     608     * 商品情報の配列に, 税込金額を設定して返す. 
     609     * 
     610     * この関数は, 主にスマートフォンで使用します. 
     611     * 
     612     * @param array $arrProducts 商品情報の配列 
     613     * @return array 税込金額を設定した商品情報の配列 
     614     */ 
     615    function setPriceTaxTo($arrProducts) { 
     616        foreach ($arrProducts as $key=>$val) { 
     617            $arrProducts[$key]['price01_min_format'] = number_format($arrProducts[$key]['price01_min']); 
     618            $arrProducts[$key]['price01_max_format'] = number_format($arrProducts[$key]['price01_max']); 
     619            $arrProducts[$key]['price02_min_format'] = number_format($arrProducts[$key]['price02_min']); 
     620            $arrProducts[$key]['price02_max_format'] = number_format($arrProducts[$key]['price02_max']); 
     621 
     622            $arrProducts[$key]['price01_min_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price01_min']); 
     623            $arrProducts[$key]['price01_max_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price01_max']); 
     624            $arrProducts[$key]['price02_min_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price02_min']); 
     625            $arrProducts[$key]['price02_max_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price02_max']); 
     626 
     627            $arrProducts[$key]['price01_min_tax_format'] = number_format($arrProducts[$key]['price01_min_tax']); 
     628            $arrProducts[$key]['price01_max_tax_format'] = number_format($arrProducts[$key]['price01_max_tax']); 
     629            $arrProducts[$key]['price02_min_tax_format'] = number_format($arrProducts[$key]['price02_min_tax']); 
     630            $arrProducts[$key]['price02_max_tax_format'] = number_format($arrProducts[$key]['price02_max_tax']); 
     631        } 
     632        return $arrProducts; 
    605633    } 
    606634 
  • branches/version-2_11-dev/data/class/pages/mypage/LC_Page_Mypage_Favorite.php

    r21128 r21131  
    6868     */ 
    6969    function action() { 
    70  
     70        $objProduct  = new SC_Product_Ex(); 
    7171        $objCustomer = new SC_Customer_Ex(); 
    7272        $customer_id = $objCustomer->getValue('customer_id'); 
     
    8484                } 
    8585                $this->arrFavorite = $this->lfGetFavoriteProduct($customer_id, $this); 
    86                 $this->arrFavorite = $this->lfSetPriceTax($this->arrFavorite); 
     86                $this->arrFavorite = $objProduct->setPriceTaxTo($this->arrFavorite); 
    8787                echo SC_Utils_Ex::jsonEncode($this->arrFavorite); 
    8888                exit; 
     
    185185        } 
    186186    } 
    187      
    188     /** 
    189      * お気に入り情報配列に税込み金額を追加する 
    190      * 
    191      * @param Array $arrProducts お気に入り一覧情報 
    192      * @return Array $arrProducts お気に入り一覧情報 
    193      */ 
    194     function lfSetPriceTax($arrProducts){ 
    195         foreach($arrProducts as $key=>$val){ 
    196             $arrProducts[$key]['price01_min_format'] = number_format($arrProducts[$key]['price01_min']); 
    197             $arrProducts[$key]['price01_max_format'] = number_format($arrProducts[$key]['price01_max']); 
    198             $arrProducts[$key]['price02_min_format'] = number_format($arrProducts[$key]['price02_min']); 
    199             $arrProducts[$key]['price02_max_format'] = number_format($arrProducts[$key]['price02_max']); 
    200  
    201             $arrProducts[$key]['price01_min_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price01_min']); 
    202             $arrProducts[$key]['price01_max_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price01_max']); 
    203             $arrProducts[$key]['price02_min_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price02_min']); 
    204             $arrProducts[$key]['price02_max_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price02_max']); 
    205  
    206             $arrProducts[$key]['price01_min_tax_format'] = number_format($arrProducts[$key]['price01_min_tax']); 
    207             $arrProducts[$key]['price01_max_tax_format'] = number_format($arrProducts[$key]['price01_max_tax']); 
    208             $arrProducts[$key]['price02_min_tax_format'] = number_format($arrProducts[$key]['price02_min_tax']); 
    209             $arrProducts[$key]['price02_max_tax_format'] = number_format($arrProducts[$key]['price02_max_tax']); 
    210         } 
    211         return $arrProducts; 
    212     } 
    213187} 
  • branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_List.php

    r21049 r21131  
    127127        $this->arrProducts  = $this->lfGetProductsList($arrSearchCondition, $this->disp_number, $this->objNavi->start_row, $this->tpl_linemax, $objProduct); 
    128128 
    129  
    130129        switch($this->getMode()){ 
    131130 
    132131            case "json": 
    133                    $this->arrProducts = $this->setStatusData($this->arrProducts, $this->arrSTATUS, $this->arrSTATUS_IMAGE); 
    134                    $this->arrProducts = $this->setPriceTax($this->arrProducts); 
     132                   $this->arrProducts = $this->setStatusDataTo($this->arrProducts, $this->arrSTATUS, $this->arrSTATUS_IMAGE); 
     133                   $this->arrProducts = $objProduct->setPriceTaxTo($this->arrProducts); 
    135134                   echo SC_Utils_Ex::jsonEncode($this->arrProducts); 
    136135                   exit; 
     
    514513     * @return Array $arrProducts 商品一覧情報 
    515514     */ 
    516     function setStatusData($arrProducts, $arrStatus, $arrStatusImage){ 
    517  
    518         foreach($arrProducts['productStatus'] as $keyArr => $valArr){ 
    519             for($i=0; $i<count($valArr); $i++){ 
    520                 $statusCd = $valArr[$i]; 
    521                 if(!empty($statusCd)){ 
    522                     $statusAry = array('status_cd'=>$statusCd, 'status_name'=>$arrStatus[$statusCd], 'status_image' =>$arrStatusImage[$statusCd]); 
    523                     $arrProducts['productStatus'][$keyArr][$i] = $statusAry; 
    524  
     515    function setStatusDataTo($arrProducts, $arrStatus, $arrStatusImage){ 
     516 
     517        foreach ($arrProducts['productStatus'] as $product_id => $arrValues) { 
     518            for ($i = 0; $i < count($arrValues); $i++){ 
     519                $product_status_id = $arrValues[$i]; 
     520                if (!empty($product_status_id)) { 
     521                    $arrProductStatus = array('status_cd' => $product_status_id, 
     522                                              'status_name' => $arrStatus[$product_status_id], 
     523                                              'status_image' =>$arrStatusImage[$product_status_id]); 
     524                    $arrProducts['productStatus'][$product_id][$i] = $arrProductStatus; 
    525525                } 
    526526            } 
     
    528528        return $arrProducts; 
    529529    } 
    530  
    531     /** 
    532      * 商品情報配列に税込み金額を追加する 
    533      * 
    534      * @param Array $arrProducts 商品一覧情報 
    535      * @return Array $arrProducts 商品一覧情報 
    536      */ 
    537     function setPriceTax($arrProducts){ 
    538         foreach($arrProducts as $key=>$val){ 
    539             $arrProducts[$key]['price01_min_format'] = number_format($arrProducts[$key]['price01_min']); 
    540             $arrProducts[$key]['price01_max_format'] = number_format($arrProducts[$key]['price01_max']); 
    541             $arrProducts[$key]['price02_min_format'] = number_format($arrProducts[$key]['price02_min']); 
    542             $arrProducts[$key]['price02_max_format'] = number_format($arrProducts[$key]['price02_max']); 
    543  
    544             $arrProducts[$key]['price01_min_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price01_min']); 
    545             $arrProducts[$key]['price01_max_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price01_max']); 
    546             $arrProducts[$key]['price02_min_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price02_min']); 
    547             $arrProducts[$key]['price02_max_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price02_max']); 
    548  
    549             $arrProducts[$key]['price01_min_tax_format'] = number_format($arrProducts[$key]['price01_min_tax']); 
    550             $arrProducts[$key]['price01_max_tax_format'] = number_format($arrProducts[$key]['price01_max_tax']); 
    551             $arrProducts[$key]['price02_min_tax_format'] = number_format($arrProducts[$key]['price02_min_tax']); 
    552             $arrProducts[$key]['price02_max_tax_format'] = number_format($arrProducts[$key]['price02_max_tax']); 
    553         } 
    554         return $arrProducts; 
    555     } 
    556530} 
    557531?> 
Note: See TracChangeset for help on using the changeset viewer.