Get error while editing Customers from back end in

2019-06-07 06:41发布

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.

There has been an error processing your request.

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?

8条回答
狗以群分
2楼-- · 2019-06-07 07:04

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
查看更多
祖国的老花朵
3楼-- · 2019-06-07 07:07

Struggling with the same kind of problem here. So i've tried it on a clean install of Magento 1.6.1.0 and the following happens.

  1. Create customer at frontend
  2. record in table "Customer Entity" contains column created_at with value = 2011-12-15 10:14:45
  3. In admin > customer > manage customers > edit customer and click save
  4. record in table "Customer Entity" value of *created_at* changed to 2015-12-11 00:00:00
查看更多
登录 后发表回答