Clearing Cache In Magento Removes The Cart
我继承了一个Magento项目,只需要更改两个配置变量的值,这两个支付URL都在表core_config_data中。
我这样做很轻松,但是在加载付款按钮页面时,旧值仍然存在。 然后,我尝试通过运行以下命令清除缓存:
1 2 3 4 5 | $mage_filename = 'app/Mage.php'; require_once $mage_filename; umask(0); Mage::run(); Mage::app()->cleanCache(); |
现在,到购物车的链接已从主UI中消失。 尝试将商品添加到购物车时,我还会收到404。 显示产品页面时,我收到以下错误消息:
1 | 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+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 1: parser error : XML declaration allowed only at the
start of the document in /var/www/magento1/lib/Varien/Simplexml/Config.php on line 5102014-03-12T06:15:28+00:00 ERR (3): Warning: simplexml_load_string(): in /var/www/magento1/lib/Varien/Simplexml/Config.php on line 510
2014-03-12T06:15:28+00:00 ERR (3): Warning: simplexml_load_string(): ^ in /var/www/magento1/lib/Varien/Simplexml/Config.php on line 510
打开/var/www/magento1/lib/Varien/Simplexml/Config.php,导航到第510行并修改loadString函数,使其看起来像这样:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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?