Thank you for supporting the Cloud Customer Connect Community in 2024. It's a gift to work with you!

Look back
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Getting Undefined error while using extended java script

edited Sep 1, 2020 2:34PM in Commerce 4 comments

Summary

I have extended the java script of product listing style widget. But when I tried to bind the observable from extended js to the template, it is giving error.

Content

I have a standard widget Product listing style widget, I have extended the java script of the same from admin console. Within the extended java script I have created an observable and I am trying to bind that observable to the widget template code. But when I tried that I am getting undefined error in the console. Can you please help me in this.

Code Snippet

//template code

  <span data-bind="text: firstname"></span>

//extended js

/**
 * @fileoverview extendproductListing_v15.js.
 *
 * @author 
 */
define(
  //---------------------
  // DEPENDENCIES
  //---------------------
  ['knockout','viewModels/productListingViewModelFactory','CCi18n','ccConstants', 'pubsub', 'pageLayout/product', 'storageApi', 'ccStoreConfiguration'],

  //-----------------------
  // MODULE DEFINITION
  //-----------------------
  function (ko, ProductListingViewModelFactory, CCi18n, CCConstants, pubsub, Product, storageApi, CCStoreConfiguration) {
      var widgetModal;
           var repositoryId = widget.category().repositoryId;
      console.log("rep id"+repositoryId);

    "use strict";
    return {
       
     // myValue: ko.observable(false),
 

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!