在Magento中清除缓存删除了购物车

时间:2013-11-28 07:57:58

标签: php magento caching

我继承了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

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

2 个答案:

答案 0 :(得分:0)

听起来你错过了服务器重写规则(.htaccess,如果你使用的是apache)。

你在哪个版本的Magento上?

答案 1 :(得分:0)

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

然后,如果您发现类似这样的错误:

  

2014-03-12T06:15:28 + 00:00 ERR(3):警告:simplexml_load_string():实体:第1行:解析器错误:仅在   第510行的/var/www/magento1/lib/Varien/Simplexml/Config.php中的文档开头

     

2014-03-12T06:15:28 + 00:00 ERR(3):警告:simplexml_load_string():位于第510行的/var/www/magento1/lib/Varien/Simplexml/Config.php

     

2014-03-12T06:15:28 + 00:00 ERR(3):警告:simplexml_load_string():^位于第510行的/var/www/magento1/lib/Varien/Simplexml/Config.php

打开/var/www/magento1/lib/Varien/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。