Ignore:
Timestamp:
2014/05/29 15:16:54 (10 years ago)
Author:
pineray
Message:

#2515 無駄な処理を改善する for 2.13.3

商品IDのチェックを共通関数化.
チェック部分のエラーを修正.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_Detail.php

    r23458 r23460  
    183183        // ファイル情報の初期化 
    184184        $this->objUpFile = $this->lfInitFile($this->objUpFile); 
     185        $this->mode = $this->getMode(); 
     186 
     187        $objProduct = new SC_Product_Ex(); 
    185188 
    186189        // プロダクトIDの正当性チェック 
    187         $product_id = $this->lfCheckProductId($this->objFormParam->getValue('admin'), $this->objFormParam->getValue('product_id')); 
    188         $this->mode = $this->getMode(); 
    189  
    190         $objProduct = new SC_Product_Ex(); 
     190        $product_id = $this->lfCheckProductId($this->objFormParam->getValue('admin'), $this->objFormParam->getValue('product_id'), $objProduct); 
     191 
    191192        $objProduct->setProductsClassByProductIds(array($product_id)); 
    192193 
     
    322323     * @param string $admin_mode 
    323324     * @param int $product_id 
     325     * @param SC_Product $objProduct 
    324326     * @return int|void 
    325327     */ 
    326     public function lfCheckProductId($admin_mode, $product_id) 
     328    public function lfCheckProductId($admin_mode, $product_id, SC_Product $objProduct) 
    327329    { 
    328330        // 管理機能からの確認の場合は、非公開の商品も表示する。 
    329331        if (isset($admin_mode) && $admin_mode == 'on' && SC_Utils_Ex::sfIsSuccess(new SC_Session_Ex(), false)) { 
    330             $where = 'del_flg = 0'; 
     332            $include_hidden = true; 
    331333        } else { 
    332             $where = 'del_flg = 0 AND status = 1'; 
    333         } 
    334  
    335         if (!SC_Utils_Ex::sfIsInt($product_id) 
    336             || SC_Utils_Ex::sfIsZeroFilling($product_id) 
    337             || !SC_Helper_DB_Ex::sfIsRecord('dtb_products', 'product_id', (array) $product_id, $where) 
    338         ) { 
     334            $include_hidden = false; 
     335        } 
     336 
     337        if (!$objProduct->isValidProductId($product_id, $include_hidden)) { 
    339338                SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 
    340339        } 
Note: See TracChangeset for help on using the changeset viewer.