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

Revision 18852, 17.5 KB checked in by nanasess, 13 years ago (diff)

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

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