/** * * SM CartQuickPro - Version 1.4.0 * Copyright (c) 2017 YouTech Company. All Rights Reserved. * @license - Copyrighted Commercial Software * Author: YouTech Company * Websites: http://www.magentech.com */ define(['jquery', 'customModal' , 'mage/dataPost'], function($, customModal){ ;(function($) { function QuickView(element, options) { this.options = $.extend({}, QuickView.Defaults , options); this.$element = $(element); this._plugins = {}; $.each(QuickView.Plugins, $.proxy(function(key, plugin) { this._plugins[key[0].toLowerCase() + key.slice(1)] = new plugin(this); }, this)); this.initialize(); if (this.options.isQuickView){ this.requestQuickView(); if (this.options.isAjaxCart == false){ this.processLink(); } } window.ajaxQuickView = this; } QuickView.Defaults = { isQuickView: false, isAjaxCart: false }; QuickView.Plugins = {}; QuickView.prototype.initialize = function() { $('#smcqp-container').customModal({ autoOpen: false, clickableOverlay: false, innerScroll: true, modalClass: "smcqp-modal-popup", responsive: true, type: 'popup', closed: function() {}, opened: function() {} }); if (this.options.isQuickView){ var that = this; var _product_container = $(this.options.product_container); _product_container.each(function(){ var _self = $(this), _id_product = _self.find('[data-product-id]').attr('data-product-id'); if (typeof _id_product !== 'undefined' && _id_product !== null){ var _url = that.options.base_url+'cartquickpro/catalog_product/view/id/'+_id_product, _button_container = _self.find(that.options.button_container).length ? _self.find(that.options.button_container) : _self, _button = ""+that.options.label_button+""; if ($('.quickview-handler',_button_container).length <= 0){ _button_container.append(_button); } } }); } } QuickView.prototype.setHeightIframe = function(ifr) { var _self = this , _time = 0 , _ifr = document.getElementById('smcqp-iframe'); if (typeof ifr === 'undefined' || ifr === null || typeof _ifr === 'undefined' || _ifr === null) return; var ifr_height = _ifr.getAttribute('height'), _content = _ifr.contentWindow; if (typeof _content === 'undefined' || _content === null || _content.document.body === null) return; var _content_temp = $(_content.document.body).height(); if (typeof _content_temp !== 'undefined') { $('.gallery-placeholder',$(_content.document.body)).trigger('contentUpdate'); if (ifr.height() !== _content_temp){ ifr.height(_content_temp); } } if (_time == 'undefined') _time = 0; clearTimeout(_time); _time = setTimeout(function() { _self.setHeightIframe(ifr); }, 500); }, QuickView.prototype.setHeightQuickview = function(ifr) { var _self = this , _time = 0 , _ifr = document.getElementById('smcqp-iframe'); if (typeof ifr === 'undefined' || ifr === null || typeof _ifr === 'undefined' || _ifr === null) return; var ifr_height = _ifr.getAttribute('height'), _content = _ifr.contentWindow; if (typeof _content === 'undefined' || _content === null || _content.document.body === null) return; var _content_temp = $(_content.document.body).height(); if (typeof _content_temp !== 'undefined') { $('.gallery-placeholder',$(_content.document.body)).trigger('contentUpdate'); if (ifr.height() !== _content_temp){ ifr.height(_content_temp); } } if (_time == 'undefined') _time = 0; clearTimeout(_time); _time = setTimeout(function() { _self.setHeightIframe(ifr); }, 500); }, QuickView.prototype.requestQuickView = function() { var _self = this ; var _handler = $('.quickview-handler'); if (_handler.length){ $('body').off('click', '.quickview-handler').on('click', '.quickview-handler', function(e){ e.preventDefault(); $('#smcqp-container').customModal("openModal"); var self = $(this), _link = self.attr('href'); $(".modal-content").css("overflow-y", "hidden"); $("#smcqp-contents").css("visibility", "hidden"); $("#smcqp-contents").show(); var ifr=$('