--- Begin Message ---
Author: jleroux
Date: Sat Jan 13 11:04:01 2007
New Revision: 495945
URL: http://svn.apache.org/viewvc?view=rev&rev=495945
Log:
A refactored patch from Fred Forester "Virtual products sharing variants can
cause inconsistest shopping cart"
(http://issues.apache.org/jira/browse/OFBIZ-516)
Modified:
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl
(original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl Sat
Jan 13 11:04:01 2007
@@ -208,16 +208,21 @@
<#if cartLine.getProductId()?exists>
<#-- product item -->
<#-- start code to display a small image of the product -->
+ <#if cartLine.getParentProductId()?exists>
+ <#assign parentProductId =
cartLine.getParentProductId()/>
+ <#else>
+ <#assign parentProductId = cartLine.getProductId()/>
+ </#if>
<#assign smallImageUrl =
Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(cartLine.getProduct(),
"SMALL_IMAGE_URL", 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>">
+ <a
href="<@ofbizUrl>product?product_id=${parentProductId}</@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="linktext">${cartLine.getProductId()} -
+ <a
href="<@ofbizUrl>product?product_id=${parentProductId}</@ofbizUrl>"
class="linktext">${cartLine.getProductId()} -
${cartLine.getName()?if_exists}</a> :
${cartLine.getDescription()?if_exists}
<#-- For configurable products, the selected options are
shown -->
<#if cartLine.getConfigWrapper()?exists>
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
(original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Sat Jan 13 11:04:01 2007
@@ -2904,7 +2904,7 @@
// add in the new product
try {
- ShoppingCartItem item = ShoppingCartItem.makeItem(null, productId,
null, quantity.doubleValue(), null, null, null, null, null, null, null, null,
prodCatalogId, null, null, null, dispatcher, cart, null, null);
+ ShoppingCartItem item = ShoppingCartItem.makeItem(null, productId,
null, quantity.doubleValue(), null, null, null, null, null, null, null, null,
prodCatalogId, null, null, null, dispatcher, cart, null, null, null);
if (basePrice != null&&overridePrice!=null) {
item.setBasePrice(basePrice.doubleValue());
// special hack to make sure we re-calc the promos after a
price change
@@ -3413,7 +3413,7 @@
Locale locale = (Locale) context.get("locale");
ShoppingCart cart = new ShoppingCart(dctx.getDelegator(), "9000",
"webStore", locale, "USD");
try {
- cart.addOrIncreaseItem("GZ-1005", null, 1, null, null, null, null,
null, null, null, "DemoCatalog", null, null, null, dctx.getDispatcher());
+ cart.addOrIncreaseItem("GZ-1005", null, 1, null, null, null, null,
null, null, null, "DemoCatalog", null, null, null, dctx.getDispatcher(),null);
} catch (CartItemModifyException e) {
Debug.logError(e, module);
} catch (ItemNotFoundException e) {
@@ -3651,7 +3651,7 @@
item.getTimestamp("shipAfterDate"),
null,
null, null,
null,
null, null,
-
dispatcher);
+
dispatcher, null);
ShoppingCartItem sci =
cart.findCartItem(itemIndex);
sci.setAssociatedOrderId(orderId);
sci.setAssociatedOrderItemSeqId(item.getString("orderItemSeqId"));
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
Sat Jan 13 11:04:01 2007
@@ -442,7 +442,7 @@
*/
public int addOrIncreaseItem(String productId, Double selectedAmountDbl,
double quantity, Timestamp reservStart, Double reservLengthDbl, Double
reservPersonsDbl,
Timestamp shipBeforeDate, Timestamp shipAfterDate, Map features,
Map attributes, String prodCatalogId,
- ProductConfigWrapper configWrapper, String itemType, String
itemGroupNumber, LocalDispatcher dispatcher) throws CartItemModifyException,
ItemNotFoundException {
+ ProductConfigWrapper configWrapper, String itemType, String
itemGroupNumber, LocalDispatcher dispatcher, String parentProductId) throws
CartItemModifyException, ItemNotFoundException {
if (isReadOnlyCart()) {
throw new CartItemModifyException("Cart items cannot be changed");
}
@@ -488,7 +488,8 @@
} else {
return this.addItem(0, ShoppingCartItem.makeItem(new Integer(0),
productId, selectedAmountDbl, quantity, null,
reservStart, reservLengthDbl, reservPersonsDbl,
shipBeforeDate, shipAfterDate,
- features, attributes, prodCatalogId, configWrapper,
itemType, itemGroup, dispatcher, this, Boolean.TRUE, Boolean.TRUE));
+ features, attributes, prodCatalogId, configWrapper,
itemType, itemGroup, dispatcher,
+ this, Boolean.TRUE, Boolean.TRUE, parentProductId));
}
}
@@ -517,7 +518,7 @@
/** Add an item to the shopping cart. */
public int addItemToEnd(String productId, Double amount, double quantity,
Double unitPrice, HashMap features, HashMap attributes, String prodCatalogId,
String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps,
Boolean triggerPriceRules) throws CartItemModifyException,
ItemNotFoundException {
- return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount,
quantity, unitPrice, null, null, null, null, null, features, attributes,
prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps,
triggerPriceRules));
+ return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount,
quantity, unitPrice, null, null, null, null, null, features, attributes,
prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps,
triggerPriceRules, null));
}
/** Add an item to the shopping cart. */
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
Sat Jan 13 11:04:01 2007
@@ -109,6 +109,7 @@
String controlDirective = null;
Map result = null;
String productId = null;
+ String parentProductId = null;
String itemType = null;
String itemDescription = null;
String productCategoryId = null;
@@ -148,6 +149,14 @@
} else if (paramMap.containsKey("add_product_id")) {
productId = (String) paramMap.remove("add_product_id");
}
+ if (paramMap.containsKey("PRODUCT_ID")) {
+ parentProductId = (String) paramMap.remove("PRODUCT_ID");
+ } else if (paramMap.containsKey("product_id")) {
+ parentProductId = (String) paramMap.remove("product_id");
+ }
+
+ Debug.logInfo("adding item product " + productId,module);
+ Debug.logInfo("adding item parent product " + parentProductId,module);
if (paramMap.containsKey("ADD_CATEGORY_ID")) {
productCategoryId = (String) paramMap.remove("ADD_CATEGORY_ID");
@@ -357,7 +366,7 @@
List surveyResponses = null;
if (productId != null) {
String productStoreId =
ProductStoreWorker.getProductStoreId(request);
- List productSurvey =
ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId,
"CART_ADD");
+ List productSurvey =
ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId,
"CART_ADD", parentProductId);
if (productSurvey != null && productSurvey.size() > 0) {
// TODO: implement multiple survey per product
GenericValue survey = EntityUtil.getFirst(productSurvey);
@@ -390,7 +399,7 @@
// Translate the parameters and add to the cart
result = cartHelper.addToCart(catalogId, shoppingListId,
shoppingListItemSeqId, productId, productCategoryId,
itemType, itemDescription, price, amount, quantity,
reservStart, reservLength, reservPersons,
- shipBeforeDate, shipAfterDate, configWrapper, itemGroupNumber,
paramMap);
+ shipBeforeDate, shipAfterDate, configWrapper, itemGroupNumber,
paramMap, parentProductId);
controlDirective = processResult(result, request);
// Determine where to send the browser
@@ -1401,8 +1410,10 @@
if (quantity > 0) {
Debug.logInfo("Attempting to add to cart with productId =
" + productId + ", categoryId = " + productCategoryId +
", quantity = " + quantity + ", itemType = " +
itemType + " and itemDescription = " + itemDescription, module);
- result = cartHelper.addToCart(catalogId, shoppingListId,
shoppingListItemSeqId, productId, productCategoryId,
- itemType, itemDescription,
null, amount, quantity, null, null, null, null, null, null, itemGroupNumber,
itemAttributes);
+ result = cartHelper.addToCart(catalogId, shoppingListId,
shoppingListItemSeqId, productId,
+ productCategoryId, itemType,
itemDescription, null,
+ amount, quantity, null,
null, null, null, null, null,
+ itemGroupNumber,
itemAttributes,null);
// no values for price and paramMap (a context for adding
attributes)
controlDirective = processResult(result, request);
if (controlDirective.equals(ERROR)){ // if the add to
cart failed, then get out of this loop right away
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
Sat Jan 13 11:04:01 2007
@@ -87,9 +87,11 @@
Double price, Double amount, double quantity,
java.sql.Timestamp reservStart, Double reservLength, Double
reservPersons,
java.sql.Timestamp shipBeforeDate, java.sql.Timestamp
shipAfterDate,
- ProductConfigWrapper configWrapper, String itemGroupNumber, Map
context) {
+ ProductConfigWrapper configWrapper, String itemGroupNumber, Map
context, String parentProductId) {
Map result = null;
Map attributes = null;
+ String pProductId = null;
+ pProductId = parentProductId;
// price sanity check
if (productId == null && price != null && price.doubleValue() < 0) {
String errMsg = UtilProperties.getMessage(resource,
"cart.price_not_positive_number", this.cart.getLocale());
@@ -163,14 +165,20 @@
if (product == null || product.get("requireAmount") == null ||
"N".equals(product.getString("requireAmount"))) {
amount = null;
}
+ Debug.logInfo("carthelper productid " + productId,module);
+ Debug.logInfo("parent productid " + pProductId,module);
+ //if (product != null &&
!"Y".equals(product.getString("isVariant")))
+ // pProductId = null;
+
}
// add or increase the item to the cart
try {
int itemId = -1;
if (productId != null) {
- itemId = cart.addOrIncreaseItem(productId, amount, quantity,
reservStart, reservLength, reservPersons, shipBeforeDate, shipAfterDate,
- null, attributes, catalogId, configWrapper, itemType,
itemGroupNumber, dispatcher);
+ itemId = cart.addOrIncreaseItem(productId, amount, quantity,
reservStart, reservLength,
+ reservPersons, shipBeforeDate,
shipAfterDate, null, attributes,
+ catalogId, configWrapper,
itemType, itemGroupNumber, dispatcher, pProductId);
} else {
itemId = cart.addNonProductItem(itemType, itemDescription,
productCategoryId, price, quantity, attributes, catalogId, itemGroupNumber,
dispatcher);
}
@@ -235,7 +243,7 @@
Double amount = orderItem.getDouble("selectedAmount");
try {
this.cart.addOrIncreaseItem(orderItem.getString("productId"), amount,
orderItem.getDouble("quantity").doubleValue(),
- null, null, null, null, null, null, null,
catalogId, null, orderItemTypeId, itemGroupNumber, dispatcher);
+ null, null, null, null, null, null, null,
catalogId, null, orderItemTypeId, itemGroupNumber, dispatcher,null);
noItems = false;
} catch (CartItemModifyException e) {
errorMsgs.add(e.getMessage());
@@ -273,7 +281,7 @@
try {
this.cart.addOrIncreaseItem(orderItem.getString("productId"), amount,
orderItem.getDouble("quantity").doubleValue(), null, null, null, null, null,
null, null,
- catalogId, null,
orderItem.getString("orderItemTypeId"), itemGroupNumber, dispatcher);
+ catalogId, null,
orderItem.getString("orderItemTypeId"), itemGroupNumber, dispatcher, null);
noItems = false;
} catch (CartItemModifyException e) {
errorMsgs.add(e.getMessage());
@@ -362,7 +370,7 @@
if (quantity > 0.0) {
try {
if (Debug.verboseOn()) Debug.logVerbose("Bulk Adding
to cart [" + quantity + "] of [" + productId + "] in Item Group [" +
itemGroupNumber + "]", module);
- this.cart.addOrIncreaseItem(productId, null, quantity,
null, null, null, null, null, null, null, catalogId, null, null,
itemGroupNumberToUse, dispatcher);
+ this.cart.addOrIncreaseItem(productId, null, quantity,
null, null, null, null, null, null, null, catalogId, null, null,
itemGroupNumberToUse, dispatcher, null);
} catch (CartItemModifyException e) {
return ServiceUtil.returnError(e.getMessage());
} catch (ItemNotFoundException e) {
@@ -441,7 +449,7 @@
}
try {
if (Debug.verboseOn()) Debug.logVerbose("Bulk
Adding to cart requirement [" + quantity + "] of [" + productId + "]", module);
- int index = this.cart.addOrIncreaseItem(productId,
null, quantity, null, null, null, null, null, null, null, catalogId, null,
null, itemGroupNumber, dispatcher);
+ int index = this.cart.addOrIncreaseItem(productId,
null, quantity, null, null, null, null, null, null, null, catalogId, null,
null, itemGroupNumber, dispatcher, null);
ShoppingCartItem sci =
(ShoppingCartItem)this.cart.items().get(index);
sci.setRequirementId(requirementId);
} catch (CartItemModifyException e) {
@@ -505,7 +513,7 @@
try {
this.cart.addOrIncreaseItem(productCategoryMember.getString("productId"),
null, quantity.doubleValue(), null, null, null,
null, null, null, null,
- catalogId, null, null, itemGroupNumber,
dispatcher);
+ catalogId, null, null, itemGroupNumber,
dispatcher, null);
totalQuantity += quantity.doubleValue();
} catch (CartItemModifyException e) {
errorMsgs.add(e.getMessage());
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
Sat Jan 13 11:04:01 2007
@@ -79,6 +79,7 @@
private String delegatorName = null;
private String prodCatalogId = null;
private String productId = null;
+ private String parentProductId = null;
private String externalId = null;
/** ends up in orderItemTypeId */
private String itemType = null;
@@ -177,7 +178,7 @@
Debug.logWarning(excMsg, module);
throw new ItemNotFoundException(excMsg);
}
- ShoppingCartItem newItem = new ShoppingCartItem(product,
additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
cart.getLocale(), itemType, itemGroup);
+ ShoppingCartItem newItem = new ShoppingCartItem(product,
additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
cart.getLocale(), itemType, itemGroup, null);
// check to see if product is virtual
if ("Y".equals(product.getString("isVirtual"))) {
@@ -275,10 +276,11 @@
public static ShoppingCartItem makeItem(Integer cartLocation, String
productId, Double selectedAmountDbl, double quantity, Double unitPriceDbl,
Timestamp reservStart, Double reservLengthDbl, Double
reservPersonsDbl, Timestamp shipBeforeDate, Timestamp shipAfterDate,
Map additionalProductFeatureAndAppls, Map attributes, String
prodCatalogId, ProductConfigWrapper configWrapper,
- String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup,
LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool,
Boolean triggerPriceRulesBool)
+ String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup,
LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool,
Boolean triggerPriceRulesBool, String parentProductId)
throws CartItemModifyException, ItemNotFoundException {
GenericDelegator delegator = cart.getDelegator();
GenericValue product = null;
+ GenericValue parentProduct = null;
try {
product = delegator.findByPrimaryKeyCache("Product",
UtilMisc.toMap("productId", productId));
@@ -303,11 +305,21 @@
Debug.logWarning(excMsg, module);
throw new ItemNotFoundException(excMsg);
}
-
+
+ if (parentProductId != null)
+ {
+ try
+ {
+ parentProduct = delegator.findByPrimaryKeyCache("Product",
UtilMisc.toMap("productId", parentProductId));
+ } catch (GenericEntityException e) {
+ Debug.logWarning(e.toString(), module);
+ parentProduct = null;
+ }
+ }
return makeItem(cartLocation, product, selectedAmountDbl, quantity,
unitPriceDbl,
reservStart, reservLengthDbl, reservPersonsDbl,
shipBeforeDate, shipAfterDate,
additionalProductFeatureAndAppls, attributes, prodCatalogId,
configWrapper,
- itemType, itemGroup, dispatcher, cart, triggerExternalOpsBool,
triggerPriceRulesBool);
+ itemType, itemGroup, dispatcher, cart, triggerExternalOpsBool,
triggerPriceRulesBool, parentProduct);
}
/**
@@ -343,9 +355,9 @@
double quantity, Double unitPriceDbl, Timestamp reservStart,
Double reservLengthDbl, Double reservPersonsDbl,
Timestamp shipBeforeDate, Timestamp shipAfterDate, Map
additionalProductFeatureAndAppls, Map attributes,
String prodCatalogId, ProductConfigWrapper configWrapper, String
itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher
dispatcher,
- ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean
triggerPriceRulesBool) throws CartItemModifyException {
+ ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean
triggerPriceRulesBool, GenericValue parentProduct) throws
CartItemModifyException {
- ShoppingCartItem newItem = new ShoppingCartItem(product,
additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
cart.getLocale(), itemType, itemGroup);
+ ShoppingCartItem newItem = new ShoppingCartItem(product,
additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
cart.getLocale(), itemType, itemGroup, parentProduct);
double selectedAmount = selectedAmountDbl == null ? 0.0 :
selectedAmountDbl.doubleValue();
double unitPrice = unitPriceDbl == null ? 0.0 :
unitPriceDbl.doubleValue();
@@ -599,7 +611,7 @@
/** Creates new ShoppingCartItem object. */
protected ShoppingCartItem(GenericValue product, Map
additionalProductFeatureAndAppls, Map attributes, String prodCatalogId, Locale
locale, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup) {
- this(product, additionalProductFeatureAndAppls, attributes,
prodCatalogId, null, locale, itemType, itemGroup);
+ this(product, additionalProductFeatureAndAppls, attributes,
prodCatalogId, null, locale, itemType, itemGroup, null);
if (product != null) {
String productName =
ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME",
this.locale);
// if the productName is null or empty, see if there is an
associated virtual product and get the productName of that product
@@ -619,9 +631,12 @@
}
/** Creates new ShoppingCartItem object. */
- protected ShoppingCartItem(GenericValue product, Map
additionalProductFeatureAndAppls, Map attributes, String prodCatalogId,
ProductConfigWrapper configWrapper, Locale locale, String itemType,
ShoppingCart.ShoppingCartItemGroup itemGroup) {
+ protected ShoppingCartItem(GenericValue product, Map
additionalProductFeatureAndAppls, Map attributes, String prodCatalogId,
ProductConfigWrapper configWrapper, Locale locale, String itemType,
ShoppingCart.ShoppingCartItemGroup itemGroupi, GenericValue parentProduct) {
this._product = product;
this.productId = _product.getString("productId");
+ this._parentProduct = parentProduct;
+ if (parentProduct != null)
+ this.parentProductId = _parentProduct.getString("productId");
if (UtilValidate.isEmpty(itemType)) {
if (_product.getString("productTypeId").equals("ASSET_USAGE")) {
this.itemType = "RENTAL_ORDER_ITEM"; // will create
additional workeffort/asset usage records
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
Sat Jan 13 11:04:01 2007
@@ -1165,7 +1165,7 @@
try {
// just leave the prodCatalogId null, this line won't be
associated with a catalog
String prodCatalogId = null;
- gwpItem = ShoppingCartItem.makeItem(null, product, null,
quantity, null, null, null, null, null, null, null, null, prodCatalogId, null,
null, null, dispatcher, cart, Boolean.FALSE, Boolean.TRUE);
+ gwpItem = ShoppingCartItem.makeItem(null, product, null,
quantity, null, null, null, null, null, null, null, null, prodCatalogId, null,
null, null, dispatcher, cart, Boolean.FALSE, Boolean.TRUE, null);
if (optionProductIds.size() > 0) {
gwpItem.setAlternativeOptionProductIds(optionProductIds);
} else {
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
Sat Jan 13 11:04:01 2007
@@ -271,9 +271,9 @@
// i cannot get the addOrDecrease function to accept a null
reservStart field: i get a null pointer exception a null constant works....
if (reservStart == null) {
- cart.addOrIncreaseItem(productId, null,
quantity.doubleValue(), null, null, null, null, null, null, attributes,
prodCatalogId, null, null, null, dispatcher);
+ cart.addOrIncreaseItem(productId, null,
quantity.doubleValue(), null, null, null, null, null, null, attributes,
prodCatalogId, null, null, null, dispatcher, null);
} else {
- cart.addOrIncreaseItem(productId, null,
quantity.doubleValue(), reservStart, reservLength, reservPersons, null, null,
null, attributes, prodCatalogId, null, null, null, dispatcher);
+ cart.addOrIncreaseItem(productId, null,
quantity.doubleValue(), reservStart, reservLength, reservPersons, null, null,
null, attributes, prodCatalogId, null, null, null, dispatcher, null);
}
Map messageMap = UtilMisc.toMap("productId", productId);
errMsg =
UtilProperties.getMessage(resource,"shoppinglistevents.added_product_to_cart",
messageMap, cart.getLocale());
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
Sat Jan 13 11:04:01 2007
@@ -440,7 +440,7 @@
Map attributes = UtilMisc.toMap("shoppingListId",
listId, "shoppingListItemSeqId", itemId);
try {
- listCart.addOrIncreaseItem(productId, null,
quantity.doubleValue(), reservStart, reservLength, reservPersons, null, null,
null, attributes, null, null, null, null, dispatcher);
+ listCart.addOrIncreaseItem(productId, null,
quantity.doubleValue(), reservStart, reservLength, reservPersons, null, null,
null, attributes, null, null, null, null, dispatcher, null);
} catch (CartItemModifyException e) {
Debug.logError(e, "Unable to add product to List
Cart - " + productId, module);
} catch (ItemNotFoundException e) {
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl Sat
Jan 13 11:04:01 2007
@@ -42,7 +42,11 @@
<td valign="top"><div
class="tabletext">${cartLine.getQuantity()?string.number}</div></td>
<td valign="top">
<#if cartLine.getProductId()?exists>
- <div><a
href="<@ofbizUrl>product?product_id=${cartLine.getProductId()}</@ofbizUrl>"
class="linktext">${cartLine.getName()}</a></div>
+ <#if cartLine.getParentProductId()?exists>
+ <div><a
href="<@ofbizUrl>product?product_id=${cartLine.getParentProductId()}</@ofbizUrl>"
class="linktext">${cartLine.getName()}</a></div>
+ <#else>
+ <div><a
href="<@ofbizUrl>product?product_id=${cartLine.getProductId()}</@ofbizUrl>"
class="linktext">${cartLine.getName()}</a></div>
+ </#if>
<#else>
<div
class="tabletext"><b>${cartLine.getItemTypeDescription()?if_exists}</b></div>
</#if>
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
---
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
(original)
+++
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
Sat Jan 13 11:04:01 2007
@@ -418,7 +418,7 @@
}
public static ProductStoreSurveyWrapper
getRandomSurveyWrapper(GenericDelegator delegator, String productStoreId,
String groupName, String partyId, Map passThruFields) {
- List randomSurveys = getSurveys(delegator, productStoreId, groupName,
null, "RANDOM_POLL");
+ List randomSurveys = getSurveys(delegator, productStoreId, groupName,
null, "RANDOM_POLL", null);
if (!UtilValidate.isEmpty(randomSurveys)) {
Random rand = new Random();
int index = rand.nextInt(randomSurveys.size());
@@ -430,10 +430,14 @@
}
public static List getProductSurveys(GenericDelegator delegator, String
productStoreId, String productId, String surveyApplTypeId) {
- return getSurveys(delegator, productStoreId, null, productId,
surveyApplTypeId);
+ return getSurveys(delegator, productStoreId, null, productId,
surveyApplTypeId, null);
}
- public static List getSurveys(GenericDelegator delegator, String
productStoreId, String groupName, String productId, String surveyApplTypeId) {
+ public static List getProductSurveys(GenericDelegator delegator, String
productStoreId, String productId, String surveyApplTypeId, String
parentProductId) {
+ return getSurveys(delegator, productStoreId, null, productId,
surveyApplTypeId,parentProductId);
+ }
+
+ public static List getSurveys(GenericDelegator delegator, String
productStoreId, String groupName, String productId, String surveyApplTypeId,
String parentProductId) {
List surveys = new LinkedList();
List storeSurveys = null;
try {
@@ -451,6 +455,7 @@
storeSurveys = EntityUtil.filterByAnd(storeSurveys,
UtilMisc.toMap("groupName", groupName));
}
+ Debug.log("getSurvey for product " + productId,module);
// limit by product
if (!UtilValidate.isEmpty(productId) &&
!UtilValidate.isEmpty(storeSurveys)) {
Iterator ssi = storeSurveys.iterator();
@@ -463,7 +468,11 @@
try {
product = delegator.findByPrimaryKeyCache("Product",
UtilMisc.toMap("productId", productId));
if ((product != null) &&
("Y".equals(product.get("isVariant")))) {
- virtualProductId =
ProductWorker.getVariantVirtualId(product);
+ if (parentProductId != null)
+ virtualProductId = parentProductId;
+ else
+ virtualProductId =
ProductWorker.getVariantVirtualId(product);
+ Debug.log("getSurvey for virtual product " +
virtualProductId,module);
}
} catch (GenericEntityException e) {
Debug.logError(e, "Problem finding product from productId
" + productId, module);
Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?view=diff&rev=495945&r1=495944&r2=495945
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
(original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Sat
Jan 13 11:04:01 2007
@@ -352,7 +352,7 @@
public void addItem(String productId, double quantity) throws
CartItemModifyException, ItemNotFoundException {
trace("add item", productId + "/" + quantity);
try {
- cart.addOrIncreaseItem(productId, null, quantity, null, null,
null, null, null, null, null, null, null, null, null, session.getDispatcher());
+ cart.addOrIncreaseItem(productId, null, quantity, null, null,
null, null, null, null, null, null, null, null, null, session.getDispatcher(),
null);
} catch (ItemNotFoundException e) {
trace("item not found", e);
throw e;
--- End Message ---