1

I want to add the custom option to upload files so my clients can add pictures or files to their respective products. This is working fine.

When I try to retrieve the files, this becomes an issue and I get 500 error like this:

[Mon Feb 06 10:52:33 2012] [error] [client x.x.x.x] PHP Fatal error:  Undefined class constant ‘OPTION_PREFIX’ in /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Sales/controllers/DownloadController.php on line 160, referer: https://www.domain.com/index.php/admin/sales_order/view/order_id/15/key/3f88d86de2532ab233077d978054dfe2/

Has anybody had anything like this before? Please suggest a solution.

2
  • Looking for a year? :0 - Provide your version of Magento at the very least, otherwise line 160 could be anything. Mar 7, 2013 at 10:11
  • Sorry sonasi, I have version 1.7.0.2 and still does the same thing.
    – jsjc
    Mar 8, 2013 at 9:19

2 Answers 2

0

The constant OPTION_PREFIX is declared on the Mage_Catalog_Model_Product_Type_Abstract class in CE 1.7 and newer. Based on the results of searching with ack OPTION_PREFIX on the CLI, the term does not exist nor is referenced in older versions of Magento.

Would I be correct to surmise that your installation used to be running an older version of Magento and has been upgraded to CE 1.7?

My suggestion would be to verify that the constant is defined in the class declaration found in app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php. Assuming it is, I would go looking for a copy of that class that is overriding the core file, like say, a file in the local code pool which overrides the core class declaration with a copy of the class from an older version of Magento.

2
  • 1
    I bet there is a overwrite in app/code/local/Mage Mar 7, 2013 at 14:52
  • 1
    Yes! that was the problem... I dont know how that file came up to be ther tho.. I wil make a .bak just in case but definetly this was the issue. Thanks heaps! definetly very well spotted with the little info that I gave.
    – jsjc
    Mar 8, 2013 at 9:32
1

From your comments and above post by other members I would say that

  1. You have upgraded Magento version or some module you have added is compatible with CE 1.7 so first you need to make out whether your Magento version was upgraded.

  2. Second thing you will have to check is that your Mage_Catalog_Model_Product_Type_Abstract is this copy also in local/mage/ folder. If case 2 exist then copy in ;local/mage folder will be considered by Magento code and this being a copy from a precious version does not have the stated constant ‘OPTION_PREFIX’.

  3. Also in case compiler was set to on check for a copy of this class code where all class files are placed /includes/src.

Make sure that Mage_Catalog_Model_Product_Type_Abstract class code from 1.7 is there.

Also in case you have a Mage folder in local folder(some developers just overwrite rather then extend) then better would be to create a customer module and extend Magento core class modules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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