📄 showcart.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 David E. Jones (jonesde@ofbiz.org)
*@author Andy Zeneski (jaz@ofbiz.org)
*@version $Revision: 1.28 $
*@since 2.1
-->
<#assign uiLabelMap = requestAttributes.uiLabelMap>
<script language="JavaScript">
<!--
function toggle(e) {
e.checked = !e.checked;
}
function checkToggle(e) {
var cform = document.cartform;
if (e.checked) {
var len = cform.elements.length;
var allchecked = true;
for (var i = 0; i < len; i++) {
var element = cform.elements[i];
if (element.name == "selectedItem" && !element.checked) {
allchecked = false;
}
cform.selectAll.checked = allchecked;
}
} else {
cform.selectAll.checked = false;
}
}
function toggleAll(e) {
var cform = document.cartform;
var len = cform.elements.length;
for (var i = 0; i < len; i++) {
var element = cform.elements[i];
if (element.name == "selectedItem" && element.checked != e.checked) {
toggle(element);
}
}
}
function removeSelected() {
var cform = document.cartform;
cform.removeSelected.value = true;
cform.submit();
}
function addToList() {
var cform = document.cartform;
cform.action = "<@ofbizUrl>/addBulkToShoppingList</@ofbizUrl>";
cform.submit();
}
//-->
</script>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="boxoutside">
<tr>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="boxtop">
<tr>
<td valign="middle" align="left">
<div class="boxhead"> ${uiLabelMap.CommonQuickAdd}</div>
</td>
<td valign="middle" align="right">
<#if ((sessionAttributes.lastViewedProducts)?has_content && sessionAttributes.lastViewedProducts?size > 1)>
<#assign continueLink = "/product?product_id=" + sessionAttributes.lastViewedProducts.get(0)>
<#else>
<#assign continueLink = "/main">
</#if>
<a href="<@ofbizUrl>${continueLink}</@ofbizUrl>" class="submenutext">${uiLabelMap.EcommerceContinueShopping}</a><#if (shoppingCartSize > 0)><a href="<@ofbizUrl>/checkoutoptions</@ofbizUrl>" class="submenutextright">${uiLabelMap.EcommerceCheckout}</a><#else><span class="submenutextrightdisabled">${uiLabelMap.EcommerceCheckout}</span></#if>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="boxbottom">
<tr>
<td>
<form method="POST" action="<@ofbizUrl>/additem<#if requestAttributes._CURRENT_VIEW_?has_content>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>" name="quickaddform" style="margin: 0;">
<input type="text" class="inputBox" name="add_product_id" value="${requestParameters.add_product_id?if_exists}">
<input type="text" class="inputBox" size="5" name="quantity" value="${requestParameters.quantity?default("1")}">
<input type="submit" class="smallSubmit" value="${uiLabelMap.EcommerceAddtoCart}">
<#-- <a href="javascript:document.quickaddform.submit()" class="buttontext"><nobr>[${uiLabelMap.EcommerceAddtoCart}]</nobr></a> -->
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="JavaScript">
<!--
document.quickaddform.add_product_id.focus();
//-->
</script>
<br/>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="boxoutside">
<tr>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="boxtop">
<tr>
<td valign="middle" align="left">
<div class="boxhead"> ${uiLabelMap.EcommerceShoppingCart}</div>
</td>
<td valign="middle" align="right">
<div class="lightbuttontextdisabled">
<#--<a href="<@ofbizUrl>/main</@ofbizUrl>" class="lightbuttontext">[${uiLabelMap.EcommerceContinueShopping}]</a>-->
<#if (shoppingCartSize > 0)>
<a href="javascript:document.cartform.submit()" class="submenutext">${uiLabelMap.EcommerceRecalculateCart}</a><a href="<@ofbizUrl>/emptycart</@ofbizUrl>" class="submenutext">${uiLabelMap.EcommerceEmptyCart}</a><a href="javascript:removeSelected();" class="submenutextright">${uiLabelMap.EcommerceRemoveSelected}</a>
<#else>
<span class="submenutextdisabled">${uiLabelMap.EcommerceRecalculateCart}</span><span class="submenutextdisabled">${uiLabelMap.EcommerceEmptyCart}</span><span class="submenutextrightdisabled">${uiLabelMap.EcommerceRemoveSelected}</span>
</#if>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="boxbottom">
<tr>
<td>
<#if (shoppingCartSize > 0)>
<form method="POST" action="<@ofbizUrl>/modifycart</@ofbizUrl>" name="cartform" style="margin: 0;">
<input type="hidden" name="removeSelected" value="false">
<table width="100%" cellspacing="0" cellpadding="1" border="0">
<tr>
<td NOWRAP> </td>
<td NOWRAP><div class="tabletext"><b>${uiLabelMap.EcommerceProduct}</b></div></td>
<td NOWRAP> </td>
<td NOWRAP align="center"><div class="tabletext"><b>${uiLabelMap.CommonQuantity}</b></div></td>
<td NOWRAP align="right"><div class="tabletext"><b>${uiLabelMap.EcommerceUnitPrice}</b></div></td>
<td NOWRAP align="right"><div class="tabletext"><b>${uiLabelMap.EcommerceAdjustments}</b></div></td>
<td NOWRAP align="right"><div class="tabletext"><b>${uiLabelMap.EcommerceItemTotal}</b></div></td>
<td NOWRAP align="center"><input type="checkbox" name="selectAll" value="0" onclick="javascript:toggleAll(this);"></td>
</tr>
<#assign itemsFromList = false>
<#assign promoItems = false>
<#list shoppingCart.items() as cartLine>
<#assign cartLineIndex = shoppingCart.getItemIndex(cartLine)>
<#assign lineOptionalFeatures = cartLine.getOptionalProductFeatures()>
<#-- show adjustment info -->
<#list cartLine.getAdjustments() as cartLineAdjustment>
<!-- cart line ${cartLineIndex} adjustment: ${cartLineAdjustment} -->
</#list>
<tr><td> </td><td colspan="6"><hr class="sepbar"></td></tr>
<tr>
<td>
<#if cartLine.getShoppingListId()?exists>
<#assign itemsFromList = true>
<a href="<@ofbizUrl>/editShoppingList?shoppingListId=${cartLine.getShoppingListId()}</@ofbizUrl>" class="buttontext">L</a>
<#elseif cartLine.getIsPromo()>
<#assign promoItems = true>
<a href="<@ofbizUrl>/view/showcart</@ofbizUrl>" class="buttontext">P</a>
<#else>
</#if>
</td>
<td>
<div class="tabletext">
<#if cartLine.getProductId()?exists>
<#-- product item -->
<#-- start code to display a small image of the product -->
<#assign smallImageUrl = Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(cartLine.getProduct(), "SMALL_IMAGE_URL", requestAttributes.locale)?if_exists>
<#if !smallImageUrl?has_content><#assign smallImageUrl = "/images/defaultImage.jpg"></#if>
<#if smallImageUrl?has_content>
<a href="<@ofbizUrl>/product?product_id=${cartLine.getProductId()}</@ofbizUrl>">
<img src="<@ofbizContentUrl>${requestAttributes.contentPathPrefix?if_exists}${smallImageUrl}</@ofbizContentUrl>" align="left" width="50" class="imageborder" border="0"/>
</a>
</#if>
<#-- end code to display a small image of the product -->
<#-- <b>${cartLineIndex}</b> - -->
<a href="<@ofbizUrl>/product?product_id=${cartLine.getProductId()}</@ofbizUrl>" class="buttontext">${cartLine.getProductId()} -
${cartLine.getName()?if_exists}</a> : ${cartLine.getDescription()?if_exists}
<#-- if inventory is not required check to see if it is out of stock and needs to have a message shown about that... -->
<#assign itemProduct = cartLine.getProduct()>
<#assign isStoreInventoryRequired = Static["org.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryRequired(request, itemProduct)>
<#assign isStoreInventoryAvailable = Static["org.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryAvailable(request, cartLine.getProductId(), cartLine.getQuantity())>
<#if !isStoreInventoryRequired && !isStoreInventoryAvailable && itemProduct.inventoryMessage?has_content>
<b>(${itemProduct.inventoryMessage})</b>
</#if>
<#else>
<#-- this is a non-product item -->
<b>${cartLine.getItemTypeDescription()?if_exists}</b> : ${cartLine.getName()?if_exists}
</#if>
</div>
</td>
<#-- gift wrap option -->
<#assign showNoGiftWrapOptions = false>
<td nowrap align="right">
<#assign giftWrapOption = lineOptionalFeatures.GIFT_WRAP?if_exists>
<#assign selectedOption = cartLine.getAdditionalProductFeatureAndAppl("GIFT_WRAP")?if_exists>
<#if giftWrapOption?has_content>
<select class="selectBox" name="option^GIFT_WRAP_${cartLineIndex}" onChange="javascript:document.cartform.submit()">
<option value="">No Gift Wrap</option>
<#list giftWrapOption as option>
<option value="${option.productFeatureId}" <#if ((selectedOption.productFeatureId)?exists && selectedOption.productFeatureId == option.productFeatureId)>SELECTED</#if>>${option.description} : ${option.amount?default(0)?string.currency}</option>
</#list>
</select>
<#elseif showNoGiftWrapOptions>
<select class="selectBox" name="option^GIFT_WRAP_${cartLineIndex}" onChange="javascript:document.cartform.submit()">
<option value="">No Gift Wrap</option>
</select>
<#else>
</#if>
</td>
<#-- end gift wrap option -->
<td nowrap align="center">
<div class="tabletext">
<#if cartLine.getIsPromo() || cartLine.getShoppingListId()?exists>
${cartLine.getQuantity()?string.number}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -