Log In to See Prices Message Appears When Users are Logged In

This topic applies to

Applies to

SuiteCommerce Advanced | Elbrus

 

If you use the Log In to See Prices feature on your Elbrus implementation of SuiteCommerce Advanced, you might experience an issue where the application prompts users to log in to see prices even though they have successfully logged into your site.

To correct this issue, apply the patch described here. Due to the nature of this change, the best practice is to override the SC.Configuration.js file. You can download the code samples described in this procedure here: LogInToSeePricesPatch--Elbrus.zip.

Important

These downloadable code samples assume that you have not made any previous customizations to the SC.Configuration.js file. The Override method refers to making changes by replacing the functionality of an entire file with your own custom version. This can potentially introduce errors when you deploy your code. Be aware of any existing customizations to this file and familiarize yourself with the Best Practices for Customizing SuiteCommerce Advanced before overriding any files.


Step 1: Override the SC.Configuration.js File

  1. 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/SCA.Extension@1.0.0/

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

  4. Copy the source SC.Configuration.js file located in Modules > suitecommerce > SCA@x.y.z/JavaScript/ and paste into your new JavaScript directory (where x.y.z represents the version of the module in your implementation of SuiteCommerce Advanced).

    For example, paste your copy of this into the following location:

    Modules/extensions/SCA.Extension@1.0.0/JavaScript/SC.Configuration.js

  5. Open locate the following lines:

    if(entry.placeholder) { entry.text = ''; } entry['class'] = 'header-menu-level' + entry.level + '-anchor';
  6. Replace these lines with the following code:

    if(entry.dataTouchpoint) entry['data-touchpoint']=entry.dataTouchpoint; if(entry.dataHashtag) entry['data-hashtag']=entry.dataHashtag; if(entry.placeholder) { entry.text = ''; } entry['class'] = 'header-menu-level' + entry.level + '-anchor';

    When you are finished, your custom file should include the following code:

    //... // navigation hierarchy bindings. _.each(baseConfiguration.navigationData, function (entry) { if (!entry) { return; } else { if(entry.dataTouchpoint) entry['data-touchpoint']=entry.dataTouchpoint; if(entry.dataHashtag) entry['data-hashtag']=entry.dataHashtag; if(entry.placeholder) { entry.text = ''; } entry['class'] = 'header-menu-level' + entry.level + '-anchor'; } if (entry.parentId) { var parent = _.find(baseConfiguration.navigationData, function (e) { return e.id===entry.parentId; }); parent = parent || {}; parent.categories = parent.categories || []; parent.categories.push(entry); } if (entry.classnames) { entry['class'] += ' ' + entry.classnames; } }); //...
  7. Save the file.

Step 2: Prepare the Developer Tools for Your Override

  1. Open the SCA.Extension@1.0.0 module.

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

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

  3. Build the ns.package.json file using the following code, where x.y.z equals the version of the module you are overriding.

    { "gulp": { "javascript": [ "JavaScript/*.js" ] }, "overrides": { "suitecommerce/SCA@x.y.z/JavaScript/SC.Configuration.js" : "JavaScript/SC.Configuration.js" } }

    Note

    Replace the string x.y.z in the above example with the version of the module in your version of SuiteCommerce Advanced.


  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 module to the modules object to ensure that the Gulp tasks include it when you deploy.

    Your code should look similar to the following example:

    { "name": "SuiteCommerce Advanced Elbrus", "version": "2.0", "buildToolsVersion": "1.3.0", "folders": { "modules": "Modules", "suitecommerceModules": "Modules/suitecommerce", "extensionsModules": "Modules/extensions", "thirdPartyModules": "Modules/third_parties", "distribution": "LocalDistribution", "deploy": "DeployDistribution" }, "modules": { "extensions/SCA.Extension": "1.0.0", "extensions/MyExampleCartExtension1": "1.0.0", //...
  7. Save the file.

Step 3:

  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, the application no longer requests that logged-in users need to log in to see prices.

Related Topics