This repository has been archived by the owner on May 9, 2020. It is now read-only.
/
productdetail.ftl
726 lines (682 loc) · 35.9 KB
/
productdetail.ftl
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
<#--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<#-- variable setup -->
<#assign price = priceMap?if_exists/>
<#-- end variable setup -->
<#-- virtual product javascript -->
${virtualJavaScript?if_exists}
<script language="JavaScript" type="text/javascript">
<!--
var detailImageUrl = null;
function setAddProductId(name) {
document.addform.add_product_id.value = name;
if (document.addform.quantity == null) return;
if (name == '' || name == 'NULL' || isVirtual(name) == true) {
document.addform.quantity.disabled = true;
var elem = document.getElementById('product_id_display');
var txt = document.createTextNode('');
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
} else {
document.addform.quantity.disabled = false;
var elem = document.getElementById('product_id_display');
var txt = document.createTextNode(name);
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
}
}
function setVariantPrice(sku) {
if (sku == '' || sku == 'NULL' || isVirtual(sku) == true) {
var elem = document.getElementById('variant_price_display');
var txt = document.createTextNode('');
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
}
else {
var elem = document.getElementById('variant_price_display');
var price = getVariantPrice(sku);
var txt = document.createTextNode(price);
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
}
}
function isVirtual(product) {
var isVirtual = false;
<#if virtualJavaScript?exists>
for (i = 0; i < VIR.length; i++) {
if (VIR[i] == product) {
isVirtual = true;
}
}
</#if>
return isVirtual;
}
function addItem() {
if (document.addform.add_product_id.value == 'NULL') {
alert("Please select all of the required options.");
return;
} else {
if (isVirtual(document.addform.add_product_id.value)) {
document.location = '<@ofbizUrl>product?category_id=${categoryId?if_exists}&product_id=</@ofbizUrl>' + document.addform.add_product_id.value;
return;
} else {
document.addform.submit();
}
}
}
function popupDetail() {
var defaultDetailImage = "${firstDetailImage?default(mainDetailImageUrl?default("_NONE_"))}";
if (defaultDetailImage == null || defaultDetailImage == "null") {
defaultDetailImage = "_NONE_";
}
if (detailImageUrl == null || detailImageUrl == "null") {
detailImageUrl = defaultDetailImage;
}
if (detailImageUrl == "_NONE_") {
alert("No detail image available to display.");
return;
}
popUp("<@ofbizUrl>detailImage?detail=" + detailImageUrl + "</@ofbizUrl>", 'detailImage', '400', '550');
}
function toggleAmt(toggle) {
if (toggle == 'Y') {
changeObjectVisibility("add_amount", "visible");
}
if (toggle == 'N') {
changeObjectVisibility("add_amount", "hidden");
}
}
function findIndex(name) {
for (i = 0; i < OPT.length; i++) {
if (OPT[i] == name) {
return i;
}
}
return -1;
}
function getList(name, index, src) {
currentFeatureIndex = findIndex(name);
if (currentFeatureIndex == 0) {
// set the images for the first selection
if (IMG[index] != null) {
if (document.images['mainImage'] != null) {
document.images['mainImage'].src = IMG[index];
detailImageUrl = DET[index];
}
}
// set the drop down index for swatch selection
document.forms["addform"].elements[name].selectedIndex = (index*1)+1;
}
if (currentFeatureIndex < (OPT.length-1)) {
// eval the next list if there are more
var selectedValue = document.forms["addform"].elements[name].options[(index*1)+1].value;
if (index == -1) {
<#if featureOrderFirst?exists>
var Variable1 = eval("list" + "${featureOrderFirst}" + "()");
</#if>
} else {
var Variable1 = eval("list" + OPT[(currentFeatureIndex+1)] + selectedValue + "()");
}
// set the product ID to NULL to trigger the alerts
setAddProductId('NULL');
// set the variant price to NULL
setVariantPrice('NULL');
} else {
// this is the final selection -- locate the selected index of the last selection
var indexSelected = document.forms["addform"].elements[name].selectedIndex;
// using the selected index locate the sku
var sku = document.forms["addform"].elements[name].options[indexSelected].value;
// set the product ID
setAddProductId(sku);
// set the variant price
setVariantPrice(sku);
// check for amount box
toggleAmt(checkAmtReq(sku));
}
}
function validate(x){
var msg=new Array();
msg[0]="Please use correct date format [yyyy-mm-dd]";
var y=x.split("-");
if(y.length!=3){ alert(msg[0]);return false; }
if((y[2].length>2)||(parseInt(y[2])>31)) { alert(msg[0]); return false; }
if(y[2].length==1){ y[2]="0"+y[2]; }
if((y[1].length>2)||(parseInt(y[1])>12)){ alert(msg[0]); return false; }
if(y[1].length==1){ y[1]="0"+y[1]; }
if(y[0].length>4){ alert(msg[0]); return false; }
if(y[0].length<4) {
if(y[0].length==2) {
y[0]="20"+y[0];
} else {
alert(msg[0]);
return false;
}
}
return (y[0]+"-"+y[1]+"-"+y[2]);
}
function additemSubmit(){
<#if product.productTypeId?if_exists == "ASSET_USAGE">
newdatevalue = validate(document.addform.reservStart.value);
if (newdatevalue == false) {
document.addform.reservStart.focus();
} else {
document.addform.reservStart.value = newdatevalue;
document.addform.submit();
}
<#else>
document.addform.submit();
</#if>
}
function addShoplistSubmit(){
<#if product.productTypeId?if_exists == "ASSET_USAGE">
if (document.addToShoppingList.reservStartStr.value == "") {
document.addToShoppingList.submit();
} else {
newdatevalue = validate(document.addToShoppingList.reservStartStr.value);
if (newdatevalue == false) {
document.addToShoppingList.reservStartStr.focus();
} else {
document.addToShoppingList.reservStartStr.value = newdatevalue;
// document.addToShoppingList.reservStart.value = ;
document.addToShoppingList.reservStartStr.value.slice(0,9)+" 00:00:00.000000000";
document.addToShoppingList.submit();
}
}
<#else>
document.addToShoppingList.submit();
</#if>
}
<#if product.virtualVariantMethodEnum?if_exists == "VV_FEATURETREE" && featureLists?has_content>
function checkRadioButton() {
var block1 = document.getElementById("addCart1");
var block2 = document.getElementById("addCart2");
<#list featureLists as featureList>
<#list featureList as feature>
<#if feature_index == 0>
var myList = document.getElementById("FT${feature.productFeatureTypeId}");
if (myList.options[0].selected == true){
block1.style.display = "none";
block2.style.display = "block";
return;
}
<#break>
</#if>
</#list>
</#list>
block1.style.display = "block";
block2.style.display = "none";
}
</#if>
//-->
</script>
<div id="productdetail">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<#-- Category next/previous -->
<#if category?exists>
<tr>
<td colspan="2" align="right">
<#if previousProductId?exists>
<a href="<@ofbizUrl>product/~category_id=${categoryId?if_exists}/~product_id=${previousProductId?if_exists}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
</#if>
<a href="<@ofbizUrl>category/~category_id=${categoryId?if_exists}</@ofbizUrl>" class="linktext">${(category.categoryName)?default(category.description)?if_exists}</a>
<#if nextProductId?exists>
| <a href="<@ofbizUrl>product/~category_id=${categoryId?if_exists}/~product_id=${nextProductId?if_exists}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
</#if>
</td>
</tr>
</#if>
<tr><td colspan="2"><hr/></td></tr>
<#-- Product image/name/price -->
<tr>
<td valign="top" width="0">
<#assign productLargeImageUrl = productContentWrapper.get("LARGE_IMAGE_URL")?if_exists>
<#-- remove the next two lines to always display the virtual image first (virtual images must exist) -->
<#if firstLargeImage?has_content>
<#assign productLargeImageUrl = firstLargeImage>
</#if>
<#if productLargeImageUrl?has_content>
<a href="javascript:popupDetail();"><img src="<@ofbizContentUrl>${contentPathPrefix?if_exists}${productLargeImageUrl?if_exists}</@ofbizContentUrl>" name="mainImage" vspace="5" hspace="5" border="0" width="200"></a>
</#if>
</td>
<td align="right" valign="top">
<h2>${productContentWrapper.get("PRODUCT_NAME")?if_exists}</h2>
<div>${productContentWrapper.get("DESCRIPTION")?if_exists}</div>
<div><b>${product.productId?if_exists}</b></div>
<#-- example of showing a certain type of feature with the product -->
<#if sizeProductFeatureAndAppls?has_content>
<div>
<#if (sizeProductFeatureAndAppls?size == 1)>
Size:
<#else>
Sizes Available:
</#if>
<#list sizeProductFeatureAndAppls as sizeProductFeatureAndAppl>
${sizeProductFeatureAndAppl.description?default(sizeProductFeatureAndAppl.abbrev?default(sizeProductFeatureAndAppl.productFeatureId))}<#if sizeProductFeatureAndAppl_has_next>,</#if>
</#list>
</div>
</#if>
<#-- for prices:
- if price < competitivePrice, show competitive or "Compare At" price
- if price < listPrice, show list price
- if price < defaultPrice and defaultPrice < listPrice, show default
- if isSale show price with salePrice style and print "On Sale!"
-->
<#if price.competitivePrice?exists && price.price?exists && price.price < price.competitivePrice>
<div>${uiLabelMap.ProductCompareAtPrice}: <span class="basePrice"><@ofbizCurrency amount=price.competitivePrice isoCode=price.currencyUsed/></span></div>
</#if>
<#if price.listPrice?exists && price.price?exists && price.price < price.listPrice>
<div>${uiLabelMap.ProductListPrice}: <span class="basePrice"><@ofbizCurrency amount=price.listPrice isoCode=price.currencyUsed/></span></div>
</#if>
<#if price.listPrice?exists && price.defaultPrice?exists && price.price?exists && price.price < price.defaultPrice && price.defaultPrice < price.listPrice>
<div>${uiLabelMap.ProductRegularPrice}: <span class="basePrice"><@ofbizCurrency amount=price.defaultPrice isoCode=price.currencyUsed/></span></div>
</#if>
<#if price.specialPromoPrice?exists>
<div>${uiLabelMap.ProductSpecialPromoPrice}: <span class="basePrice"><@ofbizCurrency amount=price.specialPromoPrice isoCode=price.currencyUsed/></span></div>
</#if>
<div>
<b>
<#if price.isSale?exists && price.isSale>
<span class="salePrice">${uiLabelMap.OrderOnSale}!</span>
<#assign priceStyle = "salePrice">
<#else>
<#assign priceStyle = "regularPrice">
</#if>
${uiLabelMap.OrderYourPrice}: <#if "Y" = product.isVirtual?if_exists> ${uiLabelMap.CommonFrom} </#if><span class="${priceStyle}"><@ofbizCurrency amount=price.price isoCode=price.currencyUsed/></span>
<#if product.productTypeId?if_exists == "ASSET_USAGE">
<#if product.reserv2ndPPPerc?exists && product.reserv2ndPPPerc != 0><br/><span class="${priceStyle}">${uiLabelMap.ProductReserv2ndPPPerc}<#if !product.reservNthPPPerc?exists || product.reservNthPPPerc == 0>${uiLabelMap.CommonUntil} ${product.reservMaxPersons}</#if> <@ofbizCurrency amount=product.reserv2ndPPPerc*price.price/100 isoCode=price.currencyUsed/></span></#if>
<#if product.reservNthPPPerc?exists &&product.reservNthPPPerc != 0><br/><span class="${priceStyle}">${uiLabelMap.ProductReservNthPPPerc} <#if !product.reserv2ndPPPerc?exists || product.reserv2ndPPPerc == 0>${uiLabelMap.ProductReservSecond} <#else> ${uiLabelMap.ProductReservThird} </#if> ${uiLabelMap.CommonUntil} ${product.reservMaxPersons}, ${uiLabelMap.ProductEach}: <@ofbizCurrency amount=product.reservNthPPPerc*price.price/100 isoCode=price.currencyUsed/></span></#if>
<#if (!product.reserv2ndPPPerc?exists || product.reserv2ndPPPerc == 0) && (!product.reservNthPPPerc?exists || product.reservNthPPPerc == 0)><br/>${uiLabelMap.ProductMaximum} ${product.reservMaxPersons} ${uiLabelMap.ProductPersons}.</#if>
</#if>
</b>
</div>
<#if price.listPrice?exists && price.price?exists && price.price < price.listPrice>
<#assign priceSaved = price.listPrice - price.price>
<#assign percentSaved = (priceSaved / price.listPrice) * 100>
<div>${uiLabelMap.OrderSave}: <span class="basePrice"><@ofbizCurrency amount=priceSaved isoCode=price.currencyUsed/> (${percentSaved?int}%)</span></div>
</#if>
<#-- show price details ("showPriceDetails" field can be set in the screen definition) -->
<#if (showPriceDetails?exists && showPriceDetails?default("N") == "Y")>
<#if price.orderItemPriceInfos?exists>
<#list price.orderItemPriceInfos as orderItemPriceInfo>
<div>${orderItemPriceInfo.description?if_exists}</div>
</#list>
</#if>
</#if>
<#-- Included quantities/pieces -->
<#if product.piecesIncluded?exists && product.piecesIncluded?long != 0>
<div>
${uiLabelMap.OrderPieces}: ${product.piecesIncluded}
</div>
</#if>
<#if (product.quantityIncluded?exists && product.quantityIncluded != 0) || product.quantityUomId?has_content>
<#assign quantityUom = product.getRelatedOneCache("QuantityUom")?if_exists/>
<div>
${uiLabelMap.CommonQuantity}: ${product.quantityIncluded?if_exists} ${((quantityUom.abbreviation)?default(product.quantityUomId))?if_exists}
</div>
</#if>
<#if (product.weight?exists && product.weight != 0) || product.weightUomId?has_content>
<#assign weightUom = product.getRelatedOneCache("WeightUom")?if_exists/>
<div>
${uiLabelMap.CommonWeight}: ${product.weight?if_exists} ${((weightUom.abbreviation)?default(product.weightUomId))?if_exists}
</div>
</#if>
<#if (product.productHeight?exists && product.productHeight != 0) || product.heightUomId?has_content>
<#assign heightUom = product.getRelatedOneCache("HeightUom")?if_exists/>
<div>
${uiLabelMap.CommonHeight}: ${product.productHeight?if_exists} ${((heightUom.abbreviation)?default(product.heightUomId))?if_exists}
</div>
</#if>
<#if (product.productWidth?exists && product.productWidth != 0) || product.widthUomId?has_content>
<#assign widthUom = product.getRelatedOneCache("WidthUom")?if_exists/>
<div>
${uiLabelMap.CommonWidth}: ${product.productWidth?if_exists} ${((widthUom.abbreviation)?default(product.widthUomId))?if_exists}
</div>
</#if>
<#if (product.productDepth?exists && product.productDepth != 0) || product.depthUomId?has_content>
<#assign depthUom = product.getRelatedOneCache("DepthUom")?if_exists/>
<div>
${uiLabelMap.CommonDepth}: ${product.productDepth?if_exists} ${((depthUom.abbreviation)?default(product.depthUomId))?if_exists}
</div>
</#if>
<#if daysToShip?exists>
<div><b>${uiLabelMap.ProductUsuallyShipsIn} <font color="red">${daysToShip}</font> ${uiLabelMap.CommonDays}!<b></div>
</#if>
<#-- show tell a friend details only in ecommerce application -->
<div> </div>
<div>
<a href="javascript:popUpSmall('<@ofbizUrl>tellafriend?productId=${product.productId}</@ofbizUrl>','tellafriend');" class="buttontext">${uiLabelMap.CommonTellAFriend}</a>
</div>
<br/>
<#if disFeatureList?exists && 0 < disFeatureList.size()>
<p> </p>
<#list disFeatureList as currentFeature>
<#assign disFeatureType = currentFeature.getRelatedOneCache("ProductFeatureType")/>
<div>
<#if disFeatureType.description?exists>${disFeatureType.get("description", locale)}<#else>${currentFeature.productFeatureTypeId}</#if>: ${currentFeature.description}
</div>
</#list>
<div> </div>
</#if>
<form method="post" action="<@ofbizUrl>additem<#if requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>" name="addform" style="margin: 0;">
<#assign inStock = true>
<#-- Variant Selection -->
<#if product.isVirtual?if_exists?upper_case == "Y">
<#if product.virtualVariantMethodEnum?if_exists == "VV_FEATURETREE" && featureLists?has_content>
<#list featureLists as featureList>
<#list featureList as feature>
<#if feature_index == 0>
<div>${feature.description}: <select id="FT${feature.productFeatureTypeId}" name="FT${feature.productFeatureTypeId}" onChange="javascript:checkRadioButton();">
<option value="select" selected="selected"> select option </option>
<#else>
<option value="${feature.productFeatureId}">${feature.description} <#if feature.price?exists>(+ <@ofbizCurrency amount=feature.price?string isoCode=feature.currencyUomId/>)</#if></option>
</#if>
</#list>
</select>
</div>
</#list>
<input type="hidden" name="product_id" value="${product.productId}"/>
<input type="hidden" name="add_product_id" value="${product.productId}"/>
<div id="addCart1" style="display:none;>
<span style="white-space: nowrap;"><b>${uiLabelMap.CommonQuantity}:</b></span>
<input type="text" size="5" name="quantity" value="1"/>
<a href="javascript:javascript:addItem();" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddToCart}</span></a>
</div>
<div id="addCart2" style="display:block;>
<span style="white-space: nowrap;"><b>${uiLabelMap.CommonQuantity}:</b></span>
<input type="text" size="5" value="1" disabled="disabled"/>
<a href="javascript:alert('Please select all features first');" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddToCart}</span></a>
</div>
</#if>
<#if !product.virtualVariantMethodEnum?exists || product.virtualVariantMethodEnum == "VV_VARIANTTREE">
<#if variantTree?exists && (variantTree.size() > 0)>
<#list featureSet as currentType>
<div>
<select name="FT${currentType}" onchange="javascript:getList(this.name, (this.selectedIndex-1), 1);">
<option>${featureTypes.get(currentType)}</option>
</select>
</div>
</#list>
<input type="hidden" name="product_id" value="${product.productId}"/>
<input type="hidden" name="add_product_id" value="NULL"/>
<div>
<b><span id="product_id_display"> </span></b>
<b><div id="variant_price_display"> </div></b>
</div>
<#else>
<input type="hidden" name="product_id" value="${product.productId}"/>
<input type="hidden" name="add_product_id" value="NULL"/>
<div><b>${uiLabelMap.ProductItemOutofStock}.</b></div>
<#assign inStock = false>
</#if>
</#if>
<#else>
<input type="hidden" name="product_id" value="${product.productId}"/>
<input type="hidden" name="add_product_id" value="${product.productId}"/>
<#assign isStoreInventoryNotAvailable = !(Static["org.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryAvailable(request, product, 1.0))>
<#assign isStoreInventoryRequired = Static["org.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryRequired(request, product)>
<#if isStoreInventoryNotAvailable>
<#if isStoreInventoryRequired>
<div><b>${uiLabelMap.ProductItemOutofStock}.</b></div>
<#assign inStock = false>
<#else>
<div><b>${product.inventoryMessage?if_exists}</b></div>
</#if>
</#if>
</#if>
</td></tr><tr><td colspan="2" align="right">
<#-- check to see if introductionDate hasnt passed yet -->
<#if product.introductionDate?exists && nowTimestamp.before(product.introductionDate)>
<p> </p>
<div style="color: red;">${uiLabelMap.ProductProductNotYetMadeAvailable}.</div>
<#-- check to see if salesDiscontinuationDate has passed -->
<#elseif product.salesDiscontinuationDate?exists && nowTimestamp.after(product.salesDiscontinuationDate)>
<div style="color: red;">${uiLabelMap.ProductProductNoLongerAvailable}.</div>
<#-- check to see if the product requires inventory check and has inventory -->
<#elseif product.virtualVariantMethodEnum?if_exists != "VV_FEATURETREE">
<#if inStock>
<#if product.requireAmount?default("N") == "Y">
<#assign hiddenStyle = "visible">
<#else>
<#assign hiddenStyle = "hidden">
</#if>
<div id="add_amount" class="${hiddenStyle}">
<span style="white-space: nowrap;"><b>${uiLabelMap.CommonAmount}:</b></span>
<input type="text" size="5" name="add_amount" value=""/>
</div>
<#if product.productTypeId?if_exists == "ASSET_USAGE">
<table width="100%"><tr>
<td nowrap align="right">Start Date<br/>(yyyy-mm-dd)</td><td><input type="text" size="10" name="reservStart"/><a href="javascript:call_cal_notime(document.addform.reservStart, '${Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().toString().substring(0,10)}');"><img src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" height="16" border="0" alt="Calendar"/></a></td>
<td nowrap align="right">End Date<br/>(yyyy-mm-dd)</td><td><input type="text" size="10" name="reservEnd"/><a href="javascript:call_cal_notime(document.addform.reservEnd, '${Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().toString().substring(0,10)}');"><img src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" height="16" border="0" alt="Calendar"/></a></td></tr>
<tr>
<#--td nowrap align="right">Number<br/>of days</td><td><input type="textt" size="4" name="reservLength"/></td></tr><tr><td> </td><td align="right" nowrap> </td-->
<td nowrap align="right">Number of persons</td><td><input type="text" size="4" name="reservPersons" value="2"/></td>
<td nowrap align="right">Number of rooms</td><td><input type="text" size="5" name="quantity" value="1"/></td></tr></table>
<#else/>
<input type="text" size="5" name="quantity" value="1"<#if product.isVirtual?if_exists?upper_case == "Y"> disabled="disabled"</#if>/>
</#if>
<#-- This calls addItem() so that variants of virtual products cant be added before distinguishing features are selected, it should not be changed to additemSubmit() -->
<a href="javascript:addItem()" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddToCart}</span></a>
</#if>
<#if requestParameters.category_id?exists>
<input type="hidden" name="category_id" value="${requestParameters.category_id}"/>
</#if>
</#if>
</form>
<div>
<#if sessionAttributes.userLogin?has_content && sessionAttributes.userLogin.userLoginId != "anonymous">
<hr/>
<form name="addToShoppingList" method="post" action="<@ofbizUrl>addItemToShoppingList<#if requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>">
<input type="hidden" name="productId" value="${product.productId}"/>
<input type="hidden" name="product_id" value="${product.productId}"/>
<input type="hidden" name="productStoreId" value="${productStoreId}"/>
<input type="hidden" name="reservStart" value= ""/>
<select name="shoppingListId">
<#if shoppingLists?has_content>
<#list shoppingLists as shoppingList>
<option value="${shoppingList.shoppingListId}">${shoppingList.listName}</option>
</#list>
</#if>
<option value="">---</option>
<option value="">${uiLabelMap.OrderNewShoppingList}</option>
</select>
<#if product.productTypeId?if_exists == "ASSET_USAGE">
<table><tr><td> </td><td align="right">${uiLabelMap.CommonStartDate} (yyyy-mm-dd)</td><td><input type="text" size="10" name="reservStartStr" ></td><td>Number of days</td><td><input type="text" size="4" name="reservLength"></td><td> </td><td align="right">Number of persons</td><td><input type="text" size="4" name="reservPersons" value="1"></td><td align="right">Qty </td><td><input type="text" size="5" name="quantity" value="1"></td></tr></table>
<#else>
<input type="text" size="5" name="quantity" value="1"/>
<input type="hidden" name="reservStartStr" value= ""/>
</#if>
<a href="javascript:addShoplistSubmit();" class="buttontext">${uiLabelMap.OrderAddToShoppingList}</a>
</form>
<#else> <br/>
${uiLabelMap.OrderYouMust} <a href="<@ofbizUrl>checkLogin/showcart</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonBeLogged}</a>
${uiLabelMap.OrderToAddSelectedItemsToShoppingList}.
</#if>
</div>
<#-- Prefill first select box (virtual products only) -->
<#if variantTree?exists && 0 < variantTree.size()>
<script language="JavaScript" type="text/javascript">eval("list" + "${featureOrderFirst}" + "()");</script>
</#if>
<#-- Swatches (virtual products only) -->
<#if variantSample?exists && 0 < variantSample.size()>
<#assign imageKeys = variantSample.keySet()>
<#assign imageMap = variantSample>
<p> </p>
<table cellspacing="0" cellpadding="0">
<tr>
<#assign maxIndex = 7>
<#assign indexer = 0>
<#list imageKeys as key>
<#assign swatchProduct = imageMap.get(key)>
<#if swatchProduct?has_content && indexer < maxIndex>
<#assign imageUrl = Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(swatchProduct, "SMALL_IMAGE_URL", request)?if_exists>
<#if !imageUrl?has_content>
<#assign imageUrl = productContentWrapper.get("SMALL_IMAGE_URL")?if_exists>
</#if>
<#if !imageUrl?has_content>
<#assign imageUrl = "/images/defaultImage.jpg">
</#if>
<td align="center" valign="bottom">
<a href="javascript:getList('FT${featureOrderFirst}','${indexer}',1);"><img src="<@ofbizContentUrl>${contentPathPrefix?if_exists}${imageUrl}</@ofbizContentUrl>" border="0" width="60" height="60"></a>
<br/>
<a href="javascript:getList('FT${featureOrderFirst}','${indexer}',1);" class="linktext">${key}</a>
</td>
</#if>
<#assign indexer = indexer + 1>
</#list>
<#if (indexer > maxIndex)>
<div><b>${uiLabelMap.ProductMoreOptions}</b></div>
</#if>
</tr>
</table>
</#if>
</td>
</tr>
</table>
<#-- Digital Download Files Associated with this Product -->
<#if downloadProductContentAndInfoList?has_content>
<div id="download-files">
<div>${uiLabelMap.OrderDownloadFilesTitle}:</div>
<#list downloadProductContentAndInfoList as downloadProductContentAndInfo>
<div>${downloadProductContentAndInfo.contentName}<#if downloadProductContentAndInfo.description?has_content> - ${downloadProductContentAndInfo.description}</#if></div>
</#list>
</div>
</#if>
<#-- Long description of product -->
<div id="long-description">
<div>${productContentWrapper.get("LONG_DESCRIPTION")?if_exists}</div>
<div>${productContentWrapper.get("WARNINGS")?if_exists}</div>
</div>
<#-- Any attributes/etc may go here -->
<#-- Product Reviews -->
<div id="reviews">
<div>${uiLabelMap.OrderCustomerReviews}:</div>
<#if averageRating?exists && (averageRating > 0) && numRatings?exists && (numRatings > 1)>
<div>${uiLabelMap.OrderAverageRating}: ${averageRating} <#if numRatings?exists>(${uiLabelMap.CommonFrom} ${numRatings} ${uiLabelMap.OrderRatings})</#if></div>
</#if>
<tr><td colspan="2"><hr/></td></tr>
<#if productReviews?has_content>
<#list productReviews as productReview>
<#assign postedUserLogin = productReview.getRelatedOne("UserLogin")>
<#assign postedPerson = postedUserLogin.getRelatedOne("Person")?if_exists>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div><b>${uiLabelMap.CommonBy}: </b><#if productReview.postedAnonymous?default("N") == "Y"> ${uiLabelMap.OrderAnonymous}<#else> ${postedPerson.firstName} ${postedPerson.lastName} </#if></div>
</td>
<td>
<div><b>${uiLabelMap.CommonAt}: </b>${productReview.postedDateTime?if_exists} </div>
</td>
<td>
<div><b>${uiLabelMap.OrderRanking}: </b>${productReview.productRating?if_exists?string}</div>
</td>
</tr>
<tr>
<td colspan="3">
<div> </div>
</td>
</tr>
<tr>
<td colspan="3">
<div>${productReview.productReview?if_exists}</div>
</td>
</tr>
<tr><td colspan="3"><hr/></td></tr>
</table>
</#list>
<div>
<a href="<@ofbizUrl>reviewProduct?category_id=${categoryId?if_exists}&product_id=${product.productId}</@ofbizUrl>" class="linktext">${uiLabelMap.ProductReviewThisProduct}!</a>
</div>
<#else>
<div>${uiLabelMap.ProductProductNotReviewedYet}.</div>
<div>
<a href="<@ofbizUrl>reviewProduct?category_id=${categoryId?if_exists}&product_id=${product.productId}</@ofbizUrl>" class="linktext">${uiLabelMap.ProductBeTheFirstToReviewThisProduct}</a>
</div>
</div>
</#if>
<#-- Upgrades/Up-Sell/Cross-Sell -->
<#macro associated assocProducts beforeName showName afterName formNamePrefix targetRequestName>
<#assign targetRequest = "product">
<#if targetRequestName?has_content>
<#assign targetRequest = targetRequestName>
</#if>
<#if assocProducts?has_content>
<h2>${beforeName?if_exists}<#if showName == "Y">${productContentWrapper.get("PRODUCT_NAME")?if_exists}</#if>${afterName?if_exists}</h2>
<div class="productsummary-container">
<#list assocProducts as productAssoc>
<div>
<a href="<@ofbizUrl>${targetRequest}/<#if categoryId?exists>~category_id=${categoryId}/</#if>~product_id=${productAssoc.productIdTo?if_exists}</@ofbizUrl>" class="buttontext">
${productAssoc.productIdTo?if_exists}
</a>
- <b>${productAssoc.reason?if_exists}</b>
</div>
${setRequestAttribute("optProductId", productAssoc.productIdTo)}
${setRequestAttribute("listIndex", listIndex)}
${setRequestAttribute("formNamePrefix", formNamePrefix)}
<#if targetRequestName?has_content>
${setRequestAttribute("targetRequestName", targetRequestName)}
</#if>
${screens.render(productsummaryScreen)}
<#local listIndex = listIndex + 1>
</#list>
</div>
${setRequestAttribute("optProductId", "")}
${setRequestAttribute("formNamePrefix", "")}
${setRequestAttribute("targetRequestName", "")}
</#if>
</#macro>
<#assign productValue = product>
<#assign listIndex = 1>
${setRequestAttribute("productValue", productValue)}
<div id="associated-products">
<#-- obsolete -->
<@associated assocProducts=obsoleteProducts beforeName="" showName="Y" afterName=" ${uiLabelMap.ProductObsolete}" formNamePrefix="obs" targetRequestName=""/>
<#-- cross sell -->
<@associated assocProducts=crossSellProducts beforeName="" showName="N" afterName="${uiLabelMap.ProductCrossSell}" formNamePrefix="cssl" targetRequestName="crosssell"/>
<#-- up sell -->
<@associated assocProducts=upSellProducts beforeName="${uiLabelMap.ProductUpSell} " showName="Y" afterName=":" formNamePrefix="upsl" targetRequestName="upsell"/>
<#-- obsolescence -->
<@associated assocProducts=obsolenscenseProducts beforeName="" showName="Y" afterName=" ${uiLabelMap.ProductObsolescense}" formNamePrefix="obce" targetRequestName=""/>
</div>
<#-- special cross/up-sell area using commonFeatureResultIds (from common feature product search) -->
<#if commonFeatureResultIds?has_content>
<h2>${uiLabelMap.ProductSimilarProducts}</h2>
<div class="productsummary-container">
<#list commonFeatureResultIds as commonFeatureResultId>
${setRequestAttribute("optProductId", commonFeatureResultId)}
${setRequestAttribute("listIndex", commonFeatureResultId_index)}
${setRequestAttribute("formNamePrefix", "cfeatcssl")}
<#-- ${setRequestAttribute("targetRequestName", targetRequestName)} -->
${screens.render(productsummaryScreen)}
</#list>
</div>
</#if>
</div>