forked from PrestaShop/blocklayered
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blocklayered.tpl
252 lines (251 loc) · 13.9 KB
/
blocklayered.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
{*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registred Trademark & Property of PrestaShop SA
*}
{if $nbr_filterBlocks != 0}
<script type="text/javascript">
current_friendly_url = '#{$current_friendly_url}';
{if version_compare($smarty.const._PS_VERSION_,'1.5','>')}
param_product_url = '#{$param_product_url}';
{else}
param_product_url = '';
{/if}
</script>
<div id="layered_block_left" class="block">
<h4 class="title_block">{l s='Product filter' mod='blocklayered'}</h4>
<div class="block_content">
<form action="#" id="layered_form">
<div>
{if isset($selected_filters) && $n_filters > 0}
<div id="enabled_filters">
<span class="layered_subtitle" style="float: none;">{l s='Enabled filters:' mod='blocklayered'}</span>
<ul>
{foreach from=$selected_filters key=filter_type item=filter_values}
{foreach from=$filter_values key=filter_key item=filter_value name=f_values}
{foreach from=$filters item=filter}
{if $filter.type == $filter_type && isset($filter.values)}
{if isset($filter.slider)}
{if $smarty.foreach.f_values.first}
<li>
<a href="#" data-rel="layered_{$filter.type}_slider" title="{l s='Cancel' mod='blocklayered'}">x</a>
{if $filter.format == 1}
{l s='%1$s: %2$s - %3$s'|sprintf:$filter.name:{displayPrice price=$filter.values[0]}:{displayPrice price=$filter.values[1]}|escape:html:'UTF-8' mod='blocklayered'}
{else}
{l s='%1$s: %2$s %4$s - %3$s %4$s'|sprintf:$filter.name:$filter.values[0]:$filter.values[1]:$filter.unit|escape:html:'UTF-8' mod='blocklayered'}
{/if}
</li>
{/if}
{else}
{foreach from=$filter.values key=id_value item=value}
{if $id_value == $filter_key && !is_numeric($filter_value) && ($filter.type eq 'id_attribute_group' || $filter.type eq 'id_feature') || $id_value == $filter_value && $filter.type neq 'id_attribute_group' && $filter.type neq 'id_feature'}
<li>
<a href="#" data-rel="layered_{$filter.type_lite}_{$id_value}" title="{l s='Cancel' mod='blocklayered'}">x</a>
{l s='%1$s: %2$s' mod='blocklayered' sprintf=[$filter.name, $value.name]}
</li>
{/if}
{/foreach}
{/if}
{/if}
{/foreach}
{/foreach}
{/foreach}
</ul>
</div>
{/if}
{foreach from=$filters item=filter}
{if isset($filter.values)}
{if isset($filter.slider)}
<div class="layered_{$filter.type}" style="display: none;">
{else}
<div>
{/if}
<span class="layered_subtitle">{$filter.name|escape:html:'UTF-8'}</span>
<span class="layered_close"><a href="#" data-rel="ul_layered_{$filter.type}_{$filter.id_key}">v</a></span>
<div class="clear"></div>
<ul id="ul_layered_{$filter.type}_{$filter.id_key}">
{if !isset($filter.slider)}
{if $filter.filter_type == 0}
{foreach from=$filter.values key=id_value item=value name=fe}
{if $value.nbr || !$hide_0_values}
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if}">
{if isset($filter.is_color_group) && $filter.is_color_group}
<input class="color-option {if isset($value.checked) && $value.checked}on{/if} {if !$value.nbr}disable{/if}" type="button" name="layered_{$filter.type_lite}_{$id_value}" data-rel="{$id_value}_{$filter.id_key}" id="layered_id_attribute_group_{$id_value}" {if !$value.nbr}disabled="disabled"{/if} style="background: {if isset($value.color)}{if file_exists($col_img_dir|cat:$id_value|cat:'.jpg')}url({$img_col_dir}{$id_value}.jpg){else}{$value.color}{/if}{else}#CCC{/if};" title="{$value.name|escape:html:'UTF-8'}" />
{if isset($value.checked) && $value.checked}<input type="hidden" name="layered_{$filter.type_lite}_{$id_value}" value="{$id_value}" />{/if}
{else}
<input type="checkbox" class="checkbox" name="layered_{$filter.type_lite}_{$id_value}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{/if}" value="{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}"{if isset($value.checked)} checked="checked"{/if}{if !$value.nbr} disabled="disabled"{/if} />
{/if}
<label for="layered_{$filter.type_lite}_{$id_value}"{if !$value.nbr} class="disabled"{else}{if isset($filter.is_color_group) && $filter.is_color_group} name="layered_{$filter.type_lite}_{$id_value}" class="layered_color" data-rel="{$id_value}_{$filter.id_key}"{/if}{/if}>
{if !$value.nbr}
{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}
{else}
<a href="{$value.link}" data-rel="{$value.rel}">{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}</a>
{/if}
</label>
</li>
{/if}
{/foreach}
{else}
{if $filter.filter_type == 1}
{foreach from=$filter.values key=id_value item=value name=fe}
{if $value.nbr || !$hide_0_values}
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if}">
{if isset($filter.is_color_group) && $filter.is_color_group}
<input class="radio color-option {if isset($value.checked) && $value.checked}on{/if} {if !$value.nbr}disable{/if}" type="button" name="layered_{$filter.type_lite}_{$id_value}" data-rel="{$id_value}_{$filter.id_key}" id="layered_id_attribute_group_{$id_value}" {if !$value.nbr}disabled="disabled"{/if} style="background: {if isset($value.color)}{if file_exists($col_img_dir|cat:$id_value|cat:'.jpg')}url({$img_col_dir}{$id_value}.jpg){else}{$value.color}{/if}{else}#CCC{/if};" title="{$value.name|escape:html:'UTF-8'}"/>
{if isset($value.checked) && $value.checked}<input type="hidden" name="layered_{$filter.type_lite}_{$id_value}" value="{$id_value}" />{/if}
{else}
<input type="radio" class="radio layered_{$filter.type_lite}_{$id_value}" name="layered_{$filter.type_lite}{if $filter.id_key}_{$filter.id_key}{else}_1{/if}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}{/if}" value="{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}"{if isset($value.checked)} checked="checked"{/if}{if !$value.nbr} disabled="disabled"{/if} />
{/if}
<label for="layered_{$filter.type_lite}_{$id_value}"{if !$value.nbr} class="disabled"{else}{if isset($filter.is_color_group) && $filter.is_color_group} name="layered_{$filter.type_lite}_{$id_value}" class="layered_color" data-rel="{$id_value}_{$filter.id_key}"{/if}{/if}>
{if !$value.nbr}
{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}</a>
{else}
<a href="{$value.link}" data-rel="{$value.rel}">{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}</a>
{/if}
</label>
</li>
{/if}
{/foreach}
{else}
<select class="select" {if $filter.filter_show_limit > 1}multiple="multiple" size="{$filter.filter_show_limit}"{/if}>
<option value="">{l s='No filters' mod='blocklayered'}</option>
{foreach from=$filter.values key=id_value item=value}
{if $value.nbr || !$hide_0_values}
<option style="color: {if isset($value.color)}{$value.color}{/if}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{/if}" value="{$id_value}_{$filter.id_key}" {if isset($value.checked) && $value.checked}selected="selected"{/if} {if !$value.nbr}disabled="disabled"{/if}>
{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}</a>
</option>
{/if}
{/foreach}
</select>
{/if}
{/if}
{else}
{if $filter.filter_type == 0}
<label for="{$filter.type}">{l s='Range:' mod='blocklayered'}</label> <span id="layered_{$filter.type}_range"></span>
<div class="layered_slider_container">
<div class="layered_slider" id="layered_{$filter.type}_slider"></div>
</div>
<script type="text/javascript">
{literal}
var filterRange = {/literal}{$filter.max}-{$filter.min}{literal};
var step = filterRange / 100;
if (step > 1)
step = parseInt(step);
addSlider('{/literal}{$filter.type}{literal}',{
range: true,
step: step,
min: {/literal}{$filter.min}{literal},
max: {/literal}{$filter.max}{literal},
values: [ {/literal}{$filter.values[0]}{literal}, {/literal}{$filter.values[1]}{literal}],
slide: function( event, ui ) {
stopAjaxQuery();
{/literal}
{if $filter.format < 5}
{literal}
from = blocklayeredFormatCurrency(ui.values[0], {/literal}{$filter.format}{literal}, '{/literal}{$filter.unit}{literal}');
to = blocklayeredFormatCurrency(ui.values[1], {/literal}{$filter.format}{literal}, '{/literal}{$filter.unit}{literal}');
{/literal}
{else}
{literal}
from = ui.values[0]+'{/literal}{$filter.unit}{literal}';
to = ui.values[1]+'{/literal}{$filter.unit}{literal}';
{/literal}
{/if}
{literal}
$('#layered_{/literal}{$filter.type}{literal}_range').html(from+' - '+to);
},
stop: function () {
reloadContent();
}
}, '{/literal}{$filter.unit}{literal}', {/literal}{$filter.format}{literal});
{/literal}
</script>
{else}
{if $filter.filter_type == 1}
<li class="nomargin">
{l s='From' mod='blocklayered'} <input class="layered_{$filter.type}_range layered_input_range_min layered_input_range" id="layered_{$filter.type}_range_min" type="text" value="{$filter.values[0]}"/>
<span class="layered_{$filter.type}_range_unit">{$filter.unit}</span>
{l s='to' mod='blocklayered'} <input class="layered_{$filter.type}_range layered_input_range_max layered_input_range" id="layered_{$filter.type}_range_max" type="text" value="{$filter.values[1]}"/>
<span class="layered_{$filter.type}_range_unit">{$filter.unit}</span>
<span class="layered_{$filter.type}_format" style="display:none;">{$filter.format}</span>
<script type="text/javascript">
{literal}
$('#layered_{/literal}{$filter.type}{literal}_range_min').attr('limitValue', {/literal}{$filter.min}{literal});
$('#layered_{/literal}{$filter.type}{literal}_range_max').attr('limitValue', {/literal}{$filter.max}{literal});
{/literal}
</script>
</li>
{else}
{foreach from=$filter.list_of_values item=values}
<li class="nomargin {if $filter.values[1] == $values[1] && $filter.values[0] == $values[0]}layered_list_selected{/if} layered_list" onclick="$('#layered_{$filter.type}_range_min').val({$values[0]});$('#layered_{$filter.type}_range_max').val({$values[1]});reloadContent();">
- {l s='From' mod='blocklayered'} {$values[0]} {$filter.unit} {l s='to' mod='blocklayered'} {$values[1]} {$filter.unit}
</li>
{/foreach}
<li style="display: none;">
<input class="layered_{$filter.type}_range" id="layered_{$filter.type}_range_min" type="hidden" value="{$filter.values[0]}"/>
<input class="layered_{$filter.type}_range" id="layered_{$filter.type}_range_max" type="hidden" value="{$filter.values[1]}"/>
</li>
{/if}
{/if}
{/if}
{if count($filter.values) > $filter.filter_show_limit && $filter.filter_show_limit > 0 && $filter.filter_type != 2}
<span class="hide-action more">{l s='Show more' mod='blocklayered'}</span>
<span class="hide-action less">{l s='Show less' mod='blocklayered'}</span>
{/if}
</ul>
</div>
<script type="text/javascript">
{literal}
$('.layered_{/literal}{$filter.type}{literal}').show();
{/literal}
</script>
{/if}
{/foreach}
</div>
<input type="hidden" name="id_category_layered" value="{$id_category_layered}" />
{foreach from=$filters item=filter}
{if $filter.type_lite == 'id_attribute_group' && isset($filter.is_color_group) && $filter.is_color_group && $filter.filter_type != 2}
{foreach from=$filter.values key=id_value item=value}
{if isset($value.checked)}
<input type="hidden" name="layered_id_attribute_group_{$id_value}" value="{$id_value}_{$filter.id_key}" />
{/if}
{/foreach}
{/if}
{/foreach}
</form>
</div>
<div id="layered_ajax_loader" style="display: none;">
<p><img src="{$img_ps_dir}loader.gif" alt="" /><br />{l s='Loading...' mod='blocklayered'}</p>
</div>
</div>
{else}
<div id="layered_block_left" class="block">
<div class="block_content">
<form action="#" id="layered_form">
<input type="hidden" name="id_category_layered" value="{$id_category_layered}" />
</form>
</div>
<div style="display: none;">
<p style=""><img src="{$img_ps_dir}loader.gif" alt="" /><br />{l s='Loading...' mod='blocklayered'}</p>
</div>
</div>
{/if}