magento 2 Uncaught TypeError: Cannot read property 'version' of undefinedMagento 2.1 Uncaught TypeError: Cannot read property 'replace' of nullUncaught TypeError Porto Theme 2.1.0 Magento 2product quickview not working with infinite scrollUncaught TypeError: Cannot read property 'autocompleteIndex' of undefinedUncaught TypeError: Cannot read property 'nodeName' of undefined in custom js admin panelMagento 2, Cannot read property 'ui' of undefinedHow can I check if my attribute select option has been selected?jQuery UI breaks when clicking on draggable element: “Cannot read property 'defaultView' of undefined”Magento 2: Cannot read property 'dialog' of undefined, 'timepicker' of undefined,'RFC_2822' of undefinedMagento 2.2.5 - Uncaught TypeError: Cannot read property 'dialog' of undefined

Would a primitive species be able to learn English from reading books alone?

What is the meaning of "You've never met a graph you didn't like?"

Are all namekians brothers?

Connection Between Knot Theory and Number Theory

Why does a 97 / 92 key piano exist by Bosendorfer?

Extract substring according to regexp with sed or grep

Is there a POSIX way to shutdown a UNIX machine?

Error in master's thesis, I do not know what to do

What can I do if I am asked to learn different programming languages very frequently?

New Order #2: Turn My Way

How do I prevent inappropriate ads from appearing in my game?

Make a Bowl of Alphabet Soup

A seasonal riddle

Reason why a kingside attack is not justified

Should I warn a new PhD Student?

Why is "la Gestapo" feminine?

Why does the frost depth increase when the surface temperature warms up?

Can you describe someone as luxurious? As in someone who likes luxurious things?

What should be the ideal length of sentences in a blog post for ease of reading?

Reasons for having MCU pin-states default to pull-up/down out of reset

What properties make a magic weapon befit a Rogue more than a DEX-based Fighter?

Do people actually use the word "kaputt" in conversation?

Checking @@ROWCOUNT failing

"Oh no!" in Latin



magento 2 Uncaught TypeError: Cannot read property 'version' of undefined


Magento 2.1 Uncaught TypeError: Cannot read property 'replace' of nullUncaught TypeError Porto Theme 2.1.0 Magento 2product quickview not working with infinite scrollUncaught TypeError: Cannot read property 'autocompleteIndex' of undefinedUncaught TypeError: Cannot read property 'nodeName' of undefined in custom js admin panelMagento 2, Cannot read property 'ui' of undefinedHow can I check if my attribute select option has been selected?jQuery UI breaks when clicking on draggable element: “Cannot read property 'defaultView' of undefined”Magento 2: Cannot read property 'dialog' of undefined, 'timepicker' of undefined,'RFC_2822' of undefinedMagento 2.2.5 - Uncaught TypeError: Cannot read property 'dialog' of undefined













0















I got below error randomly in front-end and when all modal popup not working when below error occurs.
Uncaught TypeError: Cannot read property 'version' of undefined



enter image description here



I have override admin product-gallery.js and its working fine.



requirejs-config.js



var config = 
config:
mixins:
'Magento_Catalog/js/product-gallery':
'Hs_Mageenhancement/js/product-gallery-mixin': true



;


Below is the code of product-gallery-mixin.js and path of js is app/code/Hs/Mageenhancement/view/adminhtml/web/js/product-gallery-mixin.js



