Shopping Cart Login/Logout

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
11 years 6 months ago #10045

Hello,

not sure if this is a bug or it has been designed this way. We have the shop configured with the standard joomla login mod activated. If a non-registered or non-logged in user adds a product to their shopping, if they then register or log in the shopping cart keeps the same number of items and the user can complete the checkout.

If the user logs out during the check out process for whatever reason by clicking on the log out button in the joomla login mod the cart then shows as empty. If the user logins back in again the items they had in their cart show up again. However if the user when logged out adds an item(s) to their cart when they are logged out, when they log in again only the items they added to their basket when they were logged out appear.

Our expected behaviour would be: if a user logs out during the checkout process even when logged out they would be able to see the items in their cart until their session closes. If in the meantime they add other items to their shopping cart these items would be combined with their existing cart so that when they check out all the items are there.

Please Log in or Create an account to join the conversation.

  • Posts: 76510
  • Thank you received: 12007
  • MODERATOR
11 years 6 months ago #10049

Well that's indeed the behavior at the moment. But you're right that it could be improved by keeping the cart when logging out.

You can easily add that by editing the file plugins/user/hikashop.php and adding the code:
function onUserLogout($user){
return $this->onLogoutUser($user);
}

function onLogoutUser($user){
$options=null;
return $this->onLoginUser($user, $options);
}

One function is for joomla 1.5 and the other for joomla 1.6 and they call the login function so that the cart is kept.

Please Log in or Create an account to join the conversation.

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
11 years 5 months ago #13319

Thanks for the reply. Working with J!1.5

Please Log in or Create an account to join the conversation.

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
11 years 5 months ago #13361

Hi Nicolas,

Still experience some problems. We are testing on Joomla 1.5.22 Hikashop 1.4.8. We have the Joomla Login Mod published.

1) A registered user, who is not logged in, adds some items to their basket
2) The user logs in in using the joomla login mod - the items in the basket are kept
3) The user logs out again the using the joomla login mod - the items in the cart are not kept (they items are not transferred from the users cart back the temporary cart
4) the user logs in again - the items in the cart are visible because the system is bringing up the users saved cart

Ideally, if a users logs out we would like the contents of the user's basket to be visible still. Thanks

Last edit: 11 years 5 months ago by jameswadsworth.

Please Log in or Create an account to join the conversation.

  • Posts: 76510
  • Thank you received: 12007
  • MODERATOR
11 years 5 months ago #13412

Indeed. The problem is that joomla clears the session and then redirect without us being able to set the old cart id in the session like during the login of the user.
The solution would be to add a cookie in the browser of the user and use it to load the cart after or something like that.

Please Log in or Create an account to join the conversation.

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
11 years 5 months ago #13430

Okay. Thanks for the pointer. I'll investigate and let you know what I come up with.

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum