[ 
https://issues.apache.org/jira/browse/OFBIZ-1926?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ritesh Trivedi updated OFBIZ-1926:
----------------------------------

    Description: 
In ProductConfigWrapper.getPrice() does not return correct price (returns 0) 
for config options which are not mandatory and corresponding products have 
LIST_PRICE and DEFAULT_PRICE entries in PRODUCT_PRICE and not have 
COMPONENT_PRICE

Below are the lines from ProductConfigWrapper that are the culprit. There are 
couple of issues 

1. Note the only time priceMap will not contain a price entry is when there is 
no LIST_PRICE in PRODUCT_PRICE. so just checking for null is not going to help.

2. If there is a LIST_PRICE for the product config option which is non 
mandatory - calcProductPrice service is going to return price of 0 and not null 
- so again checking for null is not going to help

This will need some investigation and deciding whether 0 is valid product price 
and -ve or null can indicate invalid product price.

Line 489: Double componentPrice = (Double) priceMap.get("price");
....
Line 497: if (componentPrice != null) {
                    price = componentPrice.doubleValue();
                } else {
                    fieldMap.put("productPricePurposeId", "PURCHASE");
                    Map purchasePriceResultMap = 
dispatcher.runSync("calculateProductPrice", fieldMap);
                    Double purchasePrice = (Double) 
purchasePriceResultMap.get("price");
                    if (purchasePrice != null) {
                        price = purchasePrice.doubleValue();
                    }
                }

  was:
In ProductConfigWrapper.getPrice() does not return correct price (returns 0) 
for config options which are not mandatory and corresponding products have 
LIST_PRICE and DEFAULT_PRICE entries in PRODUCT_PRICE.

Below are the lines from ProductConfigWrapper that are the culprit. There are 
couple of issues 

1. Note the only time priceMap will not contain a price entry is when there is 
no LIST_PRICE in PRODUCT_PRICE. so just checking for null is not going to help.

2. If there is a LIST_PRICE for the product config option which is non 
mandatory - calcProductPrice service is going to return price of 0 and not null 
- so again checking for null is not going to help

This will need some investigation and deciding whether 0 is valid product price 
and -ve or null can indicate invalid product price.

Line 489: Double componentPrice = (Double) priceMap.get("price");
....
Line 497: if (componentPrice != null) {
                    price = componentPrice.doubleValue();
                } else {
                    fieldMap.put("productPricePurposeId", "PURCHASE");
                    Map purchasePriceResultMap = 
dispatcher.runSync("calculateProductPrice", fieldMap);
                    Double purchasePrice = (Double) 
purchasePriceResultMap.get("price");
                    if (purchasePrice != null) {
                        price = purchasePrice.doubleValue();
                    }
                }


> ProductConfigWrapper.getPrice() price calculation for non mandatory options 
> (non COMPONENT_PRICE type) not working correctly
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-1926
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1926
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ecommerce, product
>    Affects Versions: SVN trunk
>         Environment: All
>            Reporter: Ritesh Trivedi
>            Priority: Critical
>
> In ProductConfigWrapper.getPrice() does not return correct price (returns 0) 
> for config options which are not mandatory and corresponding products have 
> LIST_PRICE and DEFAULT_PRICE entries in PRODUCT_PRICE and not have 
> COMPONENT_PRICE
> Below are the lines from ProductConfigWrapper that are the culprit. There are 
> couple of issues 
> 1. Note the only time priceMap will not contain a price entry is when there 
> is no LIST_PRICE in PRODUCT_PRICE. so just checking for null is not going to 
> help.
> 2. If there is a LIST_PRICE for the product config option which is non 
> mandatory - calcProductPrice service is going to return price of 0 and not 
> null - so again checking for null is not going to help
> This will need some investigation and deciding whether 0 is valid product 
> price and -ve or null can indicate invalid product price.
> Line 489: Double componentPrice = (Double) priceMap.get("price");
> ....
> Line 497: if (componentPrice != null) {
>                     price = componentPrice.doubleValue();
>                 } else {
>                     fieldMap.put("productPricePurposeId", "PURCHASE");
>                     Map purchasePriceResultMap = 
> dispatcher.runSync("calculateProductPrice", fieldMap);
>                     Double purchasePrice = (Double) 
> purchasePriceResultMap.get("price");
>                     if (purchasePrice != null) {
>                         price = purchasePrice.doubleValue();
>                     }
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to