Order Confirmation and Thank You Page is Blank

This topic applies to

Applies to

SuiteCommerce Advanced | Mont Blanc | Vinson

In some cases, an Order Confirmation and Thank You page might not appear after a user places an order in your web store. If you experience this issue on your SuiteCommerce Advanced site, perform the following steps to correct the problem.

The suggested action involves extending the LiveOrderModel.js file (within the SuiteScript folder) to overwrite the confirmationCreateResult() method.

In addition to making these changes, you must create an ns.package.json file and update your distro.json file for any custom modules you include. You can download the code samples described in this procedure here: LiveOrderModelThankYouPagePatch.zip.

Step 1: Extend the LiveOrderModel.js File

  1. If you have not done so already, create a directory to store your custom module.

    Following best practices, name this directory extensions and place it in your Modules directory. Depending on your implementation and customizations, this directory might already exist.

  2. Open your extensions directory and create a custom module to maintain your customizations.

    Give this directory a unique name that is similar to the module being customized. For example:

    Modules/extensions/LiveOrder.Extension@1.0.0/

  3. In your new module, create a subdirectory named SuiteScript.

  4. In your SuiteScript subdirectory, create a new JavaScript file.

    Give this file a unique name that is similar to the file being modified. For example:

    Modules/extensions/LiveOrder.Extension@1.0.0/SuiteScript/LiveOrder.Model.Extension.js

  5. Open this file and set it up to overwrite the confirmationCreateResult() method of the LiveOrder.Model.js file.

    Your file should match the following code snippet:

    define( 'LiveOrder.Model.Extension' , [ 'LiveOrder.Model' , 'Utils' , 'underscore' ] , function ( LiveOrderModel , Utils , _ ) { 'use strict'; _.extend(LiveOrderModel.prototype, { confirmationCreateResult: function (placed_order) { var result = { internalid: placed_order.getId() , tranid: placed_order.getFieldValue('tranid') , summary: { subtotal: Utils.toCurrency(placed_order.getFieldValue('subtotal')) , subtotal_formatted: Utils.formatCurrency(placed_order.getFieldValue('subtotal')) , taxtotal: Utils.toCurrency(placed_order.getFieldValue('taxtotal')) , taxtotal_formatted: Utils.formatCurrency(placed_order.getFieldValue('taxtotal')) , shippingcost: Utils.toCurrency(placed_order.getFieldValue('shippingcost')) , shippingcost_formatted: Utils.formatCurrency(placed_order.getFieldValue('shippingcost')) , handlingcost: Utils.toCurrency(placed_order.getFieldValue('althandlingcost')) , handlingcost_formatted: Utils.formatCurrency(placed_order.getFieldValue('althandlingcost')) , discounttotal: Utils.toCurrency(placed_order.getFieldValue('discounttotal')) , discounttotal_formatted: Utils.formatCurrency(placed_order.getFieldValue('discounttotal')) , giftcertapplied: Utils.toCurrency(placed_order.getFieldValue('giftcertapplied')) , giftcertapplied_formatted: Utils.formatCurrency(placed_order.getFieldValue('giftcertapplied')) , total: Utils.toCurrency(placed_order.getFieldValue('total')) , total_formatted: Utils.formatCurrency(placed_order.getFieldValue('total')) } }; result.promocode = (placed_order.getFieldValue('promocode')) ? { internalid: placed_order.getFieldValue('promocode') , name: placed_order.getFieldText('promocode') , code: placed_order.getFieldText('couponcode') , isvalid: true } : null; result.paymentmethods = []; for (var i = 1; i <= placed_order.getLineItemCount('giftcertredemption'); i++) { result.paymentmethods.push({ type: 'giftcertificate' , giftcertificate: { code: placed_order.getLineItemValue('giftcertredemption', 'authcode_display', i) , amountapplied: placed_order.getLineItemValue('giftcertredemption', 'authcodeapplied', i) , amountapplied_formatted: Utils.formatCurrency(placed_order.getLineItemValue('giftcertredemption', 'authcodeapplied', i)) , amountremaining: placed_order.getLineItemValue('giftcertredemption', 'authcodeamtremaining', i) , amountremaining_formatted: Utils.formatCurrency(placed_order.getLineItemValue('giftcertredemption', 'authcodeamtremaining', i)) , originalamount: placed_order.getLineItemValue('giftcertredemption', 'giftcertavailable', i) , originalamount_formatted: Utils.formatCurrency(placed_order.getLineItemValue('giftcertredemption', 'giftcertavailable', i)) } }); } result.lines = []; for (var i = 1; i <= placed_order.getLineItemCount('item'); i++) { result.lines.push({ item: { internalid: placed_order.getLineItemValue('item', 'item', i) // 'item_display' returns the 'sku' or if is a matrix returns 'sku_parent : sku_child' // getLineItemText of 'item_display' returns the same as getLineItemText of 'item' , itemDisplay: placed_order.getLineItemText('item', 'item', i) } , quantity: parseInt(placed_order.getLineItemValue('item', 'quantity', i), 10) , rate: parseInt(placed_order.getLineItemValue('item', 'rate', i), 10) , options: placed_order.getLineItemValue('item', 'options', i) }); } return result; } }); });
  6. Save the file.

Step 2: Prepare the Developer Tools for Your Customizations

  1. Open the LiveOrder.Extension @1.0.0 module.

  2. Create a file in this module and name it ns.package.json.

    Modules/extensions/LiveOrder.Extension@1.0.0/ns.package.json

  3. Build the ns.package.json file using the following code

    { "gulp": { "ssp-libraries": [ "SuiteScript/*.js" ] } }
  4. Save the ns.package.json file.

  5. Open the distro.json file.

    This file is located in the top-level directory of your SuiteCommerce Advanced source code.

  6. Add your custom module to the modules object to ensure that the Gulp tasks include your extension when you deploy.

    Your code should look similar to the following example:

    { "name": "SuiteCommerce Advanced Mont Blanc", "version": "2.0", "buildToolsVersion": "1.1.0", "folders": { "modules": "Modules", "suitecommerceModules": "Modules/suitecommerce", "thirdPartyModules": "Modules/third_parties", "distribution": "LocalDistribution", "deploy": "DeployDistribution" }, "modules": { "extensions/LiveOrder.Extension": "1.0.0", "suitecommerce/Account": "2.1.0", //...
  7. Add LiveOrder.Model.Extension as a dependency to SCA entry point within the ssp-libraries object:

    Your code should look similar to the following example:

    //... "ssp-libraries": { "entryPoint": "SCA", "dependencies": [ "Application", //.. "LiveOrder.Model.Extension" ], //...
  8. Save the distro.json file.

Step 3: Deploy Your Extension

  1. Deploy your customizations to your NetSuite account. See Deploy to NetSuite.

    Note

    Since this patch modifies an SSP library file, changes are not visible in your local environment. SuiteScript files run on the server and must be deployed to NetSuite.


  2. Confirm your results.

    Upon successful deployment, completed orders should result in displaying an Order Confirmation and Thank You page.

Related Topics