开发者

Fatal Error when loading Catalog-settings in backend

开发者 https://www.devze.com 2023-02-13 22:51 出处:网络
On a fresh 1.5.0.1 Magento install when choosing Catalog from the settings->settings menu I get the following error:

On a fresh 1.5.0.1 Magento install when choosing Catalog from the settings->settings menu I get the following error:

Fatal error: Undefined class constant 'RANGE_CALCULATION_AUTO' in /my-install-dir/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Price/Step.php on lin开发者_运维问答e 33

Checked Step.php and it does not look damaged and contains the following:

class Mage_Adminhtml_Model_System_Config_Source_Price_Step
{

    public function toOptionArray()
    {
        return array(
            array(
               'value' => Mage_Catalog_Model_Layer_Filter_Price::RANGE_CALCULATION_AUTO,
               'label' => Mage::helper('adminhtml')->__('Automatic')
            ),
            array(
                'value' => Mage_Catalog_Model_Layer_Filter_Price::RANGE_CALCULATION_MANUAL,
                'label' => Mage::helper('adminhtml')->__('Manual')
            ),
        );
    }

}`

Anyone know this error or how to fix it?


PHP is complaining that it can't find the constant on RANGE_CALCULATION_AUTO defined on the class Mage_Catalog_Model_Layer_Filter_Price

Based on your comments above, it sounds like you already checked the file at

app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php

to ensure is had the correct constant defined.

const RANGE_CALCULATION_AUTO    = 'auto';

Based on that, my guess would be there's a different Price.php being loaded for this class. This can happen if

  1. Someone's placed a different version in community or local

  2. Someone's monkied with the include path beyond Magento's normal monkey business

Check for files at

app/community/core/Mage/Catalog/Model/Layer/Filter/Price.php
app/local/core/Mage/Catalog/Model/Layer/Filter/Price.php

If that doesn't work, add some temporary debugging code to

app/code/core/Mage/Adminhtml/Model/System/Config/Source/Price/Step.php

that uses reflection to figure out what file PHP is loading the class from

class Mage_Adminhtml_Model_System_Config_Source_Price_Step
{

    public function toOptionArray()
    {
        //NEW LINES HERE
        $r = new ReflectionClass('Mage_Catalog_Model_Layer_Filter_Price');
        var_dump($r->getFileName());
        //echo $r->getFileName(); // if too long for var_dump
        exit("Bailing at line ".__LINE__." in ".__FILE__);
        //END NEW LINES
        return array(
            array(
               'value' => Mage_Catalog_Model_Layer_Filter_Price::RANGE_CALCULATION_AUTO,
               'label' => Mage::helper('adminhtml')->__('Automatic')
            ),
            array(
                'value' => Mage_Catalog_Model_Layer_Filter_Price::RANGE_CALCULATION_MANUAL,
                'label' => Mage::helper('adminhtml')->__('Manual')
            ),
        );
    }

}`      

This will dump out a file path that points to the exact place PHP is loading the class from, which should get you where you need to go.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号