Incorrect Discounted Amounts on Checkout Summary

In some implementations of SuiteCommerce Advanced, Checkout Summary pages display incorrect discounted sub-total amounts and inconsistent strike-through and original amounts. These issues occur on Subtotal and Items to Ship sections of the checkout flow. The patch instructions described below correct this problem.

The following patch corrects a problem in Transaction.Line.Views.Cell.Navigable.View.js, which is part of the Transaction.Line.Views module. To implement this patch, create a custom module to extend the prototype object for the getContext() method.

Step 1: Extend Transaction.Line.Views.Cell.Navigable.View.js
A) Create an extensions directory to store your custom module. Depending on your implementation, this directory might already exist.

B) Within this directory, create a custom module with a name that is unique but similar to the module being customized.

For example: Modules/extensions/Transaction.Line.Views.Extension@1.0.0.

C) Open your new Transaction.Line.Views.Extension@1.0.0 module and create a subfolder titled JavaScript.

For example: Modules/extensions/Transaction.Line.Views.Extension@1.0.0/JavaScript

D) In your new JavaScript subdirectory, create a JavaScript file to extend Transaction.Line.Views.Cell.Navigable.View.js.

Name this file according to best practices.

For example: Transaction.Line.Views.Cell.Navigable.View.Extend.js

E) Open this file and extend the getContext() method as shown in the following code sample.

                define('Transaction.Line.Views.Cell.Navigable.View.Extend'
,   [   'Transaction.Line.Views.Cell.Navigable.View'
   ,   'underscore'
   ,   'Backbone'
   ]
,   function (
      TransactionLineViewsCellNavigableView
   ,   _   
   ,   Backbone
   )
{
   'use strict';

   _.extend(TransactionLineViewsCellNavigableView.prototype,
        {
            getContext: function ()
            {
            var item = this.model.get('item')
            ,   line = this.model;

            //@class Transaction.Line.Views.Navigable.View.Context
            return {
                  //@property {Transaction.Line.Model} model
                  model: this.model
                  //@property {String} itemId
               ,   itemId: item.get('internalid')
                  //@property {String} itemName
               ,   itemName: item.get('_name')
                  //@property {String} cellClassName
               ,   cellClassName: this.options.cellClassName
                  //@property {Boolean} isNavigable
               ,   isNavigable: !!this.options.navigable && !!item.get('_isPurchasable')
                  //@property {String} rateFormatted
               ,   rateFormatted: line.get('rate_formatted')
                  //@property {Boolean} showOptions
               ,   showOptions: !!(line.get('options') && line.get('options').length)
                  //@property {String} itemURLAttributes
               ,   itemURLAttributes: line.getFullLink({quantity:null,location:null,fulfillmentChoice:null})
                  //@property {Number} quantity
               ,   quantity: line.get('quantity')
                  //@property {Boolean} showDetail2Title
               ,   showDetail2Title: !!this.options.detail2Title
                  //@property {String} detail2Title
               ,   detail2Title: this.options.detail2Title
                  //@property {String} detail2
               ,   detail2: line.get(this.options.detail2)
                  //@property {Boolean} showBlockDetail2
               ,   showBlockDetail2: !!line.get(this.options.detail2)
                  //@property {Boolean} showDetail3Title
               ,   showDetail3Title: !!this.options.detail3Title
                  //@property {String} detail3Title
               ,   detail3Title: this.options.detail3Title
                  //@property {String} detail3
               ,   detail3: line.get('amount') > line.get('total') ? line.get('total_formatted') : line.get(this.options.detail3)
                  //@property {Boolean} showComparePrice
               ,   showComparePrice: line.get('amount') > line.get('total')
                  //@property {String} comparePriceFormatted
               ,   comparePriceFormatted: line.get('amount_formatted')
                  // @property {ImageContainer} thumbnail
               ,   thumbnail: this.model.getThumbnail()
                  // @property {Boolean} isFreeGift
               ,   isFreeGift: line.get('free_gift') === true
            };
         }
    });
});

Now test the source code customizations on a local server If we are currently running SCA on a local server, our changes should appear on your local site immediately.

Confirm your results and deploy the changes.

Upon successful deployment, Checkout Summary pages should display correct original and discounted sub-total amounts. Strike-through amounts also display correctly.

Leave a comment

Your email address will not be published. Required fields are marked *