source: branches/version-2_12-dev/data/Smarty/templates/admin/order/product_select.tpl @ 22491

Revision 22491, 11.5 KB checked in by undertree, 11 years ago (diff)

#2095 受注画面の商品追加で、在庫が0の商品も追加できてしまう。

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-smarty-template; charset=UTF-8
Line 
1<!--{*
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23*}-->
24
25<!--{include file="`$smarty.const.TEMPLATE_ADMIN_REALDIR`admin_popup_header.tpl"}-->
26
27<script type="text/javascript">//<![CDATA[
28    self.moveTo(20,20);self.focus();
29
30    function func_submit(product_id, class_name1, class_name2) {
31        var err_text = '';
32        var fm = window.opener.document.form1;
33        var fm1 = window.opener.document;
34        var class1 = "classcategory_id" + product_id + "_1";
35        var class2 = "classcategory_id" + product_id + "_2";
36
37        var class1_id = document.getElementById(class1).value;
38        var class2_id = document.getElementById(class2).value;
39
40        var product_class_id = document.getElementById("product_class_id" + product_id).value;
41        var opner_product_id = 'add_product_id';
42        var opner_product_class_id = 'add_product_class_id';
43        var tpl_no = '<!--{$tpl_no}-->';
44
45        if (tpl_no != '') {
46            opner_product_id = 'edit_product_id';
47            opner_product_class_id = 'edit_product_class_id';
48            fm1.getElementById("no").value = escape('<!--{$tpl_no}-->');
49        }
50        if (document.getElementById(class1).type == 'select-one' && class1_id == '__unselected') {
51            err_text = class_name1 + "を選択してください。\n";
52        }
53        if (document.getElementById(class2).type == 'select-one' && class2_id == '') {
54            err_text = err_text + class_name2 + "を選択してください。\n";
55        }
56
57        if(!class1_id){
58            err_text = productsClassCategories[product_id]['__unselected2']['#0']['stock_find'] ? '' : '只今品切れ中です';
59        }else if(class1_id && !class2_id){
60            err_text = productsClassCategories[product_id][class1_id]['#0']['stock_find'] ? '' : '只今品切れ中です';
61        }else{
62            err_text = productsClassCategories[product_id][class1_id]['#' + class2_id]['stock_find'] ? '' : '只今品切れ中です';
63        }
64
65        if (err_text != '') {
66            alert(err_text);
67            return false;
68        }
69
70        fm1.getElementById(opner_product_id).value = product_id;
71        fm1.getElementById(opner_product_class_id).value = product_class_id;
72
73        fm.mode.value = 'select_product_detail';
74        fm.anchor_key.value = 'order_products';
75        fm.submit();
76        window.close();
77
78        return true;
79    }
80
81    // 規格2に選択肢を割り当てる。
82    function fnSetClassCategories(form, classcat_id2_selected) {
83        sele1 = form.classcategory_id1;
84        sele2 = form.classcategory_id2;
85        product_id = form.product_id.value;
86
87        if (sele1) {
88            if (sele2) {
89                // 規格2の選択肢をクリア
90                count = sele2.options.length;
91                for(i = count; i >= 0; i--) {
92                    sele2.options[i] = null;
93                }
94
95                // 規格2に選択肢を割り当てる
96                classcats = productsClassCategories[product_id][sele1.value];
97                i = 0;
98                for (var classcat_id2_key in classcats) {
99                    classcategory_id2 = classcats[classcat_id2_key].classcategory_id2;
100                    sele2.options[i] = new Option(classcats[classcat_id2_key].name, classcategory_id2);
101                    if (classcategory_id2 == classcat_id2_selected) {
102                        sele2.options[i].selected = true;
103                    }
104                    i++;
105                }
106            }
107            fnCheckStock(form);
108        }
109    }
110
111    function fnCheckStock(form) {
112        product_id = form.product_id.value;
113        classcat_id1 = form.classcategory_id1.value;
114        classcat_id2 = form.classcategory_id2 ? form.classcategory_id2.value : '';
115        classcat2 = productsClassCategories[product_id][classcat_id1]['#' + classcat_id2];
116        // 商品規格
117        eleDynamic = document.getElementById('product_class_id' + product_id);
118        if (
119            classcat2
120            && typeof classcat2.product_class_id != 'undefined'
121            && String(classcat2.product_class_id).length >= 1
122        ) {
123            eleDynamic.value = classcat2.product_class_id;
124        } else {
125            // 規格が1つのみの場合
126            classcat1 = productsClassCategories[product_id][classcat_id1]['#0'];
127            eleDynamic.value = classcat1.product_class_id;
128        }
129    }
130//]]></script>
131
132<!--▼検索フォーム-->
133<form name="form1" id="form1" method="post" action="?">
134<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
135<input name="mode" type="hidden" value="search" />
136<input name="anchor_key" type="hidden" value="" />
137<input name="search_pageno" type="hidden" value="" />
138<input name="no" type="hidden" value="<!--{$tpl_no|h}-->" />
139<table class="form">
140    <col width="20%" />
141    <col width="80%" />
142    <tr>
143        <th>カテゴリ</th>
144        <td>
145            <select name="search_category_id">
146                <option value="" selected="selected">選択してください</option>
147                <!--{html_options options=$arrCatList selected=$arrForm.search_category_id}-->
148            </select>
149        </td>
150    </tr>
151    <tr>
152        <th>商品名</th>
153        <td><input type="text" name="search_name" value="<!--{$arrForm.search_name|h}-->" size="35" class="box35" /></td>
154    </tr>
155    <tr>
156        <th>商品コード</th>
157        <td><input type="text" name="search_product_code" value="<!--{$arrForm.search_product_code|h}-->" size="35" class="box35" /></td>
158    </tr>
159</table>
160<div class="btn-area">
161    <ul>
162        <li><a class="btn-action" href="javascript:;" onclick="fnFormModeSubmit('form1', 'search', '', ''); return false;"><span class="btn-next">検索を開始</span></a></li>
163    </ul>
164</div>
165</form>
166<!--▼検索結果表示-->
167<!--{if $tpl_linemax}-->
168    <p>
169        <!--{$tpl_linemax}-->件が該当しました。
170        <!--{$tpl_strnavi}-->
171    </p>
172
173    <!--▼検索後表示部分-->
174    <table class="list">
175    <col width="20%" />
176    <col width="20%" />
177    <col width="50%" />
178    <col width="10%" />
179        <tr>
180            <th class="image">商品画像</th>
181            <th class="id">商品コード</th>
182            <th class="name">商品名</th>
183            <th class="action">決定</th>
184        </tr>
185        <!--{section name=cnt loop=$arrProducts}-->
186            <!--{assign var=id value=$arrProducts[cnt].product_id}-->
187            <form name="product_form<!--{$id|h}-->" action="?" onsubmit="return false;">
188                <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
189                <!--▼商品<!--{$smarty.section.cnt.iteration}-->-->
190                <!--{assign var=status value="`$arrProducts[cnt].status`"}-->
191                <tr style="background:<!--{$arrPRODUCTSTATUS_COLOR[$status]}-->;">
192                    <td class="center">
193                        <img src="<!--{$smarty.const.ROOT_URLPATH}-->resize_image.php?image=<!--{$arrProducts[cnt].main_list_image|sfNoImageMainList|h}-->&width=65&height=65" alt="<!--{$arrRecommend[$recommend_no].name|h}-->" />
194                    </td>
195                    <td>
196                        <!--{assign var=codemin value=`$arrProducts[cnt].product_code_min`}-->
197                        <!--{assign var=codemax value=`$arrProducts[cnt].product_code_max`}-->
198                        <!--{* 商品コード *}-->
199                        <!--{if $codemin != $codemax}-->
200                            <!--{$codemin|h}-->~<!--{$codemax|h}-->
201                        <!--{else}-->
202                            <!--{$codemin|h}-->
203                        <!--{/if}-->
204                    </td>
205                    <td>
206                    <!--{$arrProducts[cnt].name|h}-->
207                    <!--{assign var=class1 value=classcategory_id`$id`_1}-->
208                    <!--{assign var=class2 value=classcategory_id`$id`_2}-->
209                    <!--{if $tpl_classcat_find1[$id]}-->
210                    <dl>
211                        <dt><!--{$tpl_class_name1[$id]|h}-->:</dt>
212                        <dd>
213                            <select name="classcategory_id1" id="<!--{$class1}-->" style="<!--{$arrErr[$class1]|sfGetErrorColor}-->"    onchange="fnSetClassCategories(this.form);">
214                                <!--{html_options options=$arrClassCat1[$id] selected=$arrForm[$class1]}-->
215                            </select>
216                            <!--{if $arrErr[$class1] != ""}-->
217                            <br /><span class="attention">※ <!--{$tpl_class_name1[$id]}-->を入力して下さい。</span>
218                            <!--{/if}-->
219                        </dd>
220                    </dl>
221                    <!--{else}-->
222                    <input type="hidden" name="<!--{$class1}-->" id="<!--{$class1}-->" value="" />
223                    <!--{/if}-->
224
225                    <!--{if $tpl_classcat_find2[$id]}-->
226                    <dl>
227                        <dt><!--{$tpl_class_name2[$id]|h}-->:</dt>
228                        <dd>
229                            <select name="classcategory_id2" id="<!--{$class2}-->" style="<!--{$arrErr[$class2]|sfGetErrorColor}-->" onchange="fnCheckStock(this.form);"></select>
230                            <!--{if $arrErr[$class2] != ""}-->
231                            <br /><span class="attention">※ <!--{$tpl_class_name2[$id]}-->を入力して下さい。</span>
232                            <!--{/if}-->
233                        </dd>
234                    </dl>
235                    <!--{else}-->
236                    <input type="hidden" name="<!--{$class2}-->" id="<!--{$class2}-->" value="" />
237                    <!--{/if}-->
238                    <!--{if !$tpl_stock_find[$id]}-->
239                        <div class="attention">只今品切れ中です。</div>
240                    <!--{/if}-->
241                    <input type="hidden" name="product_id" value="<!--{$id|h}-->" />
242                    <input type="hidden" name="product_class_id<!--{$id|h}-->" id="product_class_id<!--{$id|h}-->" value="<!--{$tpl_product_class_id[$id]}-->" />
243                    <input type="hidden" name="product_type" id="product_type<!--{$id|h}-->" value="<!--{$tpl_product_type[$id]}-->" />
244                    </td>
245                    <td class="center"><a href="javascript:;" onclick="return func_submit('<!--{$arrProducts[cnt].product_id}-->', '<!--{$tpl_class_name1[$id]}-->', '<!--{$tpl_class_name2[$id]}-->'); return false;">決定</a></td>
246                </tr>
247                <!--▲商品<!--{$smarty.section.cnt.iteration}-->-->
248            </form>
249        <!--{sectionelse}-->
250            <tr>
251                <td colspan="4">商品が登録されていません</td>
252            </tr>
253        <!--{/section}-->
254    </table>
255<!--{/if}-->
256<!--▲検索結果表示-->
257
258
259<!--{include file="`$smarty.const.TEMPLATE_ADMIN_REALDIR`admin_popup_footer.tpl"}-->
Note: See TracBrowser for help on using the repository browser.