📄 productdetail.ftl
字号:
<#--
* Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*@author Andy Zeneski (jaz@ofbiz.org)
*@version $Revision: 1.28 $
*@since 2.1
-->
<#-- variable setup -->
<#assign uiLabelMap = requestAttributes.uiLabelMap>
<#assign product = requestAttributes.product?if_exists>
<#assign productContentWrapper = requestAttributes.productContentWrapper?if_exists>
<#assign price = requestAttributes.priceMap?if_exists>
<#assign nowTimestamp = Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp()>
<#-- end variable setup -->
<#-- virtual product javascript -->
${requestAttributes.virtualJavaScript?if_exists}
<script language="JavaScript">
<!--
var detailImageUrl = null;
function addItem() {
if (document.addform.add_product_id.value == 'NULL') {
alert("Please enter all the required information.");
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;
eval("list" + OPT[(currentFeatureIndex+1)] + selectedValue + "()");
// set the product ID to NULL to trigger the alerts
document.addform.add_product_id.value = '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
document.addform.add_product_id.value = sku;
// check for amount box
toggleAmt(checkAmtReq(sku));
}
}
//-->
</script>
<table border="0" width="100%" cellpadding="2" cellspacing='0'>
<#-- Category next/previous -->
<#if requestAttributes.category?exists>
<tr>
<td colspan="2" align="right">
<#if requestAttributes.previousProductId?exists>
<a href='<@ofbizUrl>/product/~category_id=${requestAttributes.categoryId?if_exists}/~product_id=${requestAttributes.previousProductId?if_exists}</@ofbizUrl>' class="buttontext">[${uiLabelMap.CommonPrevious}]</a> |
</#if>
<a href="<@ofbizUrl>/category/~category_id=${requestAttributes.categoryId?if_exists}</@ofbizUrl>" class="buttontext">${requestAttributes.category.description?if_exists}</a>
<#if requestAttributes.nextProductId?exists>
| <a href='<@ofbizUrl>/product/~category_id=${requestAttributes.categoryId?if_exists}/~product_id=${requestAttributes.nextProductId?if_exists}</@ofbizUrl>' class="buttontext">[${uiLabelMap.CommonNext}]</a>
</#if>
</td>
</tr>
</#if>
<tr><td colspan="2"><hr class='sepbar'></td></tr>
<#-- Product image/name/price -->
<tr>
<td align="left" 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>${requestAttributes.contentPathPrefix?if_exists}${productLargeImageUrl?if_exists}</@ofbizContentUrl>' name='mainImage' vspace='5' hspace='5' border='0' width='200' align='left'></a>
</#if>
</td>
<td align="right" valign="top">
<div class="head2">${productContentWrapper.get("PRODUCT_NAME")?if_exists}</div>
<div class="tabletext">${productContentWrapper.get("DESCRIPTION")?if_exists}</div>
<div class="tabletext"><b>${product.productId?if_exists}</b></div>
<#-- for prices:
- if price < listPrice, show
- if price < defaultPrice and defaultPrice < listPrice, show default
- if isSale show price with salePrice style and print "On Sale!"
-->
<#if price.listPrice?exists && price.price?exists && price.price?double < price.listPrice?double>
<div class="tabletext">${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?double < price.defaultPrice?double && price.defaultPrice?double < price.listPrice?double>
<div class="tabletext">${uiLabelMap.ProductRegularPrice}: <span class='basePrice'><@ofbizCurrency amount=price.defaultPrice isoCode=price.currencyUsed/></span></div>
</#if>
<div class="tabletext">
<b>
<#if price.isSale>
<span class='salePrice'>${uiLabelMap.EcommerceOnSale}!</span>
<#assign priceStyle = "salePrice">
<#else>
<#assign priceStyle = "regularPrice">
</#if>
${uiLabelMap.EcommerceYourPrice}: <#if "Y" = product.isVirtual?if_exists> from </#if><span class='${priceStyle}'><@ofbizCurrency amount=price.price isoCode=price.currencyUsed/></span>
</b>
</div>
<#-- Included quantities/pieces -->
<#if product.quantityIncluded?exists && product.quantityIncluded?double != 0>
<div class="tabletext">${uiLabelMap.EcommerceIncludes}:
${product.quantityIncluded?if_exists}
${product.quantityUomId?if_exists}
</div>
</#if>
<#if product.piecesIncluded?exists && product.piecesIncluded?long != 0>
<div class="tabletext">${uiLabelMap.EcommercePieces}:
${product.piecesIncluded}
</div>
</#if>
<#if daysToShip?exists>
<div class="tabletext"><b>${uiLabelMap.ProductUsuallyShipsIn} <font color='red'>${daysToShip}</font> ${uiLabelMap.CommonDays}!<b></div>
</#if>
<#-- tell a friend -->
<div class="tabletext"> </div>
<div class="tabletext">
<a href="javascript:popUpSmall('<@ofbizUrl>/tellafriend?productId=${product.productId}</@ofbizUrl>','tellafriend');" class="buttontext">${uiLabelMap.CommonTellAFriend}</a>
</div>
<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?exists && product.isVirtual?upper_case == "Y">
<#if requestAttributes.variantTree?exists && 0 < requestAttributes.variantTree.size()>
<p> </p>
<#list requestAttributes.featureSet as currentType>
<div class="tabletext">
<select name="FT${currentType}" class="selectBox" onchange="javascript:getList(this.name, (this.selectedIndex-1), 1);">
<option>${requestAttributes.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'>
<#else>
<input type='hidden' name="product_id" value='${product.productId}'>
<input type='hidden' name="add_product_id" value='NULL'>
<div class='tabletext'><b>${uiLabelMap.ProductItemOutofStock}.</b></div>
<#assign inStock = false>
</#if>
<#else>
<input type='hidden' name="product_id" value='${product.productId}'>
<input type='hidden' name="add_product_id" value='${product.productId}'>
<#if !Static["org.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryAvailable(request, product.productId?string, 1.0?double)>
<#if Static["org.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryRequired(request, product)>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -