清除Magento中的缓存删除购物车


Clearing Cache In Magento Removes The Cart

我继承了一个Magento项目,只需要更改两个配置变量的值,这两个变量都是core_config_data表中的支付URL。

我做得很容易,但在加载支付按钮页面时,旧的值仍然存在。然后我尝试通过运行以下程序来清除缓存:

$mage_filename = 'app/Mage.php';
require_once $mage_filename;
umask(0);
Mage::run();
Mage::app()->cleanCache();

现在,购物车的链接已从主UI中消失。当我尝试将物品添加到购物车时,我也会得到404。当显示产品页面时,我收到以下错误消息:

Fatal error: Call to a member function addExcludeProductFilter() on a non-object in /home/rcspaces/public_html/shop/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php on line 61

请提供您可能需要帮助恢复的任何建议。谢谢

在magento、apache、系统日志和异常日志中打开所有日志文件。您的一个xml文件可能已损坏。

然后,如果你注意到这样一个错误:

2014-03-12T06:15:28+000:00 ERR(3):警告:simplexml_load_string():实体:第1行:语法分析器错误:只允许在文档的起始位置为/var/www/magento1/lib/Varian/Simplexml/Config.php中的第510行

2014-03-12T06:15:28+000:00 ERR(3):警告:simplexml_load_string():在/var/www/magento1/lib/Varian/simplexml/Config.php中的510 行

2014-03-12T06:15:28+000:00 ERR(3):警告:simplexml_load_string():^in/var/www/magento1/lib/Varialen/simplexml/Config.php on line 510

打开/var/www/magento1/lib/Varian/Simplexml/Config.php,导航到第510行并修改loadString函数,如下所示:

public function loadString($string)
    {
        if (is_string($string)) {

            $xml = simplexml_load_string($string, $this->_elementClass);
            if ($xml instanceof Varien_Simplexml_Element) {
                $this->_xml = $xml;
                return true;
            } else {
            Mage::log($string);
            }
        } else {
            Mage::logException(new Exception('"$string" parameter for simplexml_load_string is not a string'));
        }
        return false;
    }

然后,清除缓存(可以使用'rm-rf/var/www/magento1/var/cache/'unix命令)并再次检查系统日志。您应该看到损坏的xml文件的内容。修复它与香草的magento文件相比,你应该是好的。我损坏的xml是/var/www/magento1/app/code/core/Mage/Checkout/etc/config.xml当我在这里复制错误时。

一旦这起作用,请确保从您之前修改的Config.php文件中删除带有Mage::log($string)的else。

听起来好像缺少服务器重写规则(如果使用apache,则为.htaccess)。

你在看什么版本的Magento?