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

Revision 18829, 16.9 KB checked in by nanasess, 14 years ago (diff)

#781(規格のデータベースを木構造に)

  • カートの中身を product_class_id で特定するように修正
  • 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//]]>
125</script>
126
127<!--▼CONTENTS-->
128<div id="undercolumn" class="product product_list">
129    <form name="form1" id="form1" method="get" action="?">
130        <input type="hidden" name="mode" value="<!--{$mode|escape}-->" />
131        <!--{* ▼検索条件 *}-->
132        <input type="hidden" name="category_id" value="<!--{$arrSearchData.category_id|escape}-->" />
133        <input type="hidden" name="maker_id" value="<!--{$arrSearchData.maker_id|escape}-->" />
134        <input type="hidden" name="name" value="<!--{$arrSearchData.name|escape}-->" />
135        <!--{* ▲検索条件 *}-->
136        <!--{* ▼ページナビ関連 *}-->
137        <input type="hidden" name="orderby" value="<!--{$orderby|escape}-->" />
138        <input type="hidden" name="disp_number" value="<!--{$disp_number|escape}-->" />
139        <input type="hidden" name="pageno" value="<!--{$tpl_pageno|escape}-->" />
140        <!--{* ▲ページナビ関連 *}-->
141        <!--{* ▼注文関連 *}-->
142        <input type="hidden" name="product_id" value="" />
143        <input type="hidden" name="classcategory_id1" value="" />
144        <input type="hidden" name="classcategory_id2" value="" />
145        <input type="hidden" name="product_class_id" value="" />
146        <input type="hidden" name="quantity" value="" />
147        <!--{* ▲注文関連 *}-->
148        <input type="hidden" name="rnd" value="<!--{$tpl_rnd|escape}-->" />
149    </form>
150   
151    <!--★タイトル★-->
152    <h2 class="title"><!--{$tpl_subtitle|escape}--></h2>
153   
154    <!--▼検索条件-->
155    <!--{if $tpl_subtitle == "検索結果"}-->
156        <ul class="pagecondarea">
157            <li><strong>商品カテゴリ:</strong><!--{$arrSearch.category|escape}--></li>
158        <!--{if $arrSearch.maker|strlen >= 1}--><li><strong>メーカー:</strong><!--{$arrSearch.maker|escape}--></li><!--{/if}-->
159            <li><strong>商品名:</strong><!--{$arrSearch.name|escape}--></li>
160        </ul>
161    <!--{/if}-->
162    <!--▲検索条件-->
163
164    <!--▼ページナビ(本文)-->
165    <!--{capture name=page_navi_body}-->
166        <div class="pagenumberarea">
167            <div class="change">
168                <!--{if $orderby != 'price'}-->
169                    <a href="javascript:fnChangeOrderby('price');">価格順</a>
170                <!--{else}-->
171                    <strong>価格順</strong>
172                <!--{/if}-->&nbsp;
173                <!--{if $orderby != "date"}-->
174                        <a href="javascript:fnChangeOrderby('date');">新着順</a>
175                <!--{else}-->
176                    <strong>新着順</strong>
177                <!--{/if}-->
178                表示件数
179                <select name="disp_number" onchange="javascript:fnChangeDispNumber(this.value);">
180                    <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}-->
181                        <!--{if $num == $disp_number}-->
182                        <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option>
183                        <!--{else}-->
184                        <option value="<!--{$num}-->" ><!--{$dispnum}--></option>
185                        <!--{/if}-->
186                    <!--{/foreach}-->
187                </select>
188            </div>
189            <div class="navi"><!--{$tpl_strnavi}--></div>
190        </div>
191    <!--{/capture}-->
192    <!--▲ページナビ(本文)-->
193
194    <!--{foreach from=$arrProducts item=arrProduct name=arrProducts}-->
195
196        <!--{if $smarty.foreach.arrProducts.first}-->
197            <!--▼件数-->
198            <div>
199                <span class="pagenumber"><!--{$tpl_linemax}--></span>件の商品がございます。
200            </div>
201            <!--▲件数-->
202           
203            <!--▼ページナビ(上部)-->
204            <form name="page_navi_top" id="page_navi_top" action="?">
205                <!--{if $tpl_linemax > 0}--><!--{$smarty.capture.page_navi_body|smarty:nodefaults}--><!--{/if}-->
206            </form>
207            <!--▲ページナビ(上部)-->
208        <!--{/if}-->
209
210        <!--{assign var=id value=$arrProduct.product_id}-->
211        <!--{assign var=arrErr value=$arrProduct.arrErr}-->
212        <!--▼商品-->
213        <div class="listarea">
214        <a name="product<!--{$id|escape}-->" />
215            <div class="listphoto">
216                <!--★画像★-->
217                <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>
218            </div>
219           
220            <div class="listrightblock">
221                <!--▼商品ステータス-->
222                <!--{if $arrProduct.product_flag|strpos:"1" !== false}-->
223                    <ul class="status_icon">
224                        <!--{section name=flg loop=$arrProduct.product_flag|count_characters}-->
225                            <!--{if $arrProduct.product_flag[flg] == "1"}-->
226                                <li>
227                                    <!--{assign var=key value="`$smarty.section.flg.iteration`"}-->
228                                    <img src="<!--{$TPL_DIR}--><!--{$arrSTATUS_IMAGE[$key]}-->" width="65" height="17" alt="<!--{$arrSTATUS[$key]}-->"/>
229                                </li>
230                            <!--{/if}-->
231                        <!--{/section}-->
232                    </ul>
233                <!--{/if}-->
234                <!--▲商品ステータス-->
235               
236                <!--★商品名★-->
237                <h3>
238                    <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id|escape:url}-->" name="product<!--{$arrProduct.product_id}-->"><!--{$arrProduct.name|escape}--></a>
239                </h3>
240               
241                <!--★コメント★-->
242                <p class="listcomment"><!--{$arrProduct.main_list_comment|escape|nl2br}--></p>
243               
244                <p>
245                    <span class="pricebox sale_price">
246                        <!--{$smarty.const.SALE_PRICE_TITLE}--><span class="mini">(税込)</span>:
247                        <span class="price">
248                            <span id="price02_default_<!--{$id}-->">
249                                <!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
250                                    <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
251                                <!--{else}-->
252                                    <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->~<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
253                                <!--{/if}-->
254                            </span><span id="price02_dynamic_<!--{$id}-->"></span>
255                            円</span>
256                    </span>
257                   
258                    <!--★詳細ボタン★-->
259                    <span class="btnbox">
260                        <!--{assign var=name value="detail`$id`"}-->
261                        <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}-->');">
262                            <img src="<!--{$TPL_DIR}-->img/products/b_detail.gif" width="115" height="25" alt="詳しくはこちら" name="<!--{$name}-->" id="<!--{$name}-->" /></a>
263                    </span>
264                </p>
265
266                <!--▼買い物かご-->
267                <form name="product_form<!--{$id|escape}-->" action="?" onsubmit="return false;">
268                    <input type="hidden" name="product_id" value="<!--{$id|escape}-->" />
269                    <input type="hidden" name="product_class_id" id="product_class_id<!--{$id|escape}-->" value="<!--{$tpl_product_class_id[$id]}-->" />
270                    <div class="in_cart">
271                        <!--{if $tpl_stock_find[$id]}-->
272                            <dl>
273                                <!--{if $tpl_classcat_find1[$id]}-->
274                                    <!--▼規格1-->
275                                    <dt><!--{$tpl_class_name1[$id]|escape}-->:</dt>
276                                    <dd>
277                                        <select name="classcategory_id1"
278                                            style="<!--{$arrErr.classcategory_id1|sfGetErrorColor}-->"
279                                            onchange="fnSetClassCategories(this.form);"
280                                        >
281                                            <!--{html_options options=$arrClassCat1[$id] selected=$arrProduct.classcategory_id1}-->
282                                        </select>
283                                        <!--{if $arrErr.classcategory_id1 != ""}-->
284                                            <br /><span class="attention">※ <!--{$tpl_class_name1[$id]}-->を入力して下さい。</span>
285                                        <!--{/if}-->
286                                    </dd>
287                                    <!--▲規格1-->
288                                <!--{/if}-->
289                                <!--{if $tpl_classcat_find2[$id]}-->
290                                    <!--▼規格2-->
291                                    <dt><!--{$tpl_class_name2[$id]|escape}-->:</dt>
292                                    <dd>
293                                        <select name="classcategory_id2"
294                                            style="<!--{$arrErr.classcategory_id2|sfGetErrorColor}-->"
295                                            onchange="fnCheckStock(this.form);"
296                                        >
297                                        </select>
298                                        <!--{if $arrErr.classcategory_id2 != ""}-->
299                                            <br /><span class="attention">※ <!--{$tpl_class_name2[$id]}-->を入力して下さい。</span>
300                                        <!--{/if}-->
301                                    </dd>
302                                    <!--▲規格2-->
303                                <!--{/if}-->
304
305                                <dt>数量:</dt>
306                                <dd>
307                                    <input type="text" name="quantity" class="box54" value="<!--{$arrProduct.quantity|default:1|escape}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr.quantity|sfGetErrorColor}-->" />
308                                    <!--{if $arrErr.quantity != ""}-->
309                                        <br /><span class="attention"><!--{$arrErr.quantity}--></span>
310                                    <!--{/if}-->
311                                </dd>
312                            </dl>
313                            <div class="cartbtn">
314                                <!--★カゴに入れる★-->
315                                <div id="cartbtn_default_<!--{$id}-->">
316                                    <input
317                                        type="image"
318                                        id="cart<!--{$id}-->"
319                                        src="<!--{$TPL_DIR}-->img/products/b_cartin.gif"
320                                        alt="カゴに入れる"
321                                        onclick="fnInCart(this.form); return false;"
322                                        onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif', this);"
323                                        onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif', this);"
324                                    />
325                                </div>
326                                <div class="attention" id="cartbtn_dynamic_<!--{$id}-->"></div>
327                            </div>
328                        <!--{else}-->
329                            <div class="cartbtn attention">申し訳ございませんが、只今品切れ中です。</div>
330                        <!--{/if}-->
331                    </div>
332                </form>
333                <!--▲買い物かご-->
334               
335            </div>
336        </div>
337        <!--▲商品-->
338
339        <!--{if $smarty.foreach.arrProducts.last}-->
340            <!--▼ページナビ(下部)-->
341            <form name="page_navi_bottom" id="page_navi_bottom" action="?">
342                <!--{if $tpl_linemax > 0}--><!--{$smarty.capture.page_navi_body|smarty:nodefaults}--><!--{/if}-->
343            </form>
344            <!--▲ページナビ(下部)-->
345        <!--{/if}-->
346
347    <!--{foreachelse}-->
348        <!--{include file="frontparts/search_zero.tpl"}-->
349    <!--{/foreach}-->
350
351</div>
352<!--▲CONTENTS-->
Note: See TracBrowser for help on using the repository browser.