define([
'jquery',
'underscore',
'mage/template',
'uiRegistry'
], function($, _, mageTemplate, registry)
'use strict';
return function (widget)
$.widget('mage.productGallery', widget,
/**
* Initializes dialog element.
*/
_initDialog: function ()
var $dialog = $(this.dialogContainerTmpl());

$dialog.modal(
'type': 'slide',
title: $.mage.__('Image Detail'),
buttons: [],

/** @inheritdoc */
opened: function ()
$dialog.trigger('open');
,

/** @inheritdoc */
closed: function ()
$dialog.trigger('close');

);

$dialog.on('open', this.onDialogOpen.bind(this));
$dialog.on('close', function ()
var $imageContainer = $dialog.data('imageContainer');

$imageContainer.removeClass('active');
$dialog.find('#hide-from-product-page').remove();
);

$dialog.on('change', '[data-role=type-selector]', function ()
var parent = $(this).closest('.item'),
selectedClass = 'selected';

parent.toggleClass(selectedClass, $(this).prop('checked'));
);

$dialog.on('change', '[data-role=type-selector]', $.proxy(this._notifyType, this));

$dialog.on('change', '[data-role=visibility-trigger]', $.proxy(function (e)
var imageData = $dialog.data('imageData');

this.element.trigger('updateVisibility',
disabled: $(e.currentTarget).is(':checked'),
imageData: imageData
);
, this));

$dialog.on('change', '[data-role="image-description"]', function (e)
var target = $(e.target),
targetName = target.attr('name'),
desc = target.val(),
imageData = $dialog.data('imageData');

this.element.find('input[type="hidden"][name="' + targetName + '"]').val(desc);

imageData.label = desc;
imageData['label_default'] = desc;

this.element.trigger('updateImageTitle',
imageData: imageData
);
.bind(this));

$dialog.on('change', '[data-role=image-related-tire-price]', $.proxy(function (e)
var target = $(e.target),
targetName = target.attr('name'),
tirePriceQty = target.val(),
imageData = $dialog.data('imageData');

this.element.find('input[type="hidden"][name="' + targetName + '"]').val(tirePriceQty);
, this));

this.$dialog = $dialog;

);
return $.mage.productGallery;

);


Also added popup code into .phtml file.



<script>
require(
[
'jquery',
'Magento_Ui/js/modal/modal'
],
function(
$,
modal
)
var contactOptions =
type: 'popup',
title: $.mage.__('Contact Us'),
responsive: true,
innerScroll: false,
buttons: [
text: $.mage.__('Close'),
class: '',
click: function ()
this.closeModal();

]
;

var contactPopup = modal(contactOptions, $('#contact-popup-mpdal'));
$("#ContactUsModal").on('click',function()
$("#contact-popup-mpdal").modal("openModal");
);

var pricePromiseOptions =
type: 'popup',
title: $.mage.__('Price Match Promise Terms and Conditions'),
responsive: true,
innerScroll: false,
buttons: [
text: $.mage.__('Close'),
class: '',
click: function ()
this.closeModal();

]
;

var pricePromisePopup = modal(pricePromiseOptions, $('#price-promise-popup-mpdal'));
$("#price_promise").on('click',function()
$("#price-promise-popup-mpdal").modal("openModal");
);

var privacyPolicyOptions =
type: 'popup',
title: $.mage.__('Privacy Policy'),
responsive: true,
innerScroll: false,
buttons: [
text: $.mage.__('Close'),
class: '',
click: function ()
this.closeModal();

]
;

var privacyPolicyPopup = modal(privacyPolicyOptions, $('#privacy-policy-popup-mpdal'));
$("#privacy_policy").on('click',function()
$("#privacy-policy-popup-mpdal").modal("openModal");
);

var cookiesPolicyOptions =
type: 'popup',
title: $.mage.__('Cookie Policy'),
responsive: true,
innerScroll: false,
buttons: [
text: $.mage.__('Close'),
class: '',
click: function ()
this.closeModal();

]
;

var cookiesPolicyPopup = modal(cookiesPolicyOptions, $('#cookie-policy-popup-mpdal'));
$("#cookies_policy").on('click',function()
$("#cookie-policy-popup-mpdal").modal("openModal");
);

var termsConditionOptions =
type: 'popup',
title: $.mage.__('Terms and Conditions'),
responsive: true,
innerScroll: false,
buttons: [
text: $.mage.__('Close'),
class: '',
click: function ()
this.closeModal();

]
;

var termsConditionPopup = modal(termsConditionOptions, $('#terms-condition-popup-mpdal'));
$("#TermsCondiModal").on('click',function()
$("#terms-condition-popup-mpdal").modal("openModal");
);


);
</script>


