I have an an error on some but not all product view pages. Does anyone have an idea what the problem is?

<img id="image-0"
Fatal error: Undefined class constant 'XML_NODE_PRODUCT_BASE_IMAGE_WIDTH'     
in /var/www/vhosts/thesite.com/app/code/core/Mage/Catalog/Block/Product/View/Media.php on line 87

At that line is

$size = Mage::getStoreConfig(Mage_Catalog_Helper_Image::XML_NODE_PRODUCT_BASE_IMAGE_WIDTH);

There is a value of 1800 saved in System->Configuration->Catalog->Product Image->Base Image Width

  • Did you recently perform a version upgrade or is this a fresh CE installation?
    – mam08ixo
    Apr 24 '15 at 8:58
  • It's a fresh install, but I am using data from a 1.8 site. I copied over the rwd files into a custom theme but have not changed the product view pages.
    – Mchl
    Apr 24 '15 at 9:00

You performed an incomplete upgrade, that's why the constant XML_NODE_PRODUCT_BASE_IMAGE_WIDTH cannot be resolved.

  • The Mage_Catalog_Block_Product_View_Media class that uses the constant is up to date.
  • The Mage_Catalog_Helper_Image class that should provide the constant is on a prior version.

Make sure all core classes are up to date by running a diff between your installation and the target version (most likely a fresh CE download).

The RWD theme uses CE 1.9 functionality, primarily provided by block classes. If you insist or are forced to keep the CE 1.8 version, you will have to go the hard long way of re-implementing every single functionality (in the chain of dependencies) that the RWD theme expects to be there.

At the time of writing, I do not know of CE 1.8 backports.

  • I've run Meld on the core folder on both a fresh install and my current installation. No differences are noticed. The core/mage/catalog/Image.php file is the same one that came with the 1.9 download (same modification time)
    – Mchl
    Apr 24 '15 at 9:25
  • So you say that Mage_Catalog_Helper_Image::XML_NODE_PRODUCT_BASE_IMAGE_WIDTH actually does exist?
    – mam08ixo
    Apr 24 '15 at 9:28
  • 1
    What happened was that although I had the correct 1.9 file in code/core, I also had the file in code/local which was overriding it that I didn't expect. So I removed that one.
    – Mchl
    May 20 '15 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.