Promotion pricing not reflected in shopping cart

54 views
Skip to first unread message

Theresa Martin

unread,
Sep 25, 2019, 6:16:19 PM9/25/19
to Slatwall Commerce
Hello all,

So, we recently upgraded this client's site from Slatwall 4.1.015 to 4.5.051. All has been going well with this new version so far. However, we've discovered something odd occurring with the promotion pricing. The client set up a new promotion yesterday and had an order come in today with the sale item, except that the sale price was not reflected on the order, rather, the retail price was. The sale pricing appears properly on the product listings and details pages, but once the item is added to the cart, the shopping cart simply displays the retail price. I have attached a couple of screenshots of what we are seeing. Promotions have been utilized frequently on this site for the past several years without issue, so I have to assume that something has changed with respect to the Slatwall upgrade. I did discover that if I was logged in as the Admin Super User when attempting to add a sale item to the cart, the sale price DID appear correctly. Unfortunately, if any other user does this, only the retail prices appear in the shopping cart. The attached shopping cart image illustrates this, as one of the items was added when logged in as the Admin Super User and the other was not. I've been trying to hunt around in the code to find what might have changed, but I have been so far unsuccessful. Would anyone know what could possibly be going on? If someone might be able to point me in the right direction, I would really appreciate it!

Thanks so much,

Theresa
product-details.png
shopping-cart.png

Theresa Martin

unread,
Sep 27, 2019, 12:33:37 PM9/27/19
to Slatwall Commerce
Hello again,

I've been investigating this further, and just cannot seem to figure out what is going on and why the promotion pricing is not working. The promotion is set up successfully in the admin, as has been done numerous times in the past, and viewing the product in the admin reflects the sale price (please see attached product-skus.png). And, as mentioned previously, the product details page on the frontend reflects the correct sale pricing. It is just when adding it to the cart, only the regular price is reflected. Additionally, I realized that, though the sale price is reflected in the cart only if the admin super user is logged in (WHY, I have no idea), it is actually not displaying as expected. The shopping cart page conditionally uses "<cfif $.slatwall.cart().getItemDiscountAmountTotal() gt 0>" to determine if there is a discount and to display the Discount column, but this appears to always be "0", so rather than displaying this column and the discount, it is just showing the sale price as the regular price under the Price column (shopping-cart-no-discount-column.png). Previously, the regular price would be listed, the discount amount displays under a Discount column, and the Total reflects the difference. Furthermore, in the Slatwall admin, the Order Items area does not reflect the pricing and discount correctly, as, again, the sale price is reflected under the Price column, and the Discount column always shows "-$0.00" (order-items.png). To compare, order-during-sale.png shows how the order info displayed in the past with sale items. 

I fear I am perhaps the only one experiencing these issues, but if anyone might have a suggestion as to what we are doing wrong with promotions and/or steer me in the direction of what to look for, in the code, it would be most appreciated. I am just really stumped, at this point.

Thank you!

Theresa
order-during-sale.png
order-items.png
product-skus.png
shopping-cart-no-discount-column.png

Theresa Martin

unread,
Sep 29, 2019, 8:39:40 PM9/29/19
to Slatwall Commerce
Am still flailing with this issue, but wanted to post an update, as I think I may be narrowing the issue down a bit. If the Discount Type for the Promotion Reward is set to either "Fixed Amount" or "Amount Off", the promotion pricing actually works perfectly throughout the shopping cart and checkout/order process. It is ONLY when the Discount Type is "Percentage Off", that things do not work. I am trying to determine what the difference(s) is/are between percentageOff and the other two types, but so far have been unsuccessful. I do see differences between these, as it pertains to "currencyCode", but I really don't know if that is what is causing this problem, and didn't want to start hacking away at core code. I could not find this as an issue for anyone else in this forum, but might this possibly ring any bells with anyone, as to what I should look at?? Again, our current environment is:

Operating System: Linux
CFML Server: Lucee: 4.5.3.018
DB Dialect: MySQL
Slatwall Version: 4.5.051

Thank you,

Theresa

On Wednesday, September 25, 2019 at 3:16:19 PM UTC-7, Theresa Martin wrote:

Sumit Verma

unread,
Oct 4, 2019, 12:11:16 AM10/4/19
to SlatwallEcommerce
Theresa, 4.5 is very old version. Is there a reason you didn't upgrade to 5?

Sumit Verma
Partner / Vice President | ten24, LLC
office: 877.886.5806 x 103 | mobile: 617.290.8214
www.ten24web.com | www.linkedin.com/in/sverma | twitter: blogonria


--
You received this message because you are subscribed to the Google Groups "Slatwall Commerce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slatwallecomme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slatwallecommerce/37cf94ff-bc1f-460a-9d10-3addafd3b7c2%40googlegroups.com.

Theresa Martin

unread,
Oct 4, 2019, 2:13:14 AM10/4/19
to Slatwall Commerce
Hi Sumit,

Yes, we were seeing numerous console errors and issues with the Slatwall admin when attempting to upgrade to 5 (my upgrade saga has been well-documented in this forum), and just not ever able to resolve them, unfortunately. I had tried pretty much all versions of 5, to the latest, 5.1.025, released a year ago. I am guessing that the root of the matter is our environment, perhaps the Lucee server version, but I really do not know. Our client was perfectly content with 4.1, except for the rounding issues causing orders to not close. While 4.5 appears to have resolved that (yay!), it looks like we've opened a new can of worms with these promotions issues. I was hoping I could figure out fairly quickly what was causing percentageOff to no longer function properly, but that has not been the case. Was there an issue with respect to this, that was fixed in 5+? I could not find anything specific to this mentioned in GitHub.

