Technical resource
Undefined class constant 'XML_NODE_PRODUCT_MAX_DIMENSION' in app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml on line 111
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.phpApply 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
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 !
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 !