skip to Main Content

I want to add a new product in my new Magento 2.3.3 webshop. When I upload a product image on this page, I see this:

https://i.stack.imgur.com/RUoPM.png

I looks like it would upload an other image, but I selected just 1.

Next, I will save the product but it isn’t possible (I press the button, but nothing happens)

When I look in my console from my browser I get the following error:

product-gallery.js:138 Uncaught TypeError: Cannot read property 'value' of undefined
at product-gallery.js:138
at Function.grep (jquery.js:471)
at $.<computed>.<computed>.setBase (product-gallery.js:133)
at $.<computed>.<computed>.setBase (jquery-ui-1.9.2.js:432)
at $.<computed>.<computed>._addItem (product-gallery.js:217)
at $.<computed>.<computed>._addItem (jquery-ui-1.9.2.js:432)
at HTMLDivElement.handlerProxy (jquery-ui-1.9.2.js:739)
at HTMLDivElement.dispatch (jquery.js:5232)
at HTMLDivElement.elemData.handle (jquery.js:4884)
at Object.trigger (jquery.js:5136)

This is line 138 in product-gallery.js

setBase: function (imageData) {
        var baseImage = this.options.types.image,
            sameImages = $.grep(
                $.map(this.options.types, function (el) {
                    return el;
                }),
                function (el) {
                    return el.value === baseImage.value; #LINE 138
                }
            ),
            isImageOpened = this.findElement(imageData).hasClass('active');

        $.each(sameImages, $.proxy(function (index, image) {
            this.element.trigger('setImageType', {
                type: image.code,
                imageData: imageData
            });

            if (isImageOpened) {
                this.element.find('.item').addClass('selected');
                this.element.find('[data-role=type-selector]').prop({
                    'checked': true
                });
            }
        }, this));
    },

2

Answers


  1. are you using any custom module? anyway Try to redeploy static content.
    Connect server via SSH and goto magento root directory. Run the following command (I prefer this way.)

    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    php bin/magento setup:static-content:deploy -f
    php bin/magento indexer:reindex
    php bin/magento cache:clean
    
    Login or Signup to reply.
  2. I have also faced the same issue check your attributes code (Base ,Swatch, Thumbnail, Small) for image is there or not.In my case these attributes were deleted.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search