Users Redirected to Checkout Application Instead of Shopping Application

This topic applies to

Applies to

SuiteCommerce Advanced | Elbrus | Kilimanjaro

In some implementations of Elbrus and Kilimanjaro, users who access the Shopping application are redirected to the login page for the Checkout application. The users stay in the Checkout application after they log in. Users should be able to access the Shopping application, log in, and stay in the Shopping application. This error only occurs for websites that have the Password-protect Entire Site field in the Configuration record for the web site enabled.

To implement this patch, you must override Header.Menu.MyAccount() in the Header.Profile.View.js file of the Header module. For an example of the changes needed for this patch, see UsersRedirectedtoCheckoutApp.zip.

Note

In general, NetSuite 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 in a way that you cannot extend, and therefore requires you to use a custom module to override the existing module file. For more information, see Customize and Extend Core SuiteCommerce Advanced Modules.


Note

The instructions to install the patch are the same for either the Elbrus or Kilimanjaro releases.


Step 1: Create the Header.Profile.View.js Override File

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

  2. Open this directory and create a subdirectory to maintain your customizations.

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

    Modules/extensions/Header.Extension@1.0.0

  3. In your new Header.Extension@1.0.0 directory, create a subdirectory called JavaScript:

    Modules/extensions/Header.Extension@1.0.0/JavaScript

  4. Copy the following file:

    Modules/suitecommerce/Header@X.Y.Z/JavaScript/Header.Profile.View.js

    In this example, X.Y.Z represents the version of the module in your implementation of SuiteCommerce Advanced.

  5. Paste a copy in your new module’s JavaScript directory.

    For example: Modules/extensions/Header.Extension@1.0.0/JavaScript/Header.Profile.View.js

  6. Open your new copy of Header.Profile.View.js and locate the following lines in the new file:

    'Header.Menu.MyAccount': function () { return new HeaderMenuMyAccountView(this.options); }
  7. Replace the lines with the following code:

    'Header.Menu.MyAccount': function () { var password_protected_site = SC.ENVIRONMENT.siteSettings.siteloginrequired === 'T'; var profile = ProfileModel.getInstance(); var isLoggedIn = profile.get('isLoggedIn') === 'T'; if (!password_protected_site || isLoggedIn) { return new HeaderMenuMyAccountView(this.options); } else { return null; } }
  8. Save the file.

Step 2: Prepare the Developer Tools For Your Customization

  1. Open the Modules/extensions/Header.Extension@1.0.0 module directory.

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

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

  3. Create a file in this directory and name it ns.package.json.

  4. Build the ns.package.json file using the following code:

    { "gulp": { "javascript": [ "JavaScript/*.js" ] }, "overrides": { "suitecommerce/Header@X.Y.Z/JavaScript/Header.Profile.View.js" : "JavaScript/Header.Profile.View.js" } }

    Important

    You must replace the string X.Y.Z with the version of the module in your implementation of SuiteCommerce Advanced.


  5. In distro.json, add your custom modules to the modules object.

    Your code should look similar to the following example:

    { "name": "SuiteCommerce Advanced Vinson Release", "version": "2.0", "buildToolsVersion": "1.2.1", "folders": { "modules": "Modules", "suitecommerceModules": "Modules/suitecommerce", "thirdPartyModules": "Modules/third_parties", "distribution": "LocalDistribution", "deploy": "DeployDistribution" }, "modules": { "extensions/Header.Extension": "1.0.0", "suitecommerce/Account": "2.2.0", ...

    This 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. 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, users can access the Shopping application and stay there after they log in.

Related Topics