Magento customer reset password customer_flowpassword error
-
07-10-2020 - |
Вопрос
I currently have a error in my 1.9.3.2 store.
When a customer wants to reset their password, the Magento Report error page is displayed.
When check the report, I get the following error:
a:5:{i:0;s:156:"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'customer_flowpassword' doesn't exist, query was: DESCRIBE `customer_flowpassword`";i:1;s:2832:"#0 /lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
Problem is related to the update to 1.9.3.2, where the table was not created.
Should this solve the issue?
CREATE TABLE `customer_flowpassword` (
`flowpassword_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Flow password Id',
`ip` varchar(50) NOT NULL COMMENT 'User IP',
`email` varchar(255) NOT NULL COMMENT 'Requested email for change',
`requested_date` varchar(255) NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Requested date for change',
PRIMARY KEY (`flowpassword_id`),
KEY `IDX_CUSTOMER_FLOWPASSWORD_EMAIL` (`email`),
KEY `IDX_CUSTOMER_FLOWPASSWORD_IP` (`ip`),
KEY `IDX_CUSTOMER_FLOWPASSWORD_REQUESTED_DATE` (`requested_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Customer flow password' AUTO_INCREMENT=9 ;
How can I solve that?
Решение
Solution 1
Go to database table core_resource
, Find an entry for your module- could be customer_flowpassword_setup
- and delete it.
Now refresh any page on your magento setup. It should re-run your setup script and will create table. Don't forget to refresh your cache.
Solution 2
Directly run below SQL in your database.
CREATE TABLE `customer_flowpassword` (
`flowpassword_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Flow password Id',
`ip` varchar(50) NOT NULL COMMENT 'User IP',
`email` varchar(255) NOT NULL COMMENT 'Requested email for change',
`requested_date` varchar(255) NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Requested date for change',
PRIMARY KEY (`flowpassword_id`),
KEY `IDX_CUSTOMER_FLOWPASSWORD_EMAIL` (`email`),
KEY `IDX_CUSTOMER_FLOWPASSWORD_IP` (`ip`),
KEY `IDX_CUSTOMER_FLOWPASSWORD_REQUESTED_DATE` (`requested_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Customer flow password' AUTO_INCREMENT=9 ;
Другие советы
This is a bug in Magento core, not recognizing your "table prefix" (confimed here)
See: /app/code/core/Mage/Customer/Model/Observer.php
Original code doesn't check for prefix ...
public function deleteCustomerFlowPassword()
{
$connection = Mage::getSingleton('core/resource')->getConnection('write');
$condition = array('requested_date < ?' => Mage::getModel('core/date')->date(null, '-1 day'));
$connection->delete($connection->getTableName('customer_flowpassword'), $condition);
}
It should look like ...
public function deleteCustomerFlowPassword()
{
$resource = Mage::getSingleton('core/resource');
$connection = $resource->getConnection('write');
$condition = array('requested_date < ?' => Mage::getModel('core/date')->date(null, '-1 day'));
$connection->delete($resource->getTableName('customer_flowpassword'), $condition);
}