source: branches/version-2_5-dev/data/Smarty/templates/default/list.tpl @ 18830

Revision 18830, 17.4 KB checked in by nanasess, 14 years ago (diff)

商品種別によってカートを分ける(#823)

  • dtb_products_class.down を使用した暫定的な対応
  • Property svn:eol-style set to LF
  • Property svn:mime-type set to text/x-smarty-template; charset=UTF-8
Line 
1<!--{*
2 * This file is part of EC-CUBE
3 *
4 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 *}-->
22<script type="text/javascript">//<![CDATA[
23// 規格2に選択肢を割り当てる。
24function fnSetClassCategories(form, classcat_id2_selected) {
25    sele1 = form.classcategory_id1;
26    sele2 = form.classcategory_id2;
27    product_id = form.product_id.value;
28
29    if (sele1) {
30        if (sele2) {
31            // 規格2の選択肢をクリア
32            count = sele2.options.length;
33            for(i = count; i >= 0; i--) {
34                sele2.options[i] = null;
35            }
36           
37            // 規格2に選択肢を割り当てる
38            classcats = productsClassCategories[product_id][sele1.value];
39            i = 0;
40            for (var classcat_id2_key in classcats) {
41                sele2.options[i] = new Option(classcats[classcat_id2_key].name, classcat_id2_key);
42                if (classcat_id2_key == classcat_id2_selected) {
43                    sele2.options[i].selected = true;
44                }
45                i++;
46            }
47        }
48        fnCheckStock(form);
49    }
50}
51// 並び順を変更
52function fnChangeOrderby(orderby) {
53    fnSetVal('orderby', orderby);
54    fnSetVal('pageno', 1);
55    fnSubmit();
56}
57// 表示件数を変更
58function fnChangeDispNumber(dispNumber) {
59    fnSetVal('disp_number', dispNumber);
60    fnSetVal('pageno', 1);
61    fnSubmit();
62}
63// カゴに入れる
64function fnInCart(productForm) {
65    var product_id = productForm["product_id"].value;
66    fnChangeAction("?#product" + product_id);
67    if (productForm["classcategory_id1"]) {
68        fnSetVal("classcategory_id1", productForm["classcategory_id1"].value);
69    }
70    if (productForm["classcategory_id2"]) {
71        fnSetVal("classcategory_id2", productForm["classcategory_id2"].value);
72    }
73    fnSetVal("quantity", productForm["quantity"].value);
74    fnSetVal("product_id", productForm["product_id"].value);
75    fnSetVal("product_class_id", productForm["product_class_id"].value);
76    fnSubmit();
77}
78function fnCheckStock(form) {
79    product_id = form.product_id.value;
80    classcat_id1 = form.classcategory_id1.value;
81    classcat_id2 = form.classcategory_id2 ? form.classcategory_id2.value : 0;
82    classcat2 = productsClassCategories[product_id][classcat_id1][classcat_id2];
83   
84    // 在庫(品切れ)
85    eleDefault = document.getElementById('cartbtn_default_' + product_id);
86    eleDynamic = document.getElementById('cartbtn_dynamic_' + product_id);
87    if (
88           classcat2
89        && classcat2.stock_find === false
90    ) {
91        eleDefault.style.display = 'none';
92        eleDynamic.innerHTML = '申し訳ございませんが、只今品切れ中です。';
93    } else {
94        eleDefault.style.display = '';
95        eleDynamic.innerHTML = '';
96    }
97   
98    // 販売価格
99    eleDefault = document.getElementById('price02_default_' + product_id);
100    eleDynamic = document.getElementById('price02_dynamic_' + product_id);
101    if (
102           classcat2
103        && typeof classcat2.price02 != 'undefined'
104        && String(classcat2.price02).length >= 1
105    ) {
106        eleDefault.style.display = 'none';
107        eleDynamic.innerHTML = classcat2.price02;
108    } else {
109        eleDefault.style.display = '';
110        eleDynamic.innerHTML = '';
111    }
112    // 商品規格
113    eleDynamic = document.getElementById('product_class_id' + product_id);
114    if (
115           classcat2
116        && typeof classcat2.product_class_id != 'undefined'
117        && String(classcat2.product_class_id).length >= 1
118    ) {
119        eleDynamic.value = classcat2.product_class_id;
120    } else {
121        eleDynamic.value = ''
122    }
123    // 商品種別
124    eleDynamic = document.getElementById('product_type' + product_id);
125    if (
126           classcat2
127        && typeof classcat2.product_type != 'undefined'
128        && String(classcat2.product_type).length >= 1
129    ) {
130        eleDynamic.value = classcat2.product_type;
131    } else {
132        eleDynamic.value = ''
133    }
134}
135//]]>
136</script>
137
138<!--▼CONTENTS-->
139<div id="undercolumn" class="product product_list">
140    <form name="form1" id="form1" method="get" action="?">
141        <input type="hidden" name="mode" value="<!--{$mode|escape}-->" />
142        <!--{* ▼検索条件 *}-->
143        <input type="hidden" name="category_id" value="<!--{$arrSearchData.category_id|escape}-->" />
144        <input type="hidden" name="maker_id" value="<!--{$arrSearchData.maker_id|escape}-->" />
145        <input type="hidden" name="name" value="<!--{$arrSearchData.name|escape}-->" />
146        <!--{* ▲検索条件 *}-->
147        <!--{* ▼ページナビ関連 *}-->
148        <input type="hidden" name="orderby" value="<!--{$orderby|escape}-->" />
149        <input type="hidden" name="disp_number" value="<!--{$disp_number|escape}-->" />
150        <input type="hidden" name="pageno" value="<!--{$tpl_pageno|escape}-->" />
151        <!--{* ▲ページナビ関連 *}-->
152        <!--{* ▼注文関連 *}-->
153        <input type="hidden" name="product_id" value="" />
154        <input type="hidden" name="classcategory_id1" value="" />
155        <input type="hidden" name="classcategory_id2" value="" />
156        <input type="hidden" name="product_class_id" value="" />
157        <input type="hidden" name="product_type" value="" />
158        <input type="hidden" name="quantity" value="" />
159        <!--{* ▲注文関連 *}-->
160        <input type="hidden" name="rnd" value="<!--{$tpl_rnd|escape}-->" />
161    </form>
162   
163    <!--★タイトル★-->
164    <h2 class="title"><!--{$tpl_subtitle|escape}--></h2>
165   
166    <!--▼検索条件-->
167    <!--{if $tpl_subtitle == "検索結果"}-->
168        <ul class="pagecondarea">
169            <li><strong>商品カテゴリ:</strong><!--{$arrSearch.category|escape}--></li>
170        <!--{if $arrSearch.maker|strlen >= 1}--><li><strong>メーカー:</strong><!--{$arrSearch.maker|escape}--></li><!--{/if}-->
171            <li><strong>商品名:</strong><!--{$arrSearch.name|escape}--></li>
172        </ul>
173    <!--{/if}-->
174    <!--▲検索条件-->
175
176    <!--▼ページナビ(本文)-->
177    <!--{capture name=page_navi_body}-->
178        <div class="pagenumberarea">
179            <div class="change">
180                <!--{if $orderby != 'price'}-->
181                    <a href="javascript:fnChangeOrderby('price');">価格順</a>
182                <!--{else}-->
183                    <strong>価格順</strong>
184                <!--{/if}-->&nbsp;
185                <!--{if $orderby != "date"}-->
186                        <a href="javascript:fnChangeOrderby('date');">新着順</a>
187                <!--{else}-->
188                    <strong>新着順</strong>
189                <!--{/if}-->
190                表示件数
191                <select name="disp_number" onchange="javascript:fnChangeDispNumber(this.value);">
192                    <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}-->
193                        <!--{if $num == $disp_number}-->
194                        <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option>
195                        <!--{else}-->
196                        <option value="<!--{$num}-->" ><!--{$dispnum}--></option>
197                        <!--{/if}-->
198                    <!--{/foreach}-->
199                </select>
200            </div>
201            <div class="navi"><!--{$tpl_strnavi}--></div>
202        </div>
203    <!--{/capture}-->
204    <!--▲ページナビ(本文)-->
205
206    <!--{foreach from=$arrProducts item=arrProduct name=arrProducts}-->
207
208        <!--{if $smarty.foreach.arrProducts.first}-->
209            <!--▼件数-->
210            <div>
211                <span class="pagenumber"><!--{$tpl_linemax}--></span>件の商品がございます。
212            </div>
213            <!--▲件数-->
214           
215            <!--▼ページナビ(上部)-->
216            <form name="page_navi_top" id="page_navi_top" action="?">
217                <!--{if $tpl_linemax > 0}--><!--{$smarty.capture.page_navi_body|smarty:nodefaults}--><!--{/if}-->
218            </form>
219            <!--▲ページナビ(上部)-->
220        <!--{/if}-->
221
222        <!--{assign var=id value=$arrProduct.product_id}-->
223        <!--{assign var=arrErr value=$arrProduct.arrErr}-->
224        <!--▼商品-->
225        <div class="listarea">
226        <a name="product<!--{$id|escape}-->" />
227            <div class="listphoto">
228                <!--★画像★-->
229                <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id|escape:url}-->" class="over"><!--商品写真--><img src="<!--{$smarty.const.IMAGE_SAVE_URL|sfTrimURL}-->/<!--{$arrProduct.main_list_image|sfNoImageMainList|escape}-->" alt="<!--{$arrProduct.name|escape}-->" class="picture" /></a>
230            </div>
231           
232            <div class="listrightblock">
233                <!--▼商品ステータス-->
234                <!--{if $arrProduct.product_flag|strpos:"1" !== false}-->
235                    <ul class="status_icon">
236                        <!--{section name=flg loop=$arrProduct.product_flag|count_characters}-->
237                            <!--{if $arrProduct.product_flag[flg] == "1"}-->
238                                <li>
239                                    <!--{assign var=key value="`$smarty.section.flg.iteration`"}-->
240                                    <img src="<!--{$TPL_DIR}--><!--{$arrSTATUS_IMAGE[$key]}-->" width="65" height="17" alt="<!--{$arrSTATUS[$key]}-->"/>
241                                </li>
242                            <!--{/if}-->
243                        <!--{/section}-->
244                    </ul>
245                <!--{/if}-->
246                <!--▲商品ステータス-->
247               
248                <!--★商品名★-->
249                <h3>
250                    <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id|escape:url}-->" name="product<!--{$arrProduct.product_id}-->"><!--{$arrProduct.name|escape}--></a>
251                </h3>
252               
253                <!--★コメント★-->
254                <p class="listcomment"><!--{$arrProduct.main_list_comment|escape|nl2br}--></p>
255               
256                <p>
257                    <span class="pricebox sale_price">
258                        <!--{$smarty.const.SALE_PRICE_TITLE}--><span class="mini">(税込)</span>:
259                        <span class="price">
260                            <span id="price02_default_<!--{$id}-->">
261                                <!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
262                                    <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
263                                <!--{else}-->
264                                    <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->~<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
265                                <!--{/if}-->
266                            </span><span id="price02_dynamic_<!--{$id}-->"></span>
267                            円</span>
268                    </span>
269                   
270                    <!--★詳細ボタン★-->
271                    <span class="btnbox">
272                        <!--{assign var=name value="detail`$id`"}-->
273                        <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id|escape:url}-->" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_detail_on.gif','<!--{$name}-->');" onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_detail.gif','<!--{$name}-->');">
274                            <img src="<!--{$TPL_DIR}-->img/products/b_detail.gif" width="115" height="25" alt="詳しくはこちら" name="<!--{$name}-->" id="<!--{$name}-->" /></a>
275                    </span>
276                </p>
277
278                <!--▼買い物かご-->
279                <form name="product_form<!--{$id|escape}-->" action="?" onsubmit="return false;">
280                    <input type="hidden" name="product_id" value="<!--{$id|escape}-->" />
281                    <input type="hidden" name="product_class_id" id="product_class_id<!--{$id|escape}-->" value="<!--{$tpl_product_class_id[$id]}-->" />
282                    <input type="hidden" name="product_type" id="product_type<!--{$id|escape}-->" value="<!--{$tpl_product_type[$id]}-->" />
283                    <div class="in_cart">
284                        <!--{if $tpl_stock_find[$id]}-->
285                            <dl>
286                                <!--{if $tpl_classcat_find1[$id]}-->
287                                    <!--▼規格1-->
288                                    <dt><!--{$tpl_class_name1[$id]|escape}-->:</dt>
289                                    <dd>
290                                        <select name="classcategory_id1"
291                                            style="<!--{$arrErr.classcategory_id1|sfGetErrorColor}-->"
292                                            onchange="fnSetClassCategories(this.form);"
293                                        >
294                                            <!--{html_options options=$arrClassCat1[$id] selected=$arrProduct.classcategory_id1}-->
295                                        </select>
296                                        <!--{if $arrErr.classcategory_id1 != ""}-->
297                                            <br /><span class="attention">※ <!--{$tpl_class_name1[$id]}-->を入力して下さい。</span>
298                                        <!--{/if}-->
299                                    </dd>
300                                    <!--▲規格1-->
301                                <!--{/if}-->
302                                <!--{if $tpl_classcat_find2[$id]}-->
303                                    <!--▼規格2-->
304                                    <dt><!--{$tpl_class_name2[$id]|escape}-->:</dt>
305                                    <dd>
306                                        <select name="classcategory_id2"
307                                            style="<!--{$arrErr.classcategory_id2|sfGetErrorColor}-->"
308                                            onchange="fnCheckStock(this.form);"
309                                        >
310                                        </select>
311                                        <!--{if $arrErr.classcategory_id2 != ""}-->
312                                            <br /><span class="attention">※ <!--{$tpl_class_name2[$id]}-->を入力して下さい。</span>
313                                        <!--{/if}-->
314                                    </dd>
315                                    <!--▲規格2-->
316                                <!--{/if}-->
317
318                                <dt>数量:</dt>
319                                <dd>
320                                    <input type="text" name="quantity" class="box54" value="<!--{$arrProduct.quantity|default:1|escape}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr.quantity|sfGetErrorColor}-->" />
321                                    <!--{if $arrErr.quantity != ""}-->
322                                        <br /><span class="attention"><!--{$arrErr.quantity}--></span>
323                                    <!--{/if}-->
324                                </dd>
325                            </dl>
326                            <div class="cartbtn">
327                                <!--★カゴに入れる★-->
328                                <div id="cartbtn_default_<!--{$id}-->">
329                                    <input
330                                        type="image"
331                                        id="cart<!--{$id}-->"
332                                        src="<!--{$TPL_DIR}-->img/products/b_cartin.gif"
333                                        alt="カゴに入れる"
334                                        onclick="fnInCart(this.form); return false;"
335                                        onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif', this);"
336                                        onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif', this);"
337                                    />
338                                </div>
339                                <div class="attention" id="cartbtn_dynamic_<!--{$id}-->"></div>
340                            </div>
341                        <!--{else}-->
342                            <div class="cartbtn attention">申し訳ございませんが、只今品切れ中です。</div>
343                        <!--{/if}-->
344                    </div>
345                </form>
346                <!--▲買い物かご-->
347               
348            </div>
349        </div>
350        <!--▲商品-->
351
352        <!--{if $smarty.foreach.arrProducts.last}-->
353            <!--▼ページナビ(下部)-->
354            <form name="page_navi_bottom" id="page_navi_bottom" action="?">
355                <!--{if $tpl_linemax > 0}--><!--{$smarty.capture.page_navi_body|smarty:nodefaults}--><!--{/if}-->
356            </form>
357            <!--▲ページナビ(下部)-->
358        <!--{/if}-->
359
360    <!--{foreachelse}-->
361        <!--{include file="frontparts/search_zero.tpl"}-->
362    <!--{/foreach}-->
363
364</div>
365<!--▲CONTENTS-->
Note: See TracBrowser for help on using the repository browser.