0

This component is located in Magento_Catalog/js/product-gallery

map: {
    '*': {
        categoryForm:       'Magento_Catalog/catalog/category/form',
        newCategoryDialog:  'Magento_Catalog/js/new-category-dialog',
        categoryTree:       'Magento_Catalog/js/category-tree',
        productGallery:     'Magento_Catalog/js/product-gallery',
        baseImage:          'Magento_Catalog/catalog/base-image-uploader',
        productAttributes:  'Magento_Catalog/catalog/product-attributes'
    }
}

I already copied the same file with a different name but when my component runs, it does not work properly like the original one. Official docs mentions to extend it, but i can't make it work successfully
It would be more helpful if the core teams explain more details for me as to how to implement it

0

1 . Initialize js components

var config = {
   "map": {
        '*': {
           "productGallery2": 'Vendor_CustomModule/js/product-gallery'
        }
   },
   "shim": {
       "ves/productGallery2": ["productGallery","baseImage"]
   },
   "deps": [
       "Magento_Catalog/js/product-gallery",
       "Magento_Catalog/catalog/base-image-uploader"
   ],
   "paths": {
       "your_namespace/productGallery2": "Vendor_CustomModule/js/product-gallery"
    }
};

2. Extend widget

define([
'jquery',
'mage/template',
'Magento_Ui/js/modal/alert',
'jquery/ui',
'baseImage',
'mage/translate',
'domReady!'
 ], function (jQuery, mageTemplate, alert) {
"use strict";

jQuery.widget('yourNamespace.productGallery', {
    options: {
        //init vars
    },

    //override original method
    original: function() {
        this._super();
        //modify code
    }

    return jQuery.yourNamespace.productGallery;
});


Clear var/cache, var/generation, pub/static/adminhtml , pub/static/_requirejs for update I got new issues . But better should post it in another question

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.