Jump to content

What does "Online* refer to in the shopping cart table?


sackling

Recommended Posts

When looking at orders>shopping cart

There is a column for online with the option Yes/No

It seems to always show NO.

I would have thought it meant if the cart is "active" or moving around it would be considered online but that does not seem to be the case.

Link to comment
Share on other sites

Thanks for the reply. This is just a test shop so I am really just getting a feel for the BO.

Is there a way to see just "active" shopping carts.

I.e. carts that have had activity/movement in the last 5 minutes for example?

Link to comment
Share on other sites

The "Online" Field does just that, but its functionality is weird.

Taken from AdminCartsController.php

if (Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) {
  $this->fields_list['id_guest'] = array(
  'title' => $this->trans('Online', array(), 'Admin.Global'),
  'align' => 'text-center',
  'type' => 'bool',
  'havingFilter' => true,
  'class' => 'fixed-width-xs',
  );
}

It seems like this "Online" field only exists if you have Guest Checkout Enabled.

The query to see if the cart is "Online" is as follows:

LEFT JOIN (
  SELECT `id_guest`
  FROM `' . _DB_PREFIX_ . 'connections`
  WHERE
  TIME_TO_SEC(TIMEDIFF(\'' . pSQL(date('Y-m-d H:i:00', time())) . '\', `date_add`)) < 1800
  LIMIT 1
) AS co ON co.`id_guest` = a.`id_guest`'

So if connections table guest date_add is less than 30 minutes then it is "Online"

 

Testing this does not output the same results as this. Very confusing

Link to comment
Share on other sites

Thanks for digging in. The code looks to do exactly like I want.

I think guest checkout is enabled by default. And testing in admin seems to show every single cart "online" even the carts that were already listed from the original install.

 

sooo something seems to be up with that. 

Link to comment
Share on other sites

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...