Incorrect Discounted Amounts on Checkout Summary

This topic applies to

Applies to

SuiteCommerce Advanced | Aconcagua | Kilimanjaro | Elbrus

 

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. You can download the code samples described in this procedure here: IncorrectDiscountedAmountsOnCheckout.zip.

Step 1: Extend Transaction.Line.Views.Cell.Navigable.View.js

  1. Create an extensions directory to store your custom module. Depending on your implementation, this directory might already exist.

  2. 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.

  3. 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

  4. 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

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

    define('Transaction.Line.Views.Cell.Navigable.View.Extend' , [ 'Transaction.Line.Views.Cell.Navigable.View' , 'underscore' , 'Backbone' ] , function ( TransactionLineViewsCellNavigableView , _ , Backbone ) { 'use strict'; _.extend(TransactionLineViewsOptionsSelectedView.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 }; } }); });
  6. Save the file.

Step 2: Prepare the Developer Tools For Your Customization

  1. Open your new Transaction.Line.Views.Extension@1.0.0 module directory.

  2. Create a file in this directory titled ns.package.json.

    Modules/extensions/Transaction.Line.Views.Extension@1.0.0/ns.package.json

  3. Paste the following code into your new ns.package.json file:

    { "gulp": { "javascript": [ "JavaScript/*.js" ] } }
  4. Open the distro.json file. This is located in your root directory.

  5. Add your custom module to the modules object.

    Your code should look similar to:

    { "name": "SuiteCommerce Advanced Aconcagua", "version": "2.0", "isSCA": true, "buildToolsVersion": "aconcaguaR2", "folders": { "modules": "Modules", "suitecommerceModules": "Modules/suitecommerce", "extensionsModules": "Modules/extensions", "thirdPartyModules": "Modules/third_parties", "distribution": "LocalDistribution", "deploy": "DeployDistribution" }, "modules": { "extensions/Transaction.Line.Views.Extension": "1.0.0", "suitecommerce/Account": "aconcaguaR2", ...

    This step ensures that the Gulp tasks include your module when you deploy.  In this example, the custom modules are added at the beginning of the list of modules. However, you can add the modules anywhere in the modules object. The order of precedence in this list does not matter.

  6. Add Transaction.Line.Views.Cell.Navigable.View.Extend as a dependency to SCA entry point within the SC.Checkout.Starter entrypoint of the JavaScript array.

    Your distro.js file should look similar to:

    "tasksConfig": {
    //...
    "javascript": [
             //...
             {
                   "entryPoint": "SC.Checkout.Starter",
                   "exportFile": "checkout.js",
                   "dependencies": [
                      //...
                        "StoreLocator",
                        "SC.CCT.Html",
                        "Transaction.Line.Views.Cell.Navigable.View.Extend"
                   ],
                               //...
  7. Save the distro.json file.

Step 3: Test and Deploy Your Customization

  1. Test your source code customizations on a local server (see SCA on a Local Server) or deploy them to your NetSuite account (see Deploy to NetSuite). If you are currently running SCA on a local server, your changes should appear on your local site immediately.

  2. Confirm your results.

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

Related Topics