Jump to content

[SOLVED] Add field to Employee Table


andrewappleseed

Recommended Posts

Hi,
Im wondering if i could add a field to Employee table.

But after thatm, i can not login using my user. I guess this is due to how Prestashop process the tokens or encrypt the password.

function getByemail($email, $passwd = NULL), seems not work,
After alter the Table, and debug the function Tools::encrypt($passwd), i got a different MD5, so, the function can not find it.

how could i solve this?


getByemail:
SELECT *
FROM `'._DB_PREFIX_.'employee`
WHERE `active` = 1
AND `email` = \''.pSQL($email).'\'
'.($passwd ? 'AND `passwd` = \''.Tools::encrypt($passwd).'\'' : ''));

Link to comment
Share on other sites

Same here, i dont know why, to add a field to the Database can affect to the function
Tools::encrypt($passwd)

I add this new field to the model and i can display perfectly in the Back Office. After logout and try to log again, it does not work.
If i drop the field in the table.. everthing seems ok again.

Link to comment
Share on other sites

Hi, i got:
'employee does not exist, or bad password'

Debuging, i see here is the problem:
/* Seeking for employee */
$employee = new Employee();
$employee = $employee->getByemail($email, $passwd);
if (!$employee)
{
$errors[] = Tools::displayError('employee does not exist, or bad password');
$cookie->logout();
}

I send a password to the method "getByemail(), but the password i got with the function
Tools::encrypt($passwd).
it does not match

Link to comment
Share on other sites

Hi,
I made a new install of Prestashop and clear cookies in the web brownser.
Then i follow those steps:
1. Add new field to Employee.
2. Change employee class (add the field, add a new validation and display).
3. Add this field to the Framework.
4. Login with admin or another user, and works.

This field is related to Manufacturer, so, the profile of employee "manufacturer" can only access to their products.

Prestashop is cool!! (Best coding that Magento, Drupal.. etc).

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...