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