September 2018
Beginner to intermediate
218 pages
4h 27m
English
Extending UI/KnockoutJS components is a process similar to extending the jQuery widgets. Let's for a moment assume we have the Magelicious_Jsco2 module that wants to override our popularProducts component.
The way to do it would be to add the proper mapping under the map key of our <MODULE2_DIR>/view/frontend/requirejs-config.js file:
var config = { map: { '*': { popularProducts: 'Magelicious_Jsco2/js/new-popular-products' } }};
We then create the proper new-popular-products.js file, as follows:
define([ 'jquery', 'Magelicious_Jsco/js/popular-products', 'ko', 'mage/translate', ], function ($, popularProductsComponent, ko, $t) { 'use strict'; return popularProductsComponent.extend({ getTitle: function () ...Read now
Unlock full access