magento-configurable-simple icon indicating copy to clipboard operation
magento-configurable-simple copied to clipboard

Magento 1.9.1 Responsive

Open PingusPepan opened this issue 10 years ago • 2 comments

Just a heads up. I installed this plugin and it works just fine, but the images didn't load. The change I did was in the scp_product_extenstion.js. I changed the onComplete() function (line 353) to call only ProductMediaManager.init();

onComplete: function() {
    ProductMediaManager.init();
}

Of course that this is a bad practice, but I only use the new default responsive theme. Hope this helps someone and maybe it can somehow be inserted into the else bracket on line 360 for everyone to use, but I don't really use anything else, thus have no chance to test it out on other themes so no pull request, sorry!

Hope it helps someone, John

PingusPepan avatar Jun 27 '14 13:06 PingusPepan

Thank you.

obigroup avatar Jul 17 '14 11:07 obigroup

I've had a similar problem. After swapping the images the new ElevateZoom isn't initialized.

Quick fix: Check if ProductMediaManager is defiened inside Product.Config.prototype.showFullImageDiv and then init on this object. It is working with my "RWD-Child-Theme". So for the same reasons as PingusPepan no pull request. Hope this is ok for you.

Changed Product.Config.prototype.showFullImageDiv code:

Product.Config.prototype.showFullImageDiv = function(productId, parentId) {
    var imgUrl = this.config.ajaxBaseUrl + "image/?id=" + productId + '&pid=' + parentId;
    var prodForm = $('product_addtocart_form');
    var destElement = false;
    var defaultZoomer = this.config.imageZoomer;
    var rwdZoomer = (ProductMediaManager !== undefined);

    prodForm.select('div.product-img-box').each(function(el) {
        destElement = el;
    });

    //TODO: This is needed to reinitialise Product.Zoom correctly,
    //but there's still a race condition (in the onComplete below) which can break it
    try {if(!rwdZoomer) product_zoom.draggable.destroy();} catch(x) {}

    if(productId) {
        new Ajax.Updater(destElement, imgUrl, {
            method: 'get',
            evalScripts: false,
            onComplete: function() {
                //Product.Zoom needs the *image* (not just the html source from the ajax)
                //to have loaded before it works, hence image object and onload handler
                if ($('image')){
                    var imgObj = new Image();
                    imgObj.onload = function() {
                        if(!rwdZoomer) {
                            product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
                        }else{
                            ProductMediaManager.init()
                        }
                    };
                    imgObj.src = $('image').src;
                } else {
                    destElement.innerHTML = defaultZoomer;
                    if(!rwdZoomer) {
                        product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
                    }else{
                        ProductMediaManager.init()
                    }
                }
          }
        });
    } else {
        destElement.innerHTML = defaultZoomer;
        if(!rwdZoomer) {
            product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
        }else{
            ProductMediaManager.init()
        }
    }
};

hadl avatar Mar 21 '15 11:03 hadl