[jira] Created: (OFBIZ-1926) ProductConfigWrapper.getPrice() price calculation for non mandatory options (non COMPONENT_PRICE type) not working correctly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-1926) ProductConfigWrapper.getPrice() price calculation for non mandatory options (non COMPONENT_PRICE type) not working correctly

Nicolas Malin (Jira)
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.

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 | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1926) ProductConfigWrapper.getPrice() price calculation for non mandatory options (non COMPONENT_PRICE type) not working correctly

Nicolas Malin (Jira)

     [ 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1926) ProductConfigWrapper.getPrice() price calculation for non mandatory options (non COMPONENT_PRICE type) not working correctly

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624071#action_12624071 ]

Ritesh Trivedi commented on OFBIZ-1926:
---------------------------------------

I found a fix.

What is needed is an additional if condition to see if its a valid price

boolean validPriceFound = (Boolean)priceMap.get("validPriceFound");

and the conditional check for component price should change to

line #504:  if ((componentPrice != null) && (validPriceFound)){
                    price = componentPrice.doubleValue();
                } else {
....

> 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 | Threaded
Open this post in threaded view
|

[jira] Closed: (OFBIZ-1926) ProductConfigWrapper.getPrice() price calculation for non mandatory options (non COMPONENT_PRICE type) not working correctly

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

Bilgin Ibryam closed OFBIZ-1926.
--------------------------------

       Resolution: Fixed
    Fix Version/s: SVN trunk
         Assignee: Bilgin Ibryam

Thanks   Ritesh.
Your patch  is in trunk rev 687723.


> 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
>            Assignee: Bilgin Ibryam
>            Priority: Critical
>             Fix For: SVN trunk
>
>
> 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.