0

Here, I am trying to call _showProductUrls function inside _getCategoryId function. The _getCategoryId function triggered based on click action.

I am getting an error response as "_showProductUrls" is not a function on console.

Also, any idea to implement knockout js functionalities on Product detail Page.

return Component.extend({
    defaults: {
        template: 'companynam_modulename/deviceproduct'
    },

    initialize: function () {
        var self = this;
        this._super();
        this._showCategories();
        this._showProductUrls();
    },
    /**
     * Initializes observable properties.
     *
     * @returns {Column} Chainable.
     */
    initObservable: function () {
        this._super();

        this.observe([
            '_showCategories',
            '_showProductUrls'
        ]);

        return this;
    },

    _showCategories: function() {
        self.categories = JSON.parse(JSON.stringify(this.categories));
     },
     _getCategoryId: function(item) {
        currentCatId = item.id; //selected category id
        this._showProductUrls();
    },
    _showProductUrls: function(){
        var productdetails = JSON.parse(JSON.stringify(this.productUrl));
        self.catProducts = productdetails[currentCatId];  
        return self.catProducts;
     },
     _getProductId: function(item){
        return item[currentCatId];
     }

});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.