Changeset 21910


Ignore:
Timestamp:
2012/06/11 17:39:33 (12 years ago)
Author:
adachi
Message:

#1864 関連商品登録時に重複チェックを行うように修正

Location:
branches/version-2_12-dev/data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/Smarty/templates/admin/products/upload_csv_complete.tpl

    r21867 r21910  
    3232                <td> 
    3333                    <!--{foreach item=err from=$arrRowErr}--> 
    34                         <span class="attention"><!--{$err}--></span> 
     34                        <span class="attention"><!--{$err}--></span></br> 
    3535                    <!--{/foreach}--> 
    3636                </td> 
  • branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php

    r21867 r21910  
    646646            $arrErr['product_type_id'] = '※ 指定の商品種別IDは、登録されていません。'; 
    647647        } 
    648         // 関連商品IDの存在チェック 
     648        // 関連商品IDのチェック 
     649        $arrRecommendProductUnique = array(); 
    649650        for ($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) { 
    650             if (array_search('recommend_product_id' . $i, $this->arrFormKeyList) !== FALSE 
    651                 && $item['recommend_product_id' . $i] != '' 
    652                 && !$this->objDb->sfIsRecord('dtb_products', 'product_id', (array)$item['recommend_product_id' . $i]) 
    653             ) { 
    654                 $arrErr['recommend_product_id' . $i] = "※ 指定の関連商品ID($i)は、登録されていません。"; 
     651            $recommend_product_id_key = 'recommend_product_id' . $i; 
     652            if ((array_search($recommend_product_id_key, $this->arrFormKeyList) !== FALSE) 
     653             && ($item[$recommend_product_id_key] != '') ) { 
     654 
     655                // 商品IDの存在チェック 
     656                if (!$this->objDb->sfIsRecord('dtb_products', 'product_id', (array)$item[$recommend_product_id_key])) { 
     657                    $arrErr[$recommend_product_id_key] = "※ 指定の関連商品ID($i)は、登録されていません。"; 
     658                    continue; 
     659                } 
     660                // 商品IDの重複チェック 
     661                $recommend_product_id = $item[$recommend_product_id_key]; 
     662                if (isset($arrRecommendProductUnique[$recommend_product_id])) { 
     663                    $arrErr[$recommend_product_id_key] = "※ 指定の関連商品ID($i)は、すでに登録されています。"; 
     664                } else { 
     665                    $arrRecommendProductUnique[$recommend_product_id] = true; 
     666                } 
    655667            } 
    656668        } 
Note: See TracChangeset for help on using the changeset viewer.