问题描述
我突然无处不在开始遇到此错误,需要帮助.
在管理客户"部分中,每当我添加一个新客户时,它都会显示正确的所有值.但是,每当我尝试编辑新添加的客户时,Magento都会显示错误页面.
稍后,当我返回到管理客户"网格时,该客户记录的客户自"列更改为该值"30 Nov -1 01:00:00"
那么,有谁知道那里可能出了什么问题?
这是var/report文件夹中的错误,
a:5:{i:0;s:25:"No date part in '' found.";i:1;s:4432:"#0 /home/wpfsl/public_html/lib/Zend/Date.php(1078): Zend_Date->_calculate('set', false, NULL, 'en_GB')
#1 /home/wpfsl/public_html/lib/Zend/Date.php(197): Zend_Date->set(false, NULL, 'en_GB')
#2 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/Locale.php(478): Zend_Date->__construct(false, NULL, Object(Zend_Locale))
#3 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php(76): Mage_Core_Model_Locale->date(false)
#4 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/customer/tab/view.phtml(36): Mage_Adminhtml_Block_Customer_Edit_Tab_View->getCreateDate()
#5 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...')
#6 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#7 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#8 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#9 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#10 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php(303): Mage_Core_Block_Abstract->toHtml()
#11 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/widget/tabs.phtml(38): Mage_Adminhtml_Block_Widget_Tabs->getTabContent(Object(Mage_Adminhtml_Block_Customer_Edit_Tab_View))
#12 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...')
#13 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#14 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#15 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#16 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#17 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#18 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#19 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#20 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#21 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left')
#22 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...')
#23 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#24 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#25 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#26 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#27 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/Layout.php(529): Mage_Core_Block_Abstract->toHtml()
#28 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(391): Mage_Core_Model_Layout->getOutput()
#29 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/controllers/CustomerController.php(151): Mage_Core_Controller_Varien_Action->renderLayout()
#30 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Adminhtml_CustomerController->editAction()
#31 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('edit')
#32 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#33 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/App.php(347): Mage_Core_Controller_Varien_Front->dispatch()
#34 /home/wpfsl/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#35 /home/wpfsl/public_html/index.php(80): Mage::run('', 'store')
#36 {main}";s:3:"url";s:80:"/index.php/wpfsl_admin/customer/edit/id/11/key/4e2ec034dd470035e31f5f55242e0811/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}
对不起,我还意识到,尽管我编写的代码至少能让我编辑记录而没有任何错误,但仍将客户自"更改为一个随机的日期值,例如30 No -01 01:00:00.
但是,如果我尝试从后端为同样使用magento后端创建的客户创建订单,则会收到以下错误消息
a:5:{i:0;s:825:"Invalid method Mage_Adminhtml_Block_Sales_Order_View_Tab_History::isCustomerNotificationNotApplicable(Array( [0] => Array ( [title] => Pending [notified] => 0 [comment] => [created_at] => Zend_Date Object ( [_locale:Zend_Date:private] => en_GB [_fractional:Zend_Date:private] => 0 [_precision:Zend_Date:private] => 3 [_unixTimestamp:Zend_Date_DateObject:private] => 1323946274 [_timezone:Zend_Date_DateObject:private] => Europe/London [_offset:Zend_Date_DateObject:private] => -3600 [_syncronised:Zend_Date_DateObject:private] => 0 [_dst:protected] => 1 )
))";i:1;s:4197:"#0 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/sales/order/view/tab/history.phtml(38): Varien_Object->__call('isCustomerNotif...', Array) #1 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/sales/order/view/tab/history.phtml(38): Mage_Adminhtml_Block_Sales_Order_View_Tab_History->isCustomerNotificationNotApplicable(Array) #2 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...') #3 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #4 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #5 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #6 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml() #7 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php(303): Mage_Core_Block_Abstract->toHtml() #8 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/widget/tabs.phtml(38): Mage_Adminhtml_Block_Widget_Tabs->getTabContent(Object(Mage_Adminhtml_Block_Sales_Order_View_Tab_History)) #9 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...') #10 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #11 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #12 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #13 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml() #14 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml() #15 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml() #16 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml() #17 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true) #18 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left') #19 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...') #20 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #21 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #22 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #23 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml() #24 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/Layout.php(529): Mage_Core_Block_Abstract->toHtml() #25 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(391): Mage_Core_Model_Layout->getOutput() #26 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(119): Mage_Core_Controller_Varien_Action->renderLayout() #27 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Adminhtml_Sales_OrderController->viewAction() #28 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view') #29 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #30 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/App.php(347): Mage_Core_Controller_Varien_Front->dispatch() #31 /home/wpfsl/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array) #32 /home/wpfsl/public_html/index.php(80): Mage::run('', 'store') #33 {main}";s:3:"url";s:88:"/index.php/wpfsl_admin/sales_order/view/order_id/3/key/148f59cc3e6d14da7c22a004114985cf/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}
再次,我猜想这个错误也与日期因素有关?
这似乎是Magento中的错误,与不同语言环境中的日期格式有关.编辑客户时,created_at字段是可编辑的,并显示在当前语言环境中.对我来说,在英国是DD/MM/YYYY.单击保存"时,它会尝试将此值直接放入数据库中,并失败,因为它不是可接受的数据库格式.
我通过将以下函数添加到Mage_Customer_Model_Form中来解决此问题.更好的解决方案是创建一个类重写.一个更好的解决方案是让Magento传递使用语言环境转换的任何字段,然后将它们转换回iso格式,然后再尝试将其重新插入数据库.如果没有此功能(也许我已经不知道了),就我所知,很可能会再次出现此问题.
public function compactData(array $data)
{
if (array_key_exists('created_at', $data))
{
$data['created_at'] = Mage::app()->getLocale()->date($data['created_at'])->getIso();
}
return parent::compactData($data);
}
多做一些挖掘.我注意到dob字段工作正常.这是因为该字段本身设置有所有正确的位,以指示日期选择器以MM/DD/YYYY格式发送回日期.
似乎Magento已设置为以多种方式处理此问题.在CustomerController中有一个未使用的函数_filterPostData(),该函数调用_filterDates()可以做得比我上面的解决方案更好.
我已更改了使用此功能的修补程序,尽管必须从控制器范围调用此功能.同样,我不建议更改核心代码,但是我的新修补程序在Mage_Adminhtml_CustomerController :: saveAction()中.我添加了以下第二行:
$formData = $customerForm->extractData($this->getRequest(), 'account');
$formData = $this->_filterDates($formData, array('created_at')); /// added this line
I suddenly started encountering this error out of no where and need some help.
In my Manage Customers section, when ever I add a new customer, it shows up fine with all values correct. But whenever I try to edit a newly added customer I get an error page in Magento.
And later when I return to 'Manage Customers' grid, the 'Customer Since' column for that customer record changes to this value "30 Nov -1 01:00:00"
So does any one have any idea what might be going wrong over there?
This is the error in var/report folder,
a:5:{i:0;s:25:"No date part in '' found.";i:1;s:4432:"#0 /home/wpfsl/public_html/lib/Zend/Date.php(1078): Zend_Date->_calculate('set', false, NULL, 'en_GB')
#1 /home/wpfsl/public_html/lib/Zend/Date.php(197): Zend_Date->set(false, NULL, 'en_GB')
#2 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/Locale.php(478): Zend_Date->__construct(false, NULL, Object(Zend_Locale))
#3 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php(76): Mage_Core_Model_Locale->date(false)
#4 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/customer/tab/view.phtml(36): Mage_Adminhtml_Block_Customer_Edit_Tab_View->getCreateDate()
#5 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...')
#6 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#7 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#8 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#9 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#10 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php(303): Mage_Core_Block_Abstract->toHtml()
#11 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/widget/tabs.phtml(38): Mage_Adminhtml_Block_Widget_Tabs->getTabContent(Object(Mage_Adminhtml_Block_Customer_Edit_Tab_View))
#12 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...')
#13 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#14 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#15 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#16 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#17 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#18 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#19 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#20 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#21 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left')
#22 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...')
#23 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#24 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#25 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#26 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#27 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/Layout.php(529): Mage_Core_Block_Abstract->toHtml()
#28 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(391): Mage_Core_Model_Layout->getOutput()
#29 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/controllers/CustomerController.php(151): Mage_Core_Controller_Varien_Action->renderLayout()
#30 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Adminhtml_CustomerController->editAction()
#31 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('edit')
#32 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#33 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/App.php(347): Mage_Core_Controller_Varien_Front->dispatch()
#34 /home/wpfsl/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#35 /home/wpfsl/public_html/index.php(80): Mage::run('', 'store')
#36 {main}";s:3:"url";s:80:"/index.php/wpfsl_admin/customer/edit/id/11/key/4e2ec034dd470035e31f5f55242e0811/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}
Sorry I also realized that though the code I wrote atleast lets me edit my records without any error but still changes the Customer Since to a random date value like 30 No -01 01:00:00.
But also if I try to create an order from the back end for a customer also created using the back end of magento, I get the following error
a:5:{i:0;s:825:"Invalid method Mage_Adminhtml_Block_Sales_Order_View_Tab_History::isCustomerNotificationNotApplicable(Array( [0] => Array ( [title] => Pending [notified] => 0 [comment] => [created_at] => Zend_Date Object ( [_locale:Zend_Date:private] => en_GB [_fractional:Zend_Date:private] => 0 [_precision:Zend_Date:private] => 3 [_unixTimestamp:Zend_Date_DateObject:private] => 1323946274 [_timezone:Zend_Date_DateObject:private] => Europe/London [_offset:Zend_Date_DateObject:private] => -3600 [_syncronised:Zend_Date_DateObject:private] => 0 [_dst:protected] => 1 )
)
))";i:1;s:4197:"#0 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/sales/order/view/tab/history.phtml(38): Varien_Object->__call('isCustomerNotif...', Array) #1 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/sales/order/view/tab/history.phtml(38): Mage_Adminhtml_Block_Sales_Order_View_Tab_History->isCustomerNotificationNotApplicable(Array) #2 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...') #3 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #4 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #5 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #6 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml() #7 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php(303): Mage_Core_Block_Abstract->toHtml() #8 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/widget/tabs.phtml(38): Mage_Adminhtml_Block_Widget_Tabs->getTabContent(Object(Mage_Adminhtml_Block_Sales_Order_View_Tab_History)) #9 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...') #10 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #11 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #12 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #13 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml() #14 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml() #15 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml() #16 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml() #17 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true) #18 /home/wpfsl/public_html/app/design/adminhtml/default/default/template/page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left') #19 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/wpfsl/pub...') #20 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #21 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #22 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #23 /home/wpfsl/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml() #24 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/Layout.php(529): Mage_Core_Block_Abstract->toHtml() #25 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(391): Mage_Core_Model_Layout->getOutput() #26 /home/wpfsl/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(119): Mage_Core_Controller_Varien_Action->renderLayout() #27 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Adminhtml_Sales_OrderController->viewAction() #28 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view') #29 /home/wpfsl/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #30 /home/wpfsl/public_html/app/code/core/Mage/Core/Model/App.php(347): Mage_Core_Controller_Varien_Front->dispatch() #31 /home/wpfsl/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array) #32 /home/wpfsl/public_html/index.php(80): Mage::run('', 'store') #33 {main}";s:3:"url";s:88:"/index.php/wpfsl_admin/sales_order/view/order_id/3/key/148f59cc3e6d14da7c22a004114985cf/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}
Again I am guessing this error has also got something to do with the Date factor?
It seems as though this is a bug in Magento related to the date formats in different locales. When editing a customer the created_at field is editable and displayed in the current locale. For me being in the UK this was DD/MM/YYYY. When clicking save it attempts to put this value directly into the database and fails because its not an acceptable database format.
I have fixed this by adding the following function to Mage_Customer_Model_Form. A much better solution would be to create a class rewrite. An even better solution would be for Magento to pass through any fields which are converted using locale and then convert them back to the iso format before trying to insert these back into the database. Without this feature (and maybe its there already I dont know) this problem is very likely to recur as far as I can see.
public function compactData(array $data)
{
if (array_key_exists('created_at', $data))
{
$data['created_at'] = Mage::app()->getLocale()->date($data['created_at'])->getIso();
}
return parent::compactData($data);
}
EDIT:
Done some more digging. I noticed that the dob field is working fine. This is because the field itself is set up with all the correct bits to tell the datepicker to send back a date in the MM/DD/YYYY format.
It seems Magento is set up to handle this problem in a number of ways. There is an unused function _filterPostData() in the CustomerController which calls _filterDates() which does a better job (I assume) than my solution above.
I have changed my fix to use this function, although it has to be called from the controller scope. Again, I dont advise changing core code, but my new fix is in Mage_Adminhtml_CustomerController::saveAction(). I have added the second of these lines:
$formData = $customerForm->extractData($this->getRequest(), 'account');
$formData = $this->_filterDates($formData, array('created_at')); /// added this line
这篇关于在Magento中从后端编辑客户时遇到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!