@@ -219,61 +219,31 @@ It can also contain multiple templates to include different view types(grid view
219
219
,searchResultSetTemp:
220
220
{
221
221
"grid":
222
- '{{#products}}'+
223
- '{{{every_three}}}'+
224
- '<div class="product-container {{{nth_item}}}">'+
225
- '<div class="product-item item-template-0 alternative">'+
226
- '<div class="img">'+
227
- '<a href="{{productUrl}}" >'+
228
- '<img src="{{imageUrl}}" alt="" onerror="this.style.display=\'none\';">'+
229
- '</a>'+
230
- '</div>'+
231
- '<div class="name">'+
232
- '<a href="{{productUrl}}" > {{title}}'+
233
- '</a>'+
234
- '</div>'+
235
- '<div class="stars">'+
236
- '</div>'+
237
- '<div class="price">'+
238
- '{{#if_on_sale this}}'+
239
- '<div class="on-sale">Sale</div>'+
240
- '<del class="price2">${{format_price retail_price}} </del>'+
241
- '{{/if_on_sale}}'+
242
- '<span class="hidden"> </span> ${{format_price price}}'+
243
- '</div>'+
244
- '</div>'+
245
- '</div>'+
246
- '{{/products}}',
222
+ ['{{#products}}<li class="grid_view"><a href="product.html?pid={{uniqueId}}" id="pdt-{{uniqueId}}" class="result-item" unbxdParam_sku="{{uniqueId}}" unbxdParam_pRank="{{unbxdprank}}" unbxdAttr="product">'
223
+ ,'<div class="result-image-container">'
224
+ ,'<span class="result-image-horizontal-holder">'
225
+ ,'<img src="{{{image_url}}}" alt="{{{title}}}">'
226
+ ,'</span>'
227
+ ,'</div>'
228
+ ,'<div class="result-brand">{{{brand}}}</div>'
229
+ ,'<div class="result-title">{{{title}}}</div>'
230
+ ,'<div class="result-price">'
231
+ ,'${{price}}'
232
+ ,'</div>'
233
+ ,'</a></li>{{/products}}'].join(''),
247
234
"list":
248
- '<ul class="nxt-product-list nxt-view-list clearfix">'
249
- +'{{#products}}'
250
- +'<li class="nxt-product-item product-item">'
251
- +'<div class="nxt-product-item-wrap">'
252
- +'<div class="nxt-image-wrapper">'
253
- +'<a href="{{productUrl}}" >'
254
- +'<img class="nxt-product-image" width="150" height="150" src="{{imageUrl}}" alt="" onerror="this.style.display=\'none\';">'
255
- +'{{#if_on_sale this}}<div class="on-sale">Sale</div>{{/if_on_sale}}'
256
- +'</a>'
257
- +'</div>'
258
- +'<div class="nxt-product-details">'
259
- +'<div class="nxt-product-col1">'
260
- +'<div class="nxt-product-name">'
261
- +'<a href="{{productUrl}}" >{{title}}</a>'
262
- +'</div>'
263
- +'<div class="nxt-product-description">After more than 14,000 live fittings with lady golfers, Bridgestone Golf has developed a ladies specific model engineered for moderate swing speeds. The new Lady Precept is designed to produce higher launch ...</div>'
264
- +'</div>'
265
- +'<div class="nxt-product-col2">'
266
- +'{{#if_on_sale this}}<del class="price2">${{format_price retail_price}} </del>{{/if_on_sale}}'
267
- +'<span class="hidden"> </span> ${{format_price price}} '
268
- +'<div class="nxt-product-buttons">'
269
- +'<input type="button" class="nxt-btn-primary" onclick="top.location.href=\'{{productUrl}}\'" value="More Info">'
270
- +'</div>'
271
- +'</div>'
272
- +'</div>'
273
- +'</div>'
274
- +'</li>'
275
- +'{{/products}}'
276
- +'</ul>'
235
+ ['{{#products}}<li class="list_view"><a href="product.html?pid={{uniqueId}}" id="pdt-{{uniqueId}}" class="result-item" unbxdParam_sku="{{uniqueId}}" unbxdParam_pRank="{{unbxdprank}}" unbxdAttr="product">'
236
+ ,'<div class="result-image-container">'
237
+ ,'<span class="result-image-horizontal-holder">'
238
+ ,'<img src="{{{image_url}}}" alt="{{{title}}}">'
239
+ ,'</span>'
240
+ ,'</div>'
241
+ ,'<div class="result-brand">{{{brand}}}</div>'
242
+ ,'<div class="result-title">{{{title}}}</div>'
243
+ ,'<div class="result-price">'
244
+ ,'${{price}}'
245
+ ,'</div>'
246
+ ,'</a></li>{{/products}}'].join('')
277
247
}
278
248
```
279
249
@@ -295,14 +265,29 @@ In this case, we need to also mention the different view types under 'viewTypes'
295
265
,viewTypeContainerTemp:
296
266
'{{#options}}'
297
267
+'<li class="nxt-{{#if selected}}current{{/if}}">'
298
- +'<a title="{{value}} View" class="nxt-{{value}}view-button" unbxdviewtype="{{value}}">'
268
+ +'<a title="{{value}} View" class="nxt-{{value}}view-button" {{#unless selected}} unbxdviewtype="{{value}}"{{/unless}} >'
299
269
+'<span class="icon-{{value}}view">'
300
270
+'</span>'
301
271
+'</a>'
302
272
+'</li>'
303
273
+'{{/options}}'
304
274
```
305
275
276
+ JSON used for this template:
277
+
278
+ ```
279
+ {
280
+ 0: {
281
+ "selected": true,
282
+ "value": "grid"
283
+ },
284
+ 1: {
285
+ "selected": false,
286
+ "value": "list"
287
+ }
288
+ }
289
+ ```
290
+
306
291
- ** searchResultContainer** : The jQuery selector of DOM element to append the HTML generated from ** searchResultSetTemp** (* #results_container* in the first image).
307
292
- ** isClickNScroll** : Set it to ** true** if you want users to click an element to fetch the next page.
308
293
- ** clickNScrollSelector** : The jQuery selector of the DOM element that can be clicked for displaying the next page.(PS. in this case the new results will be appended to the ** searchResultContainer** .)
0 commit comments