Magento企業版,版本1.13.1.0Magento管理屏幕添加新的評論按鈕不工作,並生成一個404錯誤
無法通過管理界面添加一個新產品的意見。當在管理,菜單目錄:評論和評分:客戶評論:所有評論中單擊「添加新評論」按鈕時,Magento會生成異常,然後會顯示404頁面。
這是一個乾淨的Magento安裝,沒有自定義。
關於如何解決這個問題的任何想法?
Magento企業版,版本1.13.1.0Magento管理屏幕添加新的評論按鈕不工作,並生成一個404錯誤
無法通過管理界面添加一個新產品的意見。當在管理,菜單目錄:評論和評分:客戶評論:所有評論中單擊「添加新評論」按鈕時,Magento會生成異常,然後會顯示404頁面。
這是一個乾淨的Magento安裝,沒有自定義。
關於如何解決這個問題的任何想法?
在第74行的塊類app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php中,使用硬編碼的商店代碼「default」調用setStoreFilter()當Magento中沒有代碼爲「default」的商店時出現異常,並且在關閉錯誤頁面時將該用戶轉發到404頁面。
要重現該問題,請在Magento中創建第二個商店和相關商店視圖,將「默認」商店代碼更改爲「mystorecode」,然後轉到管理菜單「目錄>評論和評分>顧客評論>所有評論」並按下「添加新評論」按鈕。
所提出的解決方法是如下:
--- a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php
+++ b/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php
@@ -68,10 +68,13 @@ class Mage_Adminhtml_Block_Review_Rating_Detailed extends Mage_Adminhtml_Block_T
->addRatingOptions();
} elseif (!$this->getIsIndependentMode()) {
+ $default_store = Mage::app()->getWebsite()->getDefaultStore();
$ratingCollection = Mage::getModel('rating/rating')
->getResourceCollection()
->addEntityFilter('product')
- ->setStoreFilter(Mage::app()->getStore('default')->getId())
+ ->setStoreFilter(($default_store)
+ ? $default_store->getId()
+ : Mage_Core_Model_App::ADMIN_STORE_ID)
->setPositionOrder()
->load()
->addOptionToItems();
只需更換:
$ratingCollection = Mage::getModel('rating/rating')
->getResourceCollection()
->addEntityFilter('product')
->setStoreFilter(Mage::app()->getStore('default')->getId())
->setPositionOrder()
->load()
->addOptionToItems();
有:
$default_store = Mage::app()->getWebsite()->getDefaultStore();
$ratingCollection = Mage::getModel('rating/rating')
->getResourceCollection()
->addEntityFilter('product')
->setStoreFilter(($default_store)
? $default_store->getId()
: Mage_Core_Model_App::ADMIN_STORE_ID)
->setPositionOrder()
->load()
->addOptionToItems();
希望這解決了這個問題。
是Magento的團隊解決此問題在新版本中,它們添加以下代碼
->setStoreFilter(Mage::app()->getDefaultStoreView()->getId())
,而不是
->setStoreFilter(Mage::app()->getStore('default')->getId())
我認爲最好的辦法升級的版本
你是天才! – Alexandros
那麼,我必須將我的默認商店代碼始終設置爲「默認」? – Alexandros
當我試圖保存一個新的審查沒有出現!也許它需要更多的修復? – Alexandros