I appreciate you checking in! :)

Theresa
To unsubscribe from this group and stop receiving emails from it, send an email to slatwall...@googlegroups.com.

Sumit Verma

unread,
Oct 4, 2019, 8:45:19 AM10/4/19
to SlatwallEcommerce
That version is 2 years old so it will be hard to look back. But the currency code change was to support currecy code in promotion. Because when you define amount off or fixed amount it needed to be different in each currency. You can try comparing PromotionService in master to see if there were any changes. This one might be your issue:


But might be worth reviewing all changes:





Sumit Verma
Partner / Vice President | ten24, LLC
office: 877.886.5806 x 103 | mobile: 617.290.8214
www.ten24web.com | www.linkedin.com/in/sverma | twitter: blogonria

To unsubscribe from this group and stop receiving emails from it, send an email to slatwallecomme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slatwallecommerce/3f5193a9-0787-498d-99f5-776aa4707863%40googlegroups.com.

Theresa Martin

unread,
Oct 5, 2019, 11:09:29 AM10/5/19
to Slatwall Commerce
Thank you, Sumit, for the suggestion. I tried making that one change to PromotionService.cfc from the commit in your first link, and it had no effect, and so I tried just replacing the whole PromotionService.cfc file with the latest, containing all the changes from your second link, and again no effect. I did reload Slatwall after both attempts. So, I guess the issue is something else. I will just keep digging, but it is driving me nuts. I do understand, though, that with our older Slatwall version, support is limited and difficult.

Thank you for the help,

Theresa

Theresa Martin

unread,
Oct 6, 2019, 8:35:28 PM10/6/19
to Slatwall Commerce
Hello again, Sumit,

I believe I found the culprit. It basically came down to a single word (!) that needed to be removed. I compared various promotion-related files with the versions from our old 4.1 site and found that it apparently was a rounding issue. Changes were made in 2016 to the rounding logic included in model/dao/PromotionDAO.cfc whereby:

<cfset querySetCell(orderItemDiscountsQuery, "salePrice", orderItemDiscountsQuery.originalPrice - ( orderItemDiscountsQuery.originalPrice * (orderItemDiscountsQuery.amount / 100) ), orderItemDiscountsQuery.currentRow )>

was updated to:

<cfset querySetCell(orderItemDiscountsQuery, "salePrice", precisionEvaluate(orderItemDiscountsQuery.originalPrice - ( orderItemDiscountsQuery.originalPrice * (round(orderItemDiscountsQuery.amount / 100)*100)/100)), orderItemDiscountsQuery.currentRow )>

I removed "round", retained the later precisionCalculate updates and changed the above to:

<cfset querySetCell(orderItemDiscountsQuery, "salePrice", getService('HibachiUtilityService').precisionCalculate(orderItemDiscountsQuery.originalPrice - ( orderItemDiscountsQuery.originalPrice * (orderItemDiscountsQuery.amount / 100)*100)/100), orderItemDiscountsQuery.currentRow )>

If there is any problem with us making this change, that you foresee, please let me know, but this appears to have done the trick. Making this change also resolved another promotions issue we discovered a few days ago when a promotion was percentageOff and the percent was set to 50 or above. The resulting cart showed a 100% discount, for some strange reason. 

In any event, I guess I am the only one on this version of Slatwall, as the above "round" code is included in the latest version of PromotionDAO, as well, and no one else seems to be having this issue, but I wanted to post my findings, in case it might still help someone. The issue must be our version of Lucee, which is not the latest, by any means.

Thank you again,

Theresa


On Friday, October 4, 2019 at 5:45:19 AM UTC-7, Sumit Verma wrote:

Sumit Verma

unread,
Oct 7, 2019, 10:47:51 AM10/7/19
to SlatwallEcommerce
Thanks Theresa for debugging and giving more info. We will investigate further as we still have that code in the BE and we haven't seen any issue. Can you please give us some data on what is, price and discount and what data you getting with round function? I would like to see if we can recreate the issue on our end. 


Sumit Verma
Partner / Vice President | ten24, LLC
office: 877.886.5806 x 103 | mobile: 617.290.8214
www.ten24web.com | www.linkedin.com/in/sverma | twitter: blogonria

To unsubscribe from this group and stop receiving emails from it, send an email to slatwallecomme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slatwallecommerce/c01afc0c-e2dc-4017-ac1d-43e4c28af99d%40googlegroups.com.

Theresa Martin

unread,
Oct 7, 2019, 3:14:36 PM10/7/19
to Slatwall Commerce
Hi Sumit,

I would be happy to provide whatever might be helpful. I could restore the previous PromotionDAO.cfc file and PM you a link to our development site, so that you could see the issue in action, when going from the product detail page to the cart, as well as a Slatwall admin login, if it would be useful to review the Promotions, etc. But I can say that it did not appear to make any difference what the price or discount amount was -- the promotion reward just had to be set to "Percentage Off", in order to not function correctly. With the round function in place, the data returned with "getItemDiscountAmountTotal" and "discountAmount" on the cart page was always "0". Our older version of Lucee server (4.5.3.018) is probably what is causing the issue.

Please let me know if you would like access and/or if there are additional data that you would like me to provide.

Theresa
Reply all
Reply to author
Forward
0 new messages