Another popup code as below.



<script>
require(
[
'jquery',
'Magento_Ui/js/modal/modal',
'mage/validation'
],
function(
$,
modal
)
jQuery(document).ready(function()
var options =
type: 'popup',
title: $.mage.__('All Reviews'),
responsive: true,
innerScroll: false,
buttons: [
text: $.mage.__('Close'),
class: '',
click: function ()
this.closeModal();

]
;

var popup = modal(options, $('#list-review-popup-mpdal'));
jQuery("#ListReview").on('click',function()
jQuery("#list-review-popup-mpdal").modal("openModal");
);

var reviewFormOptions =
type: 'popup',
title: $.mage.__('Write a Review'),
responsive: true,
innerScroll: true,
buttons: [
text: $.mage.__('Close'),
class: '',
click: function ()
this.closeModal();

]
;

var reviewFormPopup = modal(reviewFormOptions, $('#submit-review-popup-mpdal'));
jQuery("#SubmitReview").on('click',function()
jQuery("#submit-review-popup-mpdal").modal("openModal");
);

var dataForm = $('#review-form');
dataForm.mage('validation', );
jQuery('body').on('click', '#review-form .action.submit', function(e)
e.preventDefault();
e.stopImmediatePropagation();
if(dataForm.validation('isValid'))
jQuery.ajax(
type: 'post',
url: jQuery('#review-form').attr('action'),
data: jQuery('#review-form').serialize(),
cache: false,
showLoader: 'true',
success: function(response)
var message = response.message;
if(response.success)
jQuery('#feedback_review').removeClass('error-msg');
jQuery('#feedback_review').addClass('Succ-msg');
else
jQuery('#feedback_review').removeClass('Succ-msg');
jQuery('#feedback_review').addClass('error-msg');

jQuery('#feedback_review').html(message).show();

);

return false;
);

);

);
</script>


Is there any issue related to popups?



Please help to resolve issue.










share|improve this question


























    0















    I got below error randomly in front-end and when all modal popup not working when below error occurs.
    Uncaught TypeError: Cannot read property 'version' of undefined



    enter image description here



    I have override admin product-gallery.js and its working fine.



    requirejs-config.js



    var config = 
    config:
    mixins:
    'Magento_Catalog/js/product-gallery':
    'Hs_Mageenhancement/js/product-gallery-mixin': true



    ;


    Below is the code of product-gallery-mixin.js and path of js is app/code/Hs/Mageenhancement/view/adminhtml/web/js/product-gallery-mixin.js



    define([
    'jquery',
    'underscore',
    'mage/template',
    'uiRegistry'
    ], function($, _, mageTemplate, registry)
    'use strict';
    return function (widget)
    $.widget('mage.productGallery', widget,
    /**
    * Initializes dialog element.
    */
    _initDialog: function ()
    var $dialog = $(this.dialogContainerTmpl());

    $dialog.modal(
    'type': 'slide',
    title: $.mage.__('Image Detail'),
    buttons: [],

    /** @inheritdoc */
    opened: function ()
    $dialog.trigger('open');
    ,

    /** @inheritdoc */
    closed: function ()
    $dialog.trigger('close');

    );

    $dialog.on('open', this.onDialogOpen.bind(this));
    $dialog.on('close', function ()
    var $imageContainer = $dialog.data('imageContainer');

    $imageContainer.removeClass('active');
    $dialog.find('#hide-from-product-page').remove();
    );

    $dialog.on('change', '[data-role=type-selector]', function ()
    var parent = $(this).closest('.item'),
    selectedClass = 'selected';

    parent.toggleClass(selectedClass, $(this).prop('checked'));
    );

    $dialog.on('change', '[data-role=type-selector]', $.proxy(this._notifyType, this));

    $dialog.on('change', '[data-role=visibility-trigger]', $.proxy(function (e)
    var imageData = $dialog.data('imageData');

    this.element.trigger('updateVisibility',
    disabled: $(e.currentTarget).is(':checked'),
    imageData: imageData
    );
    , this));

    $dialog.on('change', '[data-role="image-description"]', function (e)
    var target = $(e.target),
    targetName = target.attr('name'),
    desc = target.val(),
    imageData = $dialog.data('imageData');

    this.element.find('input[type="hidden"][name="' + targetName + '"]').val(desc);

    imageData.label = desc;
    imageData['label_default'] = desc;

    this.element.trigger('updateImageTitle',
    imageData: imageData
    );
    .bind(this));

    $dialog.on('change', '[data-role=image-related-tire-price]', $.proxy(function (e)
    var target = $(e.target),
    targetName = target.attr('name'),
    tirePriceQty = target.val(),
    imageData = $dialog.data('imageData');

    this.element.find('input[type="hidden"][name="' + targetName + '"]').val(tirePriceQty);
    , this));

    this.$dialog = $dialog;

    );
    return $.mage.productGallery;

    );


    Also added popup code into .phtml file.



    <script>
    require(
    [
    'jquery',
    'Magento_Ui/js/modal/modal'
    ],
    function(
    $,
    modal
    )
    var contactOptions =
    type: 'popup',
    title: $.mage.__('Contact Us'),
    responsive: true,
    innerScroll: false,
    buttons: [
    text: $.mage.__('Close'),
    class: '',
    click: function ()
    this.closeModal();

    ]
    ;

    var contactPopup = modal(contactOptions, $('#contact-popup-mpdal'));
    $("#ContactUsModal").on('click',function()
    $("#contact-popup-mpdal").modal("openModal");
    );

    var pricePromiseOptions =
    type: 'popup',
    title: $.mage.__('Price Match Promise Terms and Conditions'),
    responsive: true,
    innerScroll: false,
    buttons: [
    text: $.mage.__('Close'),
    class: '',
    click: function ()
    this.closeModal();

    ]
    ;

    var pricePromisePopup = modal(pricePromiseOptions, $('#price-promise-popup-mpdal'));
    $("#price_promise").on('click',function()
    $("#price-promise-popup-mpdal").modal("openModal");
    );

    var privacyPolicyOptions =
    type: 'popup',
    title: $.mage.__('Privacy Policy'),
    responsive: true,
    innerScroll: false,
    buttons: [
    text: $.mage.__('Close'),
    class: '',
    click: function ()
    this.closeModal();

    ]
    ;

    var privacyPolicyPopup = modal(privacyPolicyOptions, $('#privacy-policy-popup-mpdal'));
    $("#privacy_policy").on('click',function()
    $("#privacy-policy-popup-mpdal").modal("openModal");
    );

    var cookiesPolicyOptions =
    type: 'popup',
    title: $.mage.__('Cookie Policy'),
    responsive: true,
    innerScroll: false,
    buttons: [
    text: $.mage.__('Close'),
    class: '',
    click: function ()
    this.closeModal();

    ]
    ;

    var cookiesPolicyPopup = modal(cookiesPolicyOptions, $('#cookie-policy-popup-mpdal'));
    $("#cookies_policy").on('click',function()
    $("#cookie-policy-popup-mpdal").modal("openModal");
    );

    var termsConditionOptions =
    type: 'popup',
    title: $.mage.__('Terms and Conditions'),
    responsive: true,
    innerScroll: false,
    buttons: [
    text: $.mage.__('Close'),
    class: '',
    click: function ()
    this.closeModal();

    ]
    ;

    var termsConditionPopup = modal(termsConditionOptions, $('#terms-condition-popup-mpdal'));
    $("#TermsCondiModal").on('click',function()
    $("#terms-condition-popup-mpdal").modal("openModal");
    );


    );
    </script>


    Another popup code as below.



    <script>
    require(
    [
    'jquery',
    'Magento_Ui/js/modal/modal',
    'mage/validation'
    ],
    function(
    $,
    modal
    )
    jQuery(document).ready(function()
    var options =
    type: 'popup',
    title: $.mage.__('All Reviews'),
    responsive: true,
    innerScroll: false,
    buttons: [
    text: $.mage.__('Close'),
    class: '',
    click: function ()
    this.closeModal();

    ]
    ;

    var popup = modal(options, $('#list-review-popup-mpdal'));
    jQuery("#ListReview").on('click',function()
    jQuery("#list-review-popup-mpdal").modal("openModal");
    );

    var reviewFormOptions =
    type: 'popup',
    title: $.mage.__('Write a Review'),
    responsive: true,
    innerScroll: true,
    buttons: [
    text: $.mage.__('Close'),
    class: '',
    click: function ()
    this.closeModal();

    ]
    ;

    var reviewFormPopup = modal(reviewFormOptions, $('#submit-review-popup-mpdal'));
    jQuery("#SubmitReview").on('click',function()
    jQuery("#submit-review-popup-mpdal").modal("openModal");
    );

    var dataForm = $('#review-form');
    dataForm.mage('validation', );
    jQuery('body').on('click', '#review-form .action.submit', function(e)
    e.preventDefault();
    e.stopImmediatePropagation();
    if(dataForm.validation('isValid'))
    jQuery.ajax(
    type: 'post',
    url: jQuery('#review-form').attr('action'),
    data: jQuery('#review-form').serialize(),
    cache: false,
    showLoader: 'true',
    success: function(response)
    var message = response.message;
    if(response.success)
    jQuery('#feedback_review').removeClass('error-msg');
    jQuery('#feedback_review').addClass('Succ-msg');
    else
    jQuery('#feedback_review').removeClass('Succ-msg');
    jQuery('#feedback_review').addClass('error-msg');

    jQuery('#feedback_review').html(message).show();

    );

    return false;
    );

    );

    );
    </script>


    Is there any issue related to popups?



    Please help to resolve issue.










    share|improve this question
























      0












      0








      0








      I got below error randomly in front-end and when all modal popup not working when below error occurs.
      Uncaught TypeError: Cannot read property 'version' of undefined



      enter image description here



      I have override admin product-gallery.js and its working fine.



      requirejs-config.js



      var config = 
      config:
      mixins:
      'Magento_Catalog/js/product-gallery':
      'Hs_Mageenhancement/js/product-gallery-mixin': true



      ;


      Below is the code of product-gallery-mixin.js and path of js is app/code/Hs/Mageenhancement/view/adminhtml/web/js/product-gallery-mixin.js



      define([
      'jquery',
      'underscore',
      'mage/template',
      'uiRegistry'
      ], function($, _, mageTemplate, registry)
      'use strict';
      return function (widget)
      $.widget('mage.productGallery', widget,
      /**
      * Initializes dialog element.
      */
      _initDialog: function ()
      var $dialog = $(this.dialogContainerTmpl());

      $dialog.modal(
      'type': 'slide',
      title: $.mage.__('Image Detail'),
      buttons: [],

      /** @inheritdoc */
      opened: function ()
      $dialog.trigger('open');
      ,

      /** @inheritdoc */
      closed: function ()
      $dialog.trigger('close');

      );

      $dialog.on('open', this.onDialogOpen.bind(this));
      $dialog.on('close', function ()
      var $imageContainer = $dialog.data('imageContainer');

      $imageContainer.removeClass('active');
      $dialog.find('#hide-from-product-page').remove();
      );

      $dialog.on('change', '[data-role=type-selector]', function ()
      var parent = $(this).closest('.item'),
      selectedClass = 'selected';

      parent.toggleClass(selectedClass, $(this).prop('checked'));
      );

      $dialog.on('change', '[data-role=type-selector]', $.proxy(this._notifyType, this));

      $dialog.on('change', '[data-role=visibility-trigger]', $.proxy(function (e)
      var imageData = $dialog.data('imageData');

      this.element.trigger('updateVisibility',
      disabled: $(e.currentTarget).is(':checked'),
      imageData: imageData
      );
      , this));

      $dialog.on('change', '[data-role="image-description"]', function (e)
      var target = $(e.target),
      targetName = target.attr('name'),
      desc = target.val(),
      imageData = $dialog.data('imageData');

      this.element.find('input[type="hidden"][name="' + targetName + '"]').val(desc);

      imageData.label = desc;
      imageData['label_default'] = desc;

      this.element.trigger('updateImageTitle',
      imageData: imageData
      );
      .bind(this));

      $dialog.on('change', '[data-role=image-related-tire-price]', $.proxy(function (e)
      var target = $(e.target),
      targetName = target.attr('name'),
      tirePriceQty = target.val(),
      imageData = $dialog.data('imageData');

      this.element.find('input[type="hidden"][name="' + targetName + '"]').val(tirePriceQty);
      , this));

      this.$dialog = $dialog;

      );
      return $.mage.productGallery;

      );


      Also added popup code into .phtml file.



      <script>
      require(
      [
      'jquery',
      'Magento_Ui/js/modal/modal'
      ],
      function(
      $,
      modal
      )
      var contactOptions =
      type: 'popup',
      title: $.mage.__('Contact Us'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var contactPopup = modal(contactOptions, $('#contact-popup-mpdal'));
      $("#ContactUsModal").on('click',function()
      $("#contact-popup-mpdal").modal("openModal");
      );

      var pricePromiseOptions =
      type: 'popup',
      title: $.mage.__('Price Match Promise Terms and Conditions'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var pricePromisePopup = modal(pricePromiseOptions, $('#price-promise-popup-mpdal'));
      $("#price_promise").on('click',function()
      $("#price-promise-popup-mpdal").modal("openModal");
      );

      var privacyPolicyOptions =
      type: 'popup',
      title: $.mage.__('Privacy Policy'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var privacyPolicyPopup = modal(privacyPolicyOptions, $('#privacy-policy-popup-mpdal'));
      $("#privacy_policy").on('click',function()
      $("#privacy-policy-popup-mpdal").modal("openModal");
      );

      var cookiesPolicyOptions =
      type: 'popup',
      title: $.mage.__('Cookie Policy'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var cookiesPolicyPopup = modal(cookiesPolicyOptions, $('#cookie-policy-popup-mpdal'));
      $("#cookies_policy").on('click',function()
      $("#cookie-policy-popup-mpdal").modal("openModal");
      );

      var termsConditionOptions =
      type: 'popup',
      title: $.mage.__('Terms and Conditions'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var termsConditionPopup = modal(termsConditionOptions, $('#terms-condition-popup-mpdal'));
      $("#TermsCondiModal").on('click',function()
      $("#terms-condition-popup-mpdal").modal("openModal");
      );


      );
      </script>


      Another popup code as below.



      <script>
      require(
      [
      'jquery',
      'Magento_Ui/js/modal/modal',
      'mage/validation'
      ],
      function(
      $,
      modal
      )
      jQuery(document).ready(function()
      var options =
      type: 'popup',
      title: $.mage.__('All Reviews'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var popup = modal(options, $('#list-review-popup-mpdal'));
      jQuery("#ListReview").on('click',function()
      jQuery("#list-review-popup-mpdal").modal("openModal");
      );

      var reviewFormOptions =
      type: 'popup',
      title: $.mage.__('Write a Review'),
      responsive: true,
      innerScroll: true,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var reviewFormPopup = modal(reviewFormOptions, $('#submit-review-popup-mpdal'));
      jQuery("#SubmitReview").on('click',function()
      jQuery("#submit-review-popup-mpdal").modal("openModal");
      );

      var dataForm = $('#review-form');
      dataForm.mage('validation', );
      jQuery('body').on('click', '#review-form .action.submit', function(e)
      e.preventDefault();
      e.stopImmediatePropagation();
      if(dataForm.validation('isValid'))
      jQuery.ajax(
      type: 'post',
      url: jQuery('#review-form').attr('action'),
      data: jQuery('#review-form').serialize(),
      cache: false,
      showLoader: 'true',
      success: function(response)
      var message = response.message;
      if(response.success)
      jQuery('#feedback_review').removeClass('error-msg');
      jQuery('#feedback_review').addClass('Succ-msg');
      else
      jQuery('#feedback_review').removeClass('Succ-msg');
      jQuery('#feedback_review').addClass('error-msg');

      jQuery('#feedback_review').html(message).show();

      );

      return false;
      );

      );

      );
      </script>


      Is there any issue related to popups?



      Please help to resolve issue.










      share|improve this question














      I got below error randomly in front-end and when all modal popup not working when below error occurs.
      Uncaught TypeError: Cannot read property 'version' of undefined



      enter image description here



      I have override admin product-gallery.js and its working fine.



      requirejs-config.js



      var config = 
      config:
      mixins:
      'Magento_Catalog/js/product-gallery':
      'Hs_Mageenhancement/js/product-gallery-mixin': true



      ;


      Below is the code of product-gallery-mixin.js and path of js is app/code/Hs/Mageenhancement/view/adminhtml/web/js/product-gallery-mixin.js



      define([
      'jquery',
      'underscore',
      'mage/template',
      'uiRegistry'
      ], function($, _, mageTemplate, registry)
      'use strict';
      return function (widget)
      $.widget('mage.productGallery', widget,
      /**
      * Initializes dialog element.
      */
      _initDialog: function ()
      var $dialog = $(this.dialogContainerTmpl());

      $dialog.modal(
      'type': 'slide',
      title: $.mage.__('Image Detail'),
      buttons: [],

      /** @inheritdoc */
      opened: function ()
      $dialog.trigger('open');
      ,

      /** @inheritdoc */
      closed: function ()
      $dialog.trigger('close');

      );

      $dialog.on('open', this.onDialogOpen.bind(this));
      $dialog.on('close', function ()
      var $imageContainer = $dialog.data('imageContainer');

      $imageContainer.removeClass('active');
      $dialog.find('#hide-from-product-page').remove();
      );

      $dialog.on('change', '[data-role=type-selector]', function ()
      var parent = $(this).closest('.item'),
      selectedClass = 'selected';

      parent.toggleClass(selectedClass, $(this).prop('checked'));
      );

      $dialog.on('change', '[data-role=type-selector]', $.proxy(this._notifyType, this));

      $dialog.on('change', '[data-role=visibility-trigger]', $.proxy(function (e)
      var imageData = $dialog.data('imageData');

      this.element.trigger('updateVisibility',
      disabled: $(e.currentTarget).is(':checked'),
      imageData: imageData
      );
      , this));

      $dialog.on('change', '[data-role="image-description"]', function (e)
      var target = $(e.target),
      targetName = target.attr('name'),
      desc = target.val(),
      imageData = $dialog.data('imageData');

      this.element.find('input[type="hidden"][name="' + targetName + '"]').val(desc);

      imageData.label = desc;
      imageData['label_default'] = desc;

      this.element.trigger('updateImageTitle',
      imageData: imageData
      );
      .bind(this));

      $dialog.on('change', '[data-role=image-related-tire-price]', $.proxy(function (e)
      var target = $(e.target),
      targetName = target.attr('name'),
      tirePriceQty = target.val(),
      imageData = $dialog.data('imageData');

      this.element.find('input[type="hidden"][name="' + targetName + '"]').val(tirePriceQty);
      , this));

      this.$dialog = $dialog;

      );
      return $.mage.productGallery;

      );


      Also added popup code into .phtml file.



      <script>
      require(
      [
      'jquery',
      'Magento_Ui/js/modal/modal'
      ],
      function(
      $,
      modal
      )
      var contactOptions =
      type: 'popup',
      title: $.mage.__('Contact Us'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var contactPopup = modal(contactOptions, $('#contact-popup-mpdal'));
      $("#ContactUsModal").on('click',function()
      $("#contact-popup-mpdal").modal("openModal");
      );

      var pricePromiseOptions =
      type: 'popup',
      title: $.mage.__('Price Match Promise Terms and Conditions'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var pricePromisePopup = modal(pricePromiseOptions, $('#price-promise-popup-mpdal'));
      $("#price_promise").on('click',function()
      $("#price-promise-popup-mpdal").modal("openModal");
      );

      var privacyPolicyOptions =
      type: 'popup',
      title: $.mage.__('Privacy Policy'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var privacyPolicyPopup = modal(privacyPolicyOptions, $('#privacy-policy-popup-mpdal'));
      $("#privacy_policy").on('click',function()
      $("#privacy-policy-popup-mpdal").modal("openModal");
      );

      var cookiesPolicyOptions =
      type: 'popup',
      title: $.mage.__('Cookie Policy'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var cookiesPolicyPopup = modal(cookiesPolicyOptions, $('#cookie-policy-popup-mpdal'));
      $("#cookies_policy").on('click',function()
      $("#cookie-policy-popup-mpdal").modal("openModal");
      );

      var termsConditionOptions =
      type: 'popup',
      title: $.mage.__('Terms and Conditions'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var termsConditionPopup = modal(termsConditionOptions, $('#terms-condition-popup-mpdal'));
      $("#TermsCondiModal").on('click',function()
      $("#terms-condition-popup-mpdal").modal("openModal");
      );


      );
      </script>


      Another popup code as below.



      <script>
      require(
      [
      'jquery',
      'Magento_Ui/js/modal/modal',
      'mage/validation'
      ],
      function(
      $,
      modal
      )
      jQuery(document).ready(function()
      var options =
      type: 'popup',
      title: $.mage.__('All Reviews'),
      responsive: true,
      innerScroll: false,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var popup = modal(options, $('#list-review-popup-mpdal'));
      jQuery("#ListReview").on('click',function()
      jQuery("#list-review-popup-mpdal").modal("openModal");
      );

      var reviewFormOptions =
      type: 'popup',
      title: $.mage.__('Write a Review'),
      responsive: true,
      innerScroll: true,
      buttons: [
      text: $.mage.__('Close'),
      class: '',
      click: function ()
      this.closeModal();

      ]
      ;

      var reviewFormPopup = modal(reviewFormOptions, $('#submit-review-popup-mpdal'));
      jQuery("#SubmitReview").on('click',function()
      jQuery("#submit-review-popup-mpdal").modal("openModal");
      );

      var dataForm = $('#review-form');
      dataForm.mage('validation', );
      jQuery('body').on('click', '#review-form .action.submit', function(e)
      e.preventDefault();
      e.stopImmediatePropagation();
      if(dataForm.validation('isValid'))
      jQuery.ajax(
      type: 'post',
      url: jQuery('#review-form').attr('action'),
      data: jQuery('#review-form').serialize(),
      cache: false,
      showLoader: 'true',
      success: function(response)
      var message = response.message;
      if(response.success)
      jQuery('#feedback_review').removeClass('error-msg');
      jQuery('#feedback_review').addClass('Succ-msg');
      else
      jQuery('#feedback_review').removeClass('Succ-msg');
      jQuery('#feedback_review').addClass('error-msg');

      jQuery('#feedback_review').html(message).show();

      );

      return false;
      );

      );

      );
      </script>


      Is there any issue related to popups?



      Please help to resolve issue.







      jquery magento2.3.0 modal-popup requirejs-config.js console






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 38 mins ago









      Hiren ShahHiren Shah

      4719




      4719




















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266592%2fmagento-2-uncaught-typeerror-cannot-read-property-version-of-undefined%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266592%2fmagento-2-uncaught-typeerror-cannot-read-property-version-of-undefined%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

          Magento 2 disable Secret Key on URL's from terminal The Next CEO of Stack OverflowMagento 2 Shortcut/GUI tool to perform commandline tasks for windowsIn menu add configuration linkMagento oAuth : Generating access token and access secretMagento 2 security key issue in Third-Party API redirect URIPublic actions in admin controllersHow to Disable Cache in Custom WidgetURL Key not changing in Magento 2Product URL Key gets deleted when importing custom options - Magento 2Problem with reindex terminalMagento 2 - bin/magento Commands not working in Cpanel Terminal

          Aasi (pallopeli) Navigointivalikko