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

Revision 19946, 6.4 KB checked in by nanasess, 10 years ago (diff)

#843(複数配送先の指定)

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