Note: This is a historical reference, not a current security baseline. Magento 1 is end-of-life.

Any attempt to edit product at Catalog > Manage Products in Magento backend results in a blank page and logs the following fatal error after SUPEE-8788 patch or Magento upgrade:

Fatal error: Undefined class constant 'XML_NODE_PRODUCT_MAX_DIMENSION' in
app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml
 on line 111

Cause

XML_NODE_PRODUCT_MAX_DIMENSION constant used in the new app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml is defined in app/code/core/Mage/Catalog/Helper/Image.php with SUPEE-8788 applied:
--- app/code/core/Mage/Catalog/Helper/Image.php
+++ app/code/core/Mage/Catalog/Helper/Image.php
@@ -31,6 +31,8 @@
  */
 class Mage_Catalog_Helper_Image extends Mage_Core_Helper_Abstract
 {
+    const XML_NODE_PRODUCT_MAX_DIMENSION = 'catalog/product_image/max_dimension';

As the error says it can not find the constant definition, which may be possible due to one of the following reasons:
  • app/code/core/Mage/Catalog/Helper/Image.php is overridden with a local copy in app/code/local/Mage/Catalog/Helper/Image.php or app/code/community/Mage/Catalog/Helper/Image.php
  • Magento Compiler is enabled and compiler cache was not cleared after SUPEE-8788 patch installation or upgrade
  • PHP OpCode cache is in use

Solution

  • Check if XML_NODE_PRODUCT_MAX_DIMENSION is defined in app/code/core/Mage/Catalog/Helper/Image.php:
    $ grep XML_NODE_PRODUCT_MAX_DIMENSION app/code/core/Mage/Catalog/Helper/Image.php 
        const XML_NODE_PRODUCT_MAX_DIMENSION = 'catalog/product_image/max_dimension';
            $maxDimension = Mage::getStoreConfig(self::XML_NODE_PRODUCT_MAX_DIMENSION);
    
    Re-apply SUPEE-8788 patch if you see empty output.
  • Check if there are local overrides in app/code/local/Mage/Catalog/Helper/Image.php or app/code/community/Mage/Catalog/Helper/Image.php:
    $ ls -la app/code/{local,community}/Mage/Catalog/Helper/Image.php
    
    Apply corresponding changes from SUPEE-8788 to any local overrides as well if there are any.
  • Disable Magento Compiler or clear Compiler cache
  • Flush PHP OpCode cache


If you have any difficulties with solving this problem or got a similar one, please let us know in comments below, so we can find the solution together.

Comments

Archived discussion

  1. rudi vo Ballmoos

    In my case it seems to work with just replacing the file “app/code/core/Mage/Catalog/Helper/Image.php” from SUPEE-8788. Apparently, I don’t have any overrides.

    What did you mean with “Re-apply SUPEE-8788 patch if you see empty output.” ? Re-apply the whole patch or just this file?

    MageReport.com shows me that SUPEE-8788 is already patched.

    Thanks a lot for your amazing site !

  2. rudi vo Ballmoos

    I just replaced “app/code/core/Mage/Catalog/Helper/Image.php” with the file from SUPEE-8788. Now it works. Do i need to do something else?

    SUPEE 8788 was already installed 2016.

    Thanks for your amazing work !

    1. magentary
      If you have to replace core file and already have SUPEE 8788 applied already, it means that either SUPEE 8788 was not applied completely (at least to that core file) or changes were rolled back recently due to some reason (i.e. upgrade or any other installation/deployment). I would suggest to find a reason why changes were rolled back or check other files from SUPEE-8788 as well.
      1. rudi vo Ballmoos
        Thank you for the answer. I don’t know why the core file was changed. Magereport recognizes Supee 8788 as successfully installed. If I reinstall all files from the SUPEE 8788 I am not sure that other updates will be affected. So far I have compared all files individually in notepad++. Is it possible to do this with less effort?