Skip to Content
author's profile photo Former Member
Former Member

not able to show actual total price at the line item in cart page without deducting the discount/promotional offer

Hi

There is a requirement to show actual total price for each product wihtout subracting the discount(any promotional offer/discount) at the line item. But currently the out of box functionality is showing the total price after deducting the discount/promotional offers.

So i modified the entry as below in createProductList() method of CartPageController before adding the cartData to model. entry.getTotalPrice().setValue(BigDecimal.valueOf(entry.getQuantity()).multiply(entry.getBasePrice().getValue()));

But i am not getting the updated total price to front end pages.It is still showing the old total price every time.

Can you please let me where am i doing wrong and suggest me how to acheive it.

Please see the code below for reference

protected void createProductList(final Model model) throws CMSItemNotFoundException { CartData cartData = cartFacade.getSessionCart(); reverseCartProductsOrder(cartData.getEntries()); if (cartData.getEntries() != null && !cartData.getEntries().isEmpty()) {

         for (OrderEntryData entry : cartData.getEntries())
         {
             final UpdateQuantityForm uqf = new UpdateQuantityForm();
             uqf.setQuantity(entry.getQuantity());
                             entry.getTotalPrice().setValue(BigDecimal.valueOf(entry.getQuantity()).multiply(entry.getBasePrice().getValue()));

             
             model.addAttribute("updateQuantityForm" + entry.getEntryNumber(), uqf);
         }
 
     }
     
     storeCmsPageInModel(model, getContentPageForLabelOrId(CART_CMS_PAGE));
     setUpMetaDataForContentPage(model, getContentPageForLabelOrId(CART_CMS_PAGE));
     model.addAttribute("cartData", cartData);
 }
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 08, 2015 at 06:13 PM

    The price of a product on the cart page and the PDP page are controlled by productPricePopulaotor. chek what value are you getting over there and the pries are converted to the PriceData. Pl check on cartItems.tag as what attribute you are using for displaying the price tag.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Naresh, Thanks for your reply. In cartItems tag it is entry.totalPrice attribute which is used. But while sending the model i am changing the total price in each entry in the cartin the above method which i mentioned earlier. But still it is not reflecting. I am a bit confused.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.