在后端加载目录设置时出现致命错误

发布于 2024-10-19 11:40:30 字数 891 浏览 1 评论 0原文

在全新的 1.5.0.1 Magento 安装中,当从设置 -> 设置菜单中选择目录时,出现以下错误:

致命错误:未定义类常量“RANGE_CALCULATION_AUTO” /my-install-dir/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Price/Step.php 第 33 行

检查 Step.php 它看起来没有损坏,并包含以下内容:

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')
            ),
        );
    }

}`

有人知道这个错误或如何修复它吗?

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 line 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

埖埖迣鎅 2024-10-26 11:40:30

PHP 抱怨它找不到在类 Mage_Catalog_Model_Layer_Filter_Price 上定义的 RANGE_CALCULATION_AUTO 常量

根据您上面的评论,听起来您已经检查了该文件

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

以确保定义了正确的常量。

const RANGE_CALCULATION_AUTO    = 'auto';

基于此,我的猜测是为此类加载了一个不同 Price.php。如果

  1. 有人在社区本地本地中放置

  2. 有人使用了 Magento 正常猴子业务之外的包含路径

检查文件

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

如果这不起作用,请添加一些临时文件调试代码

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

使用反射来找出 PHP 正在从哪个文件加载类。

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')
            ),
        );
    }

}`      

这将转储出一个文件路径,该文件路径指向 PHP 加载类的确切位置,这应该可以让您到达需要去的地方。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文