Hello,
If you want to keep your addresses when setting the "Ask address on registration" to NO, then the solution can be to edit the file "administrator\components\com_hikashop\classes\user.php", and change these lines :
$query = 'UPDATE '.hikashop_table('address').' AS hk_addr '.
' SET hk_addr.address_published = 0 '.
' WHERE hk_addr.address_user_id='.(int)$ret['user_id'].' AND hk_addr.address_published = 1';
$this->database->setQuery($query);
$this->database->execute();
By :
if(empty($_SESSION['hikashop_previously_guest_as']) || $_SESSION['hikashop_previously_guest_as'] != $ret['user_id']) {
$query = 'UPDATE '.hikashop_table('address').' AS hk_addr '.
' SET hk_addr.address_published = 0 '.
' WHERE hk_addr.address_user_id='.(int)$ret['user_id'].' AND hk_addr.address_published = 1';
$this->database->setQuery($query);
$this->database->execute();
unset($_SESSION['hikashop_previously_guest_as']);
}
And change the file "administrator\components\com_hikashop\helpers\checkout\login.php", and add these lines :
if(!isset($params['address_on_registration'])) {
$config = hikashop_config();
$params['address_on_registration'] = $config->get('address_on_registration', 1);
}
if(!$params['address_on_registration'])
$_SESSION['hikashop_previously_guest_as'] = $user_id;
just after these lines :
$app->setUserState(HIKASHOP_COMPONENT.'.user_id', 0);
hikashop_loadUser(false, true);
Kind regards,
Mohamed Thelji.