[ https://issues.apache.org/jira/browse/OFBIZ-7263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15354602#comment-15354602 ]
Aditi Patidar commented on OFBIZ-7263: -------------------------------------- Here are some findings on the issue: "updatePrice" method of "ShoppingCartItem" class run service "calculateProductPrice" which in turn executes the methods to match the price rule conditions on the cart item and if the conditions meet it executes corresponding actions mentioned in the price rule. But in the "updatePrice" it checks for the following condition before running "calculateProductPrice": {code} public void updatePrice(LocalDispatcher dispatcher, ShoppingCart cart) throws CartItemModifyException { // set basePrice using the calculateProductPrice service if (_product != null && isModifiedPrice == false) { {code} When we update the item added to cart and recalculate the order it executes method "modifyCart" of "ShoppingCartHelper" class where this line of code gets executed: {code} if (item != null) { item.setBasePrice(quantity); // this is quantity because the parsed number variable is the same as quantity item.setDisplayPrice(quantity); // or the amount shown the cart items page won't be right item.setIsModifiedPrice(true); // flag as a modified price } {code} Here "item.setIsModifiedPrice(true)" set the flag "isModifiedPrice" "true" and the condition mentioned in "updatePrice" become false and the "calculateProductPrice" not gets executed. When I comment out the line {code} //item.setIsModifiedPrice(true); {code} It works as expected and price rule gets apply. I am not sure what the purpose of this line of code "item.setIsModifiedPrice(true)" inside "modifyCart" because it contradict the condition written in "updatePrice". > Price rule created with product specific quantity condition not applied to > the order when adding the product to cart with less quantity than mentioned > in condition > ------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-7263 > URL: https://issues.apache.org/jira/browse/OFBIZ-7263 > Project: OFBiz > Issue Type: Bug > Components: order > Affects Versions: Trunk > Reporter: Aditi Patidar > Assignee: Aditi Patidar > > Steps to regenerate the issue: > 1. Create a price rule. > 2. Add a condition, select input 'Quantity', operator 'Is' and add the value > '2' or any quantity more than 1. > 3. Add an action, select action type 'Flat Amount Override' and add it's > value. > 4. Create a sale order: > i. Add product with quantity one to the order. > ii. Update the quantity to 2 or to the value entered in condition for > quantity in price rule. > iii. Recalculate the order. > Expected result: Unit price should override to the amount added in action. > Actual result: It's not getting overridden to the amount added in action. -- This message was sent by Atlassian JIRA (v6.3.4#6332)