source: branches/version-2_13-dev/data/Smarty/templates/sphone/products/list.tpl @ 23041

Revision 23041, 9.9 KB checked in by poego, 11 years ago (diff)

#2283 resize_image.phpの処理をCSSに変更
r23005 でresize_imageにIDを渡して処理するようにしたが、
やはり毎回DB処理、Resize処理を走らせるのは重いので、標準をCSSでの対応としてみる。
resize_image.php自体は残しているので使いたい場合は利用可能としておく

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • 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-2013 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
23<script type="text/javascript" src="<!--{$smarty.const.ROOT_URLPATH}-->js/products.js"></script>
24<script type="text/javascript">//<![CDATA[
25    // 並び順を変更
26    function fnChangeOrderby(orderby) {
27        fnSetVal('orderby', orderby);
28        fnSetVal('pageno', 1);
29        fnSubmit();
30    }
31    // 表示件数を変更
32    function fnChangeDispNumber(dispNumber) {
33        fnSetVal('disp_number', dispNumber);
34        fnSetVal('pageno', 1);
35        fnSubmit();
36    }
37//]]></script>
38
39<section id="product_list">
40    <form name="form1" id="form1" method="get" action="<!--{$smarty.const.ROOT_URLPATH}-->products/list.php">
41        <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
42        <input type="hidden" name="mode" value="<!--{$mode|h}-->" />
43        <input type="hidden" name="category_id" value="<!--{$arrSearchData.category_id|h}-->" />
44        <input type="hidden" name="maker_id" value="<!--{$arrSearchData.maker_id|h}-->" />
45        <input type="hidden" name="name" value="<!--{$arrSearchData.name|h}-->" />
46        <input type="hidden" name="orderby" value="<!--{$orderby|h}-->" />
47        <input type="hidden" name="disp_number" value="<!--{$disp_number|h}-->" />
48        <input type="hidden" name="pageno" value="<!--{$tpl_pageno|h}-->" />
49        <input type="hidden" name="rnd" value="<!--{$tpl_rnd|h}-->" />
50    </form>
51
52    <h2 class="title"><!--{$tpl_subtitle|h}--></h2>
53    <p class="intro clear"><span class="attention"><span id="productscount"><!--{$tpl_linemax}--></span>件</span>の商品がございます。</p>
54
55    <!--▼ページナビ(本文)-->
56    <section class="pagenumberarea clearfix">
57        <ul>
58            <!--{if $orderby != 'price'}-->
59                <li><a href="javascript:fnChangeOrderby('price');" rel="external">価格順</a></li>
60            <!--{else}-->
61                <li class="on_number">価格順</li>
62            <!--{/if}-->
63            <!--{if $orderby != "date"}-->
64                <li><a href="javascript:fnChangeOrderby('date');" rel="external">新着順</a></li>
65            <!--{else}-->
66                <li class="on_number">新着順</li>
67            <!--{/if}-->
68        </ul>
69    </section>
70    <!--▲ページナビ(本文)-->
71
72    <!--{foreach from=$arrProducts item=arrProduct name=arrProducts}-->
73        <!--{assign var=id value=$arrProduct.product_id}-->
74        <!--{assign var=arrErr value=$arrProduct.arrErr}-->
75        <!--▼商品-->
76        <div class="list_area clearfix">
77            <!--★画像★-->
78            <p class="listphoto"><img src="<!--{$smarty.const.IMAGE_SAVE_URLPATH}--><!--{$arrProduct.main_list_image|sfNoImageMainList|h}-->" style="max-width: 80px;max-height: 80;" alt="<!--{$arrProduct.name|h}-->" /></p>
79            <div class="listrightblock">
80                <div class="statusArea">
81                    <!--▼商品ステータス-->
82                    <!--{if count($productStatus[$id]) > 0}-->
83                        <ul class="status_icon">
84                            <!--{foreach from=$productStatus[$id] item=status}-->
85                                <li><!--{$arrSTATUS[$status]}--></li>
86                            <!--{/foreach}-->
87                        </ul>
88                    <!--{/if}-->
89                    <!--▲商品ステータス-->
90                </div>
91                <!--★商品名★-->
92                <h3><a rel="external" href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrProduct.product_id|u}-->" name="product<!--{$arrProduct.product_id}-->" class="productName"><!--{$arrProduct.name|h}--></a></h3>
93
94                <!--★商品価格★-->
95                <p>
96                    <span class="pricebox sale_price"><span class="mini"><!--{$smarty.const.SALE_PRICE_TITLE|h}-->(税込):</span></span>
97                    <span class="price">
98                        <span id="price02_default_<!--{$id}-->">
99                            <!--{if $arrProduct.price02_min_inctax == $arrProduct.price02_max_inctax}-->
100                                <!--{$arrProduct.price02_min_inctax|number_format}-->
101                            <!--{else}-->
102                                <!--{$arrProduct.price02_min_inctax|number_format}-->~<!--{$arrProduct.price02_max_inctax|number_format}-->
103                            <!--{/if}-->
104                        </span><span id="price02_dynamic_<!--{$id}-->">
105                        </span>円
106                    </span>
107                </p>
108
109                <!--★商品コメント★-->
110                <p class="listcomment"><!--{$arrProduct.main_list_comment|h|nl2br}--></p>
111            </div>
112        </div>
113        <!--▲商品-->
114
115    <!--{foreachelse}-->
116        <!--{include file="frontparts/search_zero.tpl"}-->
117    <!--{/foreach}-->
118
119    <!--{if count($arrProducts) < $tpl_linemax}-->
120        <div class="btn_area">
121            <p><a rel="external" href="javascript: void(0);" class="btn_more" id="btn_more_product" onClick="getProducts(<!--{$disp_number|h}-->); return false;">もっとみる(+<!--{$disp_number|h}-->件)</a></p>
122        </div>
123    <!--{/if}-->
124</section>
125
126<!--{include file= 'frontparts/search_area.tpl'}-->
127
128<script>
129    var pageNo = 2;
130    var url = "<!--{$smarty.const.P_DETAIL_URLPATH}-->";
131    var imagePath = "<!--{$smarty.const.IMAGE_SAVE_URLPATH}-->";
132    var statusImagePath = "<!--{$TPL_URLPATH}-->";
133
134    function getProducts(limit) {
135        $.mobile.showPageLoadingMsg();
136        var i = limit;
137        //送信データを準備
138        var postData = {};
139        $('#form1').find(':input').each(function(){
140            postData[$(this).attr('name')] = $(this).val();
141        });
142        postData["mode"] = "json";
143        postData["pageno"] = pageNo;
144
145        $.ajax({
146            type: "POST",
147            data: postData,
148            url: "<!--{$smarty.const.ROOT_URLPATH}-->products/list.php",
149            cache: false,
150            dataType: "json",
151            error: function(XMLHttpRequest, textStatus, errorThrown){
152                alert(textStatus);
153                $.mobile.hidePageLoadingMsg();
154            },
155            success: function(result){
156                var productStatus = result.productStatus;
157                for (var product_id in result) {
158                    if (isNaN(product_id)) continue;
159                    var product = result[product_id];
160                    var productHtml = "";
161                    var maxCnt = $(".list_area").length - 1;
162                    var productEl = $(".list_area").get(maxCnt);
163                    productEl = $(productEl).clone(true).insertAfter(productEl);
164                    maxCnt++;
165
166                    //商品写真をセット
167                    $($(".list_area .listphoto img").get(maxCnt)).attr({
168                        src: "<!--{$smarty.const.IMAGE_SAVE_URLPATH}-->" + product.main_list_image,
169                        alt: product.name
170                    });
171
172                    // 商品ステータスをセット
173                    var statusAreaEl = $($(".list_area div.statusArea").get(maxCnt));
174                    // 商品ステータスの削除
175                    statusAreaEl.empty();
176
177                    if (productStatus[product.product_id] != null) {
178                        var statusEl = '<ul class="status_icon">';
179                        var statusCnt = productStatus[product.product_id].length;
180                        for (var k = 0; k < statusCnt; k++) {
181                            var status = productStatus[product.product_id][k];
182                            var statusImgEl = '<li>' + status.status_name + '</li>' + "\n";
183                            statusEl += statusImgEl;
184                        }
185                        statusEl += "</ul>";
186                        statusAreaEl.append(statusEl);
187                    }
188
189                    //商品名をセット
190                    $($(".list_area a.productName").get(maxCnt)).text(product.name);
191                    $($(".list_area a.productName").get(maxCnt)).attr("href", url + product.product_id);
192
193                    //販売価格をセット
194                    var price = $($(".list_area span.price").get(maxCnt));
195                    //販売価格をクリア
196                    price.empty();
197                    var priceVale = "";
198                    //販売価格が範囲か判定
199                    if (product.price02_min == product.price02_max) {
200                        priceVale = product.price02_min_inctax_format + '円';
201                    } else {
202                        priceVale = product.price02_min_inctax_format + '~' + product.price02_max_inctax_format + '円';
203                    }
204                    price.append(priceVale);
205
206                    //コメントをセット
207                    $($(".list_area .listcomment").get(maxCnt)).text(product.main_list_comment);
208                }
209                pageNo++;
210
211                //全ての商品を表示したか判定
212                if (parseInt($("#productscount").text()) <= $(".list_area").length) {
213                    $("#btn_more_product").hide();
214                }
215                $.mobile.hidePageLoadingMsg();
216            }
217        });
218    }
219</script>
Note: See TracBrowser for help on using the repository browser.