Forums / Addon Admin Tools / [FEATURE] Who's Online - Show only "Cart Has Items" filter

[FEATURE] Who's Online - Show only "Cart Has Items" filter

Views: 133

Results 1 to 3 of 3
22 Jul 2026, 6:22 PM
#1
jeff_mash avatar

jeff_mash

Totally Zenned

Join Date:
Aug 2004
Posts:
732
Plugin Contributions:
0

[FEATURE] Who's Online - Show only "Cart Has Items" filter

NEW FEATURE - Filter your Who's Online list to show only Carts With Items (active and inactive), and hide all the rest.

This is something I have always wanted and added this quick workaround on my own site.

Sometimes, you want to see who is active and what items are in their carts. You may not care to see all the sessions where people aren't shopping.

Currently, the WHOS_ONLINE.php only filters between Spiders and Admin sessions. When a site like mine has hundreds or even thousands of sessions, it's frustrating to scroll the page looking for the green or yellow "active cart" circles just to see what items are being actively shopped.

I wanted the WHOS ONLINE to only list the cart sessions that had items inside of them, and hide the rest.

So I added the following code to give that extra toggle to display only Cart Has Items sessions.

Current Version - Zen Cart 2.2

On line 9:

define('TEXT_WHOS_ONLINE_FILTER_CART_NOT_EMPTY', 'Cart Has Items:');

On line 38:

if (!isset($_SESSION['wo_cart_not_empty_only'])) {
  $_SESSION['wo_cart_not_empty_only'] = false;
}
if (isset($_GET['ac'])) {
  $_SESSION['wo_cart_not_empty_only'] = $_GET['ac'] != 0;
}

On line 62:

if (!empty($_SESSION['wo_cart_not_empty_only'])) {
  $whos_online = array_filter($whos_online, function ($item) {
    return substr($item['icon_class'], -10) === '-not-empty';
  });
}

On line 72:

$optURL = zen_href_link(FILENAME_WHOS_ONLINE, zen_get_all_get_params(['t', 'na', 'ns', 'ac'])) . '&'; //  added 'ac'
$listingURL = zen_href_link(FILENAME_WHOS_ONLINE, zen_get_all_get_params(['q', 't', 'na', 'ns', 'ac'])) . '&';  //  added 'ac'

On line 136:

   
   	<?php echo TEXT_WHOS_ONLINE_FILTER_CART_NOT_EMPTY; ?>
   	<a class="optionClick<?php echo ($_SESSION['wo_cart_not_empty_only']) ? ' chosen' : ''; ?>" href="<?php echo $optURL; ?>ac=1"><?php echo TEXT_YES; ?></a> 
   	<a class="optionClick<?php echo (!$_SESSION['wo_cart_not_empty_only']) ? ' chosen' : ''; ?>" href="<?php echo $optURL; ?>ac=0"><?php echo TEXT_NO; ?></a> 
  • Jeff
22 Jul 2026, 6:29 PM
#2
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,187
Plugin Contributions:
0

Re: [FEATURE] Who's Online - Show only "Cart Has Items" filter

What is the path to the .php you have edited please.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

22 Jul 2026, 7:03 PM
#3
jeff_mash avatar

jeff_mash

Totally Zenned

Join Date:
Aug 2004
Posts:
732
Plugin Contributions:
0

Re: [FEATURE] Who's Online - Show only "Cart Has Items" filter

haredo:

What is the path to the .php you have edited please.

Sorry, forgot to put that.

It's the admin/whos_online.php file.

My line numbers were based off the latest 2.2 version of the file.

  • Jeff