Question

After installation Patch SUPEE-8788 in my Magento 1.7.0.2 I have an error when I try to edit the product:

Fatal error: Call to a member function getUploaderConfig() on a non-object in /var/www/html/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php on line 56

Was it helpful?

Solution

Fixed - Image Upload issue after PATCH 8788 install of Magento version CE 1.7.0.2 - 1.9.2.4.

I was able to fix it,Please Follow following instruction.

Step >> 1: After installed security patch 8788 successfully, Please go to admin panel and flush all Magento cache. Then Logout your Admin Panel and Relogin to Admin Panel.

Step >> 2: Go to Index Management and select all reindex all data after flush all Magento cache once again.

Step >> 3: This very Important step, Delete your browser cache(Ctrl+shift+Delete) history clear all browsing data from browser including cookies.

Step >> 4: Go to Catalog >> Product Management , add new image of any product,now you can see everything work fine.

OTHER TIPS

Details about the problem

SUPEE-8788 replaces the old flash uploader with a new uploader system that sits in Mage/Uploader module.

By default 1.7.0.2 has got the following code in app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php

$this->setChild('uploader',
    $this->getLayout()->createBlock('adminhtml/media_uploader')
);
$this->getUploader()->getConfig()
    ->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/catalog_product_gallery/upload'))
    ->setFileField('image')
    ->setFilters(array(
        'images' => array(
            'label' => Mage::helper('adminhtml')->__('Images (.gif, .jpg, .png)'),
            'files' => array('*.gif', '*.jpg','*.jpeg', '*.png')
        )
    ));

SUPEE-8788 replaces it with:

$this->setChild('uploader',
    $this->getLayout()->createBlock($this->_uploaderType)
);
$this->getUploader()->getUploaderConfig()
    ->setFileParameterName('image')
    ->setTarget(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/catalog_product_gallery/upload'));

$browseConfig = $this->getUploader()->getButtonConfig();
$browseConfig
    ->setAttributes(array(
        'accept' => $browseConfig->getMimeTypesByExtensions('gif, png, jpeg, jpg')
    ));

Debugging the issue

According to the error you're getting, SUPEE-8788 was properly applied as your code is trying to call getUploaderConfig which is a new method introduced by the patch.

This method is called on getUploader() which returns $this->getChild('uploader');

This child corresponds to the child set at the beginning of the _prepareLayout method:

$this->setChild('uploader',
    $this->getLayout()->createBlock($this->_uploaderType)
);

In the case of this class, $this->_uploaderType is defined at the top:

protected $_uploaderType = 'uploader/multiple';

So the first thing I would check is to ensure that this file is available in your system, it should be under app/code/core/Mage/Uploader/Block/Multiple.php

Two possible cases:

  • it's not there. That would be definitely the cause of the problem but as SUPEE-8788 was applied it should be there. Maybe you're using a versioning system and that file was not committed ?
  • it's there. In that case open it and ensure it's not empty or it doesn't look broken.

If that file is there and does not look broken, there's several things you can do:

First, try to see what returns get_class($this->getLayout()->createBlock($this->_uploaderType)) . If it does not return Mage_Uploader_Block_Multiple that means you have another module that is using the uploader class name and thus must be refactored to be compatible with SUPEE-8788.

I know that the No Flash Uploader module has some compatibility issues with SUPEE-8788, see here: https://github.com/openstream/No-Flash-Image-Uploader/issues/18

Then, if you still haven't found any issue, you'll have to check that you don't have some custom adminhtml layout that remove the uploader child, use the following command in app/design/adminhtml/ to try to find out:

grep -ri "uploader" . | grep "layout"

In the list you get try to look for something like <remove name="uploader" />, that would be the cause.

Finally, the last thing that comes to my mind is that you have Compilation enabled and you did not recompile after applying the patch. To do so, go to System > Tools > Compilation and recompile.

Every time you install the patches, check the correctness of the file permissions.

example: sudo chown www-data:www-data magento-folder
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top