The catalog/controller/account/logout.php has a bug. When a user logs out, it always clears the session, which is fine. Right after that, it should correctly set the session variables for:
$this->session->data['country_id']
$this->session->data['zone_id']
If Opencart is configured not to display the taxes ($this->config->get('config_tax')==0), it should set above mentioned 2 session variables as follows:
$this->session->data['country_id'] = 0;
$this->session->data['zone_id'] = 0;
This is because we don't want to see the taxes in the product listings and the shopping cart until Opencart knows the user address after a login or guest checkout.
If Opencart is configured to always display the taxes ($this->config->get('config_tax')==1), then the 2 session variables should be set to the store's country and zone if the user isn't logged in and there is no guest checkout in progress:
$this->session->data['country_id'] = $this->config->get('country_id');
$this->session->data['zone_id'] = $this->config->get('zone_id');
I suggest the following fix for the catalog/controller/account/logout.php:
old:
Code: Select all
if ($this->customer->isLogged()) {
$this->customer->logout();
$this->cart->clear();
unset($this->session->data['shipping_address_id']);
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['payment_address_id']);
unset($this->session->data['payment_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['comment']);
unset($this->session->data['order_id']);
unset($this->session->data['coupon']);
$this->tax->setZone($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
$this->redirect($this->url->link('account/logout', '', 'SSL'));
}
.....
new:
Code: Select all
if ($this->customer->isLogged()) {
$this->customer->logout();
$this->cart->clear();
unset($this->session->data['shipping_address_id']);
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['payment_address_id']);
unset($this->session->data['payment_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['comment']);
unset($this->session->data['order_id']);
unset($this->session->data['coupon']);
$this->session->data['country_id'] = ($this->config->get('config_tax')) ? $this->config->get('config_country_id') : '0';
$this->session->data['zone_id'] = ($this->config->get('config_tax')) ? $this->config->get('config_zone_id') : '0';
$this->redirect($this->url->link('account/logout', '', 'SSL'));
}
......