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 06:43

I am using Magento ve 1.6.1. My getCreateDate() function is exactly as you have mentioned. I don't see a problem there, coz the date does get saved properly when a new customer is created. It only changes when I edit my records.

Found a partial solution. Changing lib/Zend/Date.php with this code lets me edit and save my records fine without giving any error.

isset($parsed['year']) ? (1970 + $parsed['year']) : 1970,
                        false), $this->getUnixTimestamp(), false);

                } catch (Zend_Locale_Exception $e) {

/*-- fix BEGIN --*/Zend_Locale_Format::getDate( ) failed --*/

                    if( !is_numeric( $date ) ) {

                            $parsed = date_parse( $date . ( $locale != "" ? " " . $locale : "" ) );
                            if( $parsed === FALSE ) {
                                    $parsed = array( 'year' => 1970, 'month' => 1, 'day' => 1, 'hour' => 0, 'minute' => 0, 'second' => 0 );
                            }

                            return $this->_assign( $calc, $this->mktime(
                                            $parsed['hour'],
                                            $parsed['minute'],
                                            $parsed['second'],
                                            $parsed['month'],
                                            $parsed['day'],
                                            $parsed['year'], false ),
                                            $this->getUnixTimestamp( ), false );

                    } else {

                            #require_once 'Zend/Date/Exception.php';
                            throw new Zend_Date_Exception( $e->getMessage( ) , 0, $e, $date );
                    }
/*-- fix END --*/

                }

            }

            return $this->_assign($calc, $date, $this->getUnixTimestamp(), false);
            break; 

But when ever I edit any newly added customer record, the Customer Since changes back to 30 Nov -1 01:00:00. So is this is a known bug or what? does any one have any work around this issue?

查看更多
beautiful°
3楼-- · 2019-06-07 06:44

Assuming you're using Magento 1.6.x (you didn't mention the version), lines #3 and #4 of your report

#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()

indicate, that your customers created_at field* does not contain a valid datetime/timestamp:

public function getCreateDate()
{
    $date = Mage::app()->getLocale()->date($this->getCustomer()->getCreatedAtTimestamp());
    return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
}

Note that Mage_Adminhtml_Block_Customer_Edit_Tab_View fails to format an already existing (but invalid) value of the created_at field.

Your real problem is somewhere else, earlier in the records lifecycle.

I'd start off checking whether adding of a new customer really produces valid created_at entries.


*customer_since is only a virtual mapping of created_at .

查看更多
再贱就再见
4楼-- · 2019-06-07 06:51

I have this issue too, but I found the way to change it without any coding.
First of all if you get this error, it is caused by the date setting, Magento 1.6 and EE1.11 started updating their database model to be able to use Oracle and other SQL DB. This is why they need to change the database table type from datetime to timestamp as it can simply be parsed by the database itself. The following is the solution:

  1. Firstly, if you have this error, you need to go to the database to update the customer_entity table. Search the created_at field, if it is empty give it a valid value, I am so shocked that Magento now allows you to edit created_at date in admin, don't know how useful it will be.
  2. After that, you will get the correct date and you can view the admin customer edit form. As my site is built on EE1.11, it should be same as 1.6.0 or 1.6.1. I was using AU as default locale so that is where the errors were coming from.
    You must go to Configuration -> Catalog -> Date & Time Custom Options and make sure it is using AU format DD/MM/YYY and if this is done before your site goes live, it should be fine.

Hope this help, as most developers will not go through all the settings before they start coding. Cheers!

Ben Zhang

查看更多
5楼-- · 2019-06-07 06:53

As per Oscar Reales post above, changing the created_at attribute backend_model in the eav_attribute table fixed my problem, however the value I used was the same as the dob one

eav/entity_attribute_backend_datetime

That worked for me and entering 31/10/2012 showed correct, the eav/entity_attribute_backend_time_created resulted in the random date thing above. I have tested this by editing an existing accounts created at date, created an account in the backend and created an account in the frontend. All worked fine. Btw, my locale is UK.

查看更多
兄弟一词,经得起流年.
6楼-- · 2019-06-07 06:56

This is a problem with the backend_model used by this attribute. dob uses "eav/entity_attribute_backend_datetime" backend_model, and product is using "eav/entity_attribute_backend_time_created" but created_at for customer is not using it. This backend_model is handling all the conversion and filter dates, so, it is so simple as changing the "eav_attribute" table. Search for the attribute_code = 'created_at' AND entity_type_id = 1 and update the value of the backend_model from NULL to "eav/entity_attribute_backend_time_created" and that is. No core files needs to be changed.

If you prefer, you can use a Resource Setup to update this attribute from the installer of your own module.

查看更多
7楼-- · 2019-06-07 07:02

As I stated before, you can do this attribute backend_model update using a custom module, and adding this line to the setup script:

Mage::getSingleton('customer/customer')->getAttribute('created_at')
  ->setBackendModel('eav/entity_attribute_backend_time_created')
  ->setAttributeModel(new Zend_Db_Expr('NULL'))
  ->setInputFilter('date')
  ->save();
查看更多
登录 后发表回答