Getting Results Count

Permalink
I'm working on a new add-on to capture the number of times the product search is used (with the ecommerce add-on) as well as the standard site search. I've got the add-on about 90% done but I'm not able to capture how many results were returned. When using count($results) for the commerce search or count($results_count) for the site search I'm getting 0 results. I'm loading this after the page load so I'm guessing those objects are no longer available. Could someone tell me a better place or way to capture that data? I want the add-on to be somewhat stand alone so I don't want to modify the existing search or commerce add-on's.

Thanks
Robert

rhoenig