Jump to content

Can't modify address related to guest accounts in the backend


Recommended Posts

Version 1.4.0.17

When trying to modify it from the frontend, the error shown:

"Address1 required", it looks like it doesn't recognize the submit of the address fields, only the user details.

When trying to modify from the backend, the error shown:

"That email is not registered"


Cheers

Link to comment
Share on other sites

In the backend, I've found the problem:

- admin/tabs/AdminAddresses.php

Method postProcess
==========================================
if (isset($_POST['submitAdd'.$this->table]))
{
// Transform e-mail in id_customer for parent processing
if ($this->addressType == 'customer')
{
if (Validate::isEmail(Tools::getValue('email')))
{
$customer = new Customer;
$customer = $customer->getByemail(Tools::getValue('email'));
if (Validate::isLoadedObject($customer))
==========================================

It will always fail for a GUEST account in the line "if (Validate::isLoadedObject($customer))", because of:

- classes/Customer.php

Method getByEmail:


==========================================
$result = Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_ .'customer`
WHERE `active` = 1
AND `email` = \''.pSQL($email).'\'
'.(isset($passwd) ? 'AND `passwd` = \''.md5(pSQL(_COOKIE_KEY_.$passwd)).'\'' : '').'
AND `deleted` = 0
AND `is_guest` = 0');

if (!$result)
return false;
$this->id = $result['id_customer'];
foreach ($result AS $key => $value)
if (key_exists($key, $this))
$this->{$key} = $value;

return $this;
==========================================


This SQL will never return an email of a GUEST account.

Link to comment
Share on other sites

  • 9 months later...
  • 1 year later...
×
×
  • Create New...