source: branches/version-2_5-dev/data/Smarty/templates/admin/order/multiple.tpl @ 20407

Revision 20407, 6.8 KB checked in by kotani, 13 years ago (diff)

#812 (トランザクションIDの自動生成/自動検証), #1053 (transactionidが埋め込まれる前にクリックされるとエラー)

  • transactionid用hiddenタグをJavaScriptで生成しないように変更
  • 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-2010 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<!--{include file="`$smarty.const.TEMPLATE_ADMIN_REALDIR`admin_popup_header.tpl"}-->
25
26<script type="text/javascript">
27<!--
28self.moveTo(20,20);self.focus();
29$(function() {
30
31    var product_class_id = window.opener.jQuery('input[id^=product_class_id]');
32    var product_code = window.opener.jQuery('input[id^=product_code]');
33    var product_name = window.opener.jQuery('input[id^=product_name]');
34    var classcategory_name1 = window.opener.jQuery('input[id^=classcategory_name1]');
35    var classcategory_name2 = window.opener.jQuery('input[id^=classcategory_name2]');
36    var price = window.opener.jQuery('input[id^=price]');
37    var quantity = window.opener.jQuery('input[id^=quantity]');
38    var shipping_id = window.opener.jQuery('input[id^=shipping_id]');
39    var shipping_name01 = window.opener.jQuery('input[name^=shipping_name01]');
40    var shipping_name02 = window.opener.jQuery('input[name^=shipping_name02]');
41    var shipping_pref = window.opener.jQuery('select[name^=shipping_pref] option:selected');
42    var shipping_addr01 = window.opener.jQuery('input[name^=shipping_addr01]');
43    var shipping_addr02 = window.opener.jQuery('input[name^=shipping_addr02]');
44
45    var index = 0;
46    for (var i = 0; i < product_class_id.length; i++) {
47
48        for (var j = 0; j < $(quantity[i]).val(); j++) {
49
50            // 表示商品名
51            var dispname = '';
52
53            // 商品規格ID
54            var idfield = $('<input type="hidden" />')
55                .attr({'name': 'multiple_product_class_id[' + index + ']'})
56                .val($(product_class_id[i]).val());
57
58            // 商品コード
59            var codefield = $('<input type="hidden" />')
60                .attr({'name': 'multiple_product_code['+ index + ']'})
61                .val($(product_code[i]).val());
62
63            // 商品名
64            var namefield = $('<input type="hidden" />')
65                .attr({'name': 'multiple_product_name[' + index + ']'})
66                .val($(product_name[i]).val());
67            dispname = $(product_name[i]).val();
68
69            // 規格1
70            var class1field = $('<input type="hidden" />')
71                .attr({'name': 'multiple_classcategory_name1[' + index + ']'})
72                .val($(classcategory_name1[i]).val());
73
74            if ($(classcategory_name1[i]).val() != '') {
75                dispname += '<br />' + $(classcategory_name1[i]).val();
76            }
77
78            // 規格2
79            var class2field = $('<input type="hidden" />')
80                .attr({'name': 'multiple_classcategory_name2[' + index + ']'})
81                .val($(classcategory_name2[i]).val());
82
83            if ($(classcategory_name2[i]).val() != '') {
84                dispname += '<br />' + $(classcategory_name2[i]).val();
85            }
86
87            // 単価
88            var pricefield = $('<input type="hidden" />')
89                .attr({'name': 'multiple_price[' + index + ']'})
90                .val($(price[i]).val());
91
92
93            // 数量
94            var qfield = $('<input type="text" />')
95                .attr({'name': 'multiple_quantity[' + index + ']',
96                       'size': 4})
97                .val(1);
98
99            // 数量と hidden を設定
100            var q = $('<td />').addClass('center')
101                .append(idfield)
102                .append(codefield)
103                .append(namefield)
104                .append(class1field)
105                .append(class2field)
106                .append(pricefield)
107                .append(qfield);
108
109            // お届け先
110            var select = $('<select />').attr('name', 'multiple_shipping_id[' + index + ']');
111            var s = $('<td />').append(select);
112
113            // 行を生成
114            var tr = $('<tr />')
115                .append($('<td />').text($(product_code[i]).val()))
116                .append($('<td />').html(dispname))
117                .append(q)
118                .append(s);
119
120            jQuery(tr).appendTo('tbody');
121            index++;
122        }
123    }
124
125    // プルダウンを生成
126    for (var i = 0; i < shipping_id.length; i++) {
127        var text = $(shipping_name01[i]).val() + $(shipping_name02[i]).val()
128            + ' ' + $(shipping_pref[i]).text()
129            + $(shipping_addr01[i]).val() + $(shipping_addr02[i]).val();
130        var option = $('<option />')
131            .val($(shipping_id[i]).val())
132            .text(text);
133        $('select').append(option);
134    }
135});
136
137function func_submit() {
138    var err_text = '';
139    var fm = window.opener.document.form1;
140
141    fm.mode.value = 'multiple_set_to';
142    fm.anchor_key.value = 'shipping';
143
144    var div = $('<div />');
145    $('input[name^=multiple_], select[name^=multiple_]').each(function() {
146        // TODO タグをベタ書きにしないと, innerHTML で value が空になってしまう
147        $(div).append('<input type="hidden" name="'
148                      + $(this).attr('name')
149                      + '" value="' + $(this).val() + '" />');
150    });
151
152    // window.opener に対する append は IE で動作しない
153    window.opener.jQuery('#multiple').html(div.html());
154    fm.submit();
155    window.close();
156    return true;
157}
158//-->
159</script>
160
161<!--▼検索フォーム-->
162<form name="form1" id="form1" method="post" action="<!--{$smarty.server.REQUEST_URI|h}-->">
163<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
164<input name="mode" type="hidden" value="search" />
165<input name="anchor_key" type="hidden" value="" />
166<input name="search_pageno" type="hidden" value="" />
167<input name="no" type="hidden" value="<!--{$tpl_no}-->" />
168<table summary="配送情報" class="list">
169  <thead>
170    <tr>
171      <th>商品コード</th>
172      <th>商品名/規格1/規格2</th>
173      <th>数量</th>
174      <th>お届け先</th>
175    </tr>
176  </thead>
177  <tbody>
178  </tbody>
179</table>
180<div class="btn-area">
181  <ul>
182    <li><a class="btn-action" href="javascript:;" onclick="func_submit(); return false;"><span class="btn-next">決定</span></a></li>
183  </ul>
184</div>
185</form>
186<!--{include file="`$smarty.const.TEMPLATE_ADMIN_REALDIR`admin_popup_footer.tpl"}-->
Note: See TracBrowser for help on using the repository browser.