Order Summary for Item-Based Promotions

This topic applies to

Applies to

SuiteCommerce Advanced | Elbrus

If an order includes an item with an item-based promotion, the Order Summary does not properly display the price for the items. The Shopping Cart correctly displays the price but the price in the Order Summary is incorrect .

This patch updates the detail3 variable in the JavaScript files used to display the item price after discount in the Order Summary. You can download the code samples described in this procedure here: FixTotalInOrderSummary.zip in the File Cabinet.

Note

In general, best practice is to extend JavaScript using the JavaScript prototype object. This improves the chances that your customizations continue to work when migrating to a newer version of SuiteCommerce Advanced. However, this patch requires you to modify a file that you cannot extend, and you must use a custom module to override the existing module file. For more information, see Customize and Extend Core SuiteCommerce Advanced Modules.


To apply this patch, you override the modules used to display the total in the Order Summary.

Step 1: Create and Update the Required Override Files

  1. If you have not done so already, create a directory to store your custom module, for example, Modules\extensions.

  2. Open this directory and create the following subdirectories to maintain your customizations.

    Give these directories a name similar to the modules being customized.

    For example, create the following directories in the Modules/extensions directory:

    • CreditMemoExtension@1.0.0\JavaScript

    • InvoiceExtension@1.0.0 \JavaScript

    • OrderWizard.Module.CartItemsExtension@1.0.0 \JavaScript

    • OrderWizard.Module.ShipmethodExtension@1.0.0 \JavaScript

    • QuoteExtension@1.0.0 \JavaScript

    • ReturnAuthorizationExtension@1.0.0 \JavaScript

  3. Copy the following source files into their respective target directories, where the target directory looks like the following:

    Modules/extensions/[module]Extension@1.0.0/JavaScript
  4. Copy the files in the following list:

    • Modules/suitecommerce/CreditMemo@X.Y.Z/JavaScript/CreditMemo.Details.View.js

    • Modules/suitecommerce/Invoiceo@X.Y.Z/JavaScript/Invoice.Details.View.js

    • Modules/suitecommerce/OrderHistory@X.Y.Z/JavaScript/OrderHistory.ReturnAuthorization.View.js

    • Modules/suitecommerce/OrderWizard.Module.CartItems@X.Y.Z/JavaScript/OrderWizard.Module.CartItems.PickupInStore.Package.View.js

    • Modules/suitecommerce/OrderWizard.Module.CartItems@X.Y.Z/JavaScript/OrderWizard.Module.CartItems.Ship.js

    • Modules/ extensions/OrderWizard.Module.Shipmethod.Extension@X.Y.Z/JavaScript/ OrderWizard.Module.MultiShipTo.Shipmethod.Package.View.js

    • Modules/suitecommerce/Quote@X.Y.Z/JavaScript/Quote.Details.View.js

    • Modules/suitecommerce/ReturnAuthorization@X.Y.Z/JavaScript/ReturnAuthorization.Detail.View.js

    • Modules/suitecommerce/ReturnAuthorization@X.Y.Z/JavaScript/ReturnAuthorization.Form.View.js

    Note

    Remember, X.Y.Z  represents the version of the module in your implementation of SuiteCommerce Advanced.


  5. For each of the target files in the table listed above, make the following code change.

    Locate the following line in the new file:

    ,        detail3: 'amount_formatted'

    Replace it with the following code:

    ,       detail3: 'total_formatted'

Step 2. Prepare the Developer Tools for Your Overrides

  1. Create an ns.package.json file in each of the following directories:

    • CreditMemoExtension@1.0.0

    • InvoiceExtension@1.0.0

    • OrderWizard.Module.CartItemsExtension@1.0.0

    • OrderWizard.Module.ShipmethodExtension@1.0.0

    • QuoteExtension@1.0.0

    • ReturnAuthorizationExtension@1.0.0

  2. In each ns.package.json file, enter the following code, where <module name> is the name of the module you are overriding and <file name> is the name of the JavaScript file that contains the overridden JavaScript code:

    {
        "gulp": {
            "javascript": [
                "JavaScript/*"
            ],
        }
       "overrides": {
            "suitecommerce/<module name>@X.Y.Z/JavaScript/<file name>" :
            "extensions/[JavaScript|SuiteScript]/<file name>",
       }   
    }
  3. Update the distro.json file in the root directory with the following code for each of the modules you are overriding:

    Your code should look similar to the following example:

      ...
      },   
      "extensions/CreditMemoExtension" : "X.Y.Z",
      "extensions/InvoiceExtension" :  "X.Y.Z" 
      "extensions/OrderHistoryExtension" :  "X.Y.Z" 
      "extensions/OrderWizard.Module.CartItems.Extension" :  "X.Y.Z" 
      "extensions/OrderWizard.Module.CartItems.Extension" :  "X.Y.Z" 
      "extensions/QuoteExtension" :  "X.Y.Z" 
      "extensions/ReturnAuthorizationExtension" :  "X.Y.Z" 
      "extensions/MyExampleCartExtension1": "1.0.0",     
      ...
        

    X.Y.Z  represents the version of the module in your implementation of SuiteCommerce Advanced.

Step 3. Test and Deploy Your Override

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

  2. Confirm your results. The prices in the Shopping Cart now correctly match the prices in the Order Summary.