Published: January 20, 2019
Last updated:

Undefined class constant ‘XML_NODE_PRODUCT_MAX_DIMENSION’ in app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml on line 111

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.

Posted in: Fatal errors

38 votes, 4.83 avg. rating (95% score)