Zen Cart Logo
Forums / All Other Contributions/Addons / User tracking mod

User tracking mod

Views: 183,783

Results 781 to 800 of 861
14 Jul 2017, 8:19 PM
#781
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

User tracking mod

mc12345678:

I have submitted version 1.5.6 for review.
When made available should be downloadable from: https://www.zen-cart.com/downloads.php?do=file&id=159

Primarily adds an error log if the install file is loaded to the store instead of admin, corrects the error I made in the installer in the most recent upload, and modified the instructions a little to make some minor improvements.

Hi there,

Ok I did a clean install and added that line as requested.

#1. Zen Cart executed the full installation beautifully.
#2. I properly configured the User Tracking mod.
#3. I verified in phpMyadmin that the new user_tracking table is present. Perfect.

BUT

When I go to the actual results page now I get the proper Admin toolbar but then below that everything is blank. No debug errors as well.

What is interesting is I view source on the page and I see all the data properly being reported but it's all commented out!? Weird eh? So the data is there but it's somehow being commented out.

Looks like this:

<!-- header_eof //--> <!-- <table border="0" width="100%" cellspacing="0" cellpadding="0"> --> <!-- <tr> <td valign="top" align="center"> <table border="0" width="95%" cellspacing="0" cellpadding="2">--> <!--<span class="UTBox-cart">--> <!-- </tr> --> <!-- <tr> <td class="dataTableContent" align="right" valign="top"><b>--><!--</b></td>
    <td class="dataTableContent" valign="top"><font color="FF0000"><b>--><!--</b></font></td>
    <td class="dataTableContent UTBox" colspan="2" rowspan="4" align="center">-->
    <!--<span class="UTBox">--><!--</span></td>
                      </tr>-->
                                    <!--<tr>
    <td class="dataTableContent" align="right" valign="top"><b>Country:</b></td>
    <td class="dataTableContent" valign="top"><img src="images/flags/ca.gif" border="0" alt="Canada" title=" Canada "> Canada</td>
   </tr>-->
   <!--
          <tr>
    <td class="dataTableContent" align="right" valign="top"><b>IP Address:</b></td>
    <td class="dataTableContent" valign="top"><a href="http://www.dnsstuff.com/tools/whois.ch?ip=207.6.90.165" target="_new">207.6.90.165</a></td>
   </tr>
   <tr>
    <td class="dataTableContent" align="right" valign="top"><b>Host:</b></td>
    <td class="dataTableContent" valign="top">d207-6-90-165.bchsia.telus.net</td>
   </tr>
   <tr>
    <td class="dataTableContent" align="right" valign="top"><b>Originating URL:</b></td>-->
<!-- <td class="dataTableContent" align="left" valign="top" colspan="3"><a href="/" target="_new">/</a> </td> </tr> <tr> <td class="dataTableContent"></td> <td class="dataTableContent" colspan="3">--> <!-- <table border="0" cellspacing="1" cellpadding="2" bgcolor="999999" width="100%">--> <!--<span class="UTBox-cart">--> <!-- </tr> --> <!-- <tr> <td class="dataTableContent" align="right" valign="top"><b>--><!--</b></td>
    <td class="dataTableContent" valign="top"><font color="FF0000"><b>--><!--</b></font></td>
    <td class="dataTableContent UTBox" colspan="2" rowspan="4" align="center">-->
    <!--<span class="UTBox">--><!--</span></td>
                      </tr>-->
                                    <!--<tr>
    <td class="dataTableContent" align="right" valign="top"><b>Country:</b></td>
    <td class="dataTableContent" valign="top"><img src="images/flags/ca.gif" border="0" alt="Canada" title=" Canada "> Canada</td>
   </tr>-->
   <!--
          <tr>
    <td class="dataTableContent" align="right" valign="top"><b>IP Address:</b></td>
    <td class="dataTableContent" valign="top"><a href="http://www.dnsstuff.com/tools/whois.ch?ip=207.6.90.165" target="_new">207.6.90.165</a></td>
   </tr>
   <tr>
    <td class="dataTableContent" align="right" valign="top"><b>Host:</b></td>
    <td class="dataTableContent" valign="top"></td>
   </tr>
14 Jul 2017, 8:36 PM
#782
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

That's kind of messed up. Line 1078 of admin/user_tracking.php should have

echo $boxes['body']->infoBox($emptybgheading, $row['body']);


Which should appear just before a commented out </form> tag at the bottom of the code.

The commented out code is what "used" to be displayed (for the most part) and was left there to support comparison of new and old designs.

But, the tables should still be presented unless there is some sort of css that has been generically applied that would hide the table content. :/

When I tested this on ZC 1.5.5 there were some differences between that display and when used in an older ZC 1.5.3, but not so much so that the content was not present.

In "viewing" the computer code I don't see an unbalanced html comment, but would have to put the results through a validator of sorts to figure out what happened. Of course could just remove all of the html commented text as well which is expected to resolve that. But, I didn't have any major or minor differences between my running version and the fileset. :/

See if just before the <?php and echo that follows that adding --> fixes the display.

15 Jul 2017, 2:20 AM
#783
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

I've just downloaded the version from ZC, the version from github, compared it to what I have on my test systems, loaded a future date (as one had reported an issue with a future date as compared to the system time and here is what shows up on my ZC 1.5.5e system using PHP 7.1.

Attachment 17140

In the admin file there is only one difference between the last and current version of the admin/user_tracking.php file which is an addition of {} around code that follows an if statement to improve readability.

So, the only other thing I can imagine is that there is some sort of css on the admin that is different than the base files and because not every aspect is defined by the plugins css that possibly other things are hidden?! I can't know for sure without performing a similar comparison or review of the affected system... I would hope that something specific can be found, but I haven't been able to duplicate the described condition.

15 Jul 2017, 2:36 AM
#784
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

mc12345678:

See if just before the <?php and echo that follows that adding --> fixes the display.

Sorry, I did try adding a --> right before the beginning of that PHP section that contains the key line you quoted.

Spent the last hour trying to add -->'s in different places without any luck.
Whenever I add in "-->" I do see them echo'd when I refresh the page.

I shouldn't have any custom CSS on the admin side.

I did though get it at one point to show some of the data but of course it was difficult to read with no line spacing and proper tables showing.. Doing this method, I would refresh the page and then view the page source and see something like this, then trial and error to continue trying to remove the additional commenting lines. My problem is I'm not too coding skilled and can't tell which elements need to be there :)

Would the perfect way to approach this be to go from the start and then make sure everything I delete is "contained" with a beginning comment start and comment end?

Thanks for your patience with me on this, I just love your mod! Especially since you took the time to add in that filter feature.

Brandon

15 Jul 2017, 2:47 AM
#785
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

Just for fun and testing, I uploaded an old v1.5 of the user_tracking.php file and it shows everything perfectly, albeit of course without the new features. The filesize being half the size of the new 1.5.5 one :)

15 Jul 2017, 2:56 AM
#786
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

Thanks for checking that.

When you say "the only difference between the last and current version"...
I guess for me that would be this one:
Updated 12/08/2013 Version 1.5

in comparison to your brand new:
Version: 1.5.5

I'll dig into the CSS then if you think that could be it.
I see I'm loading on that page just these 2:

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
15 Jul 2017, 3:47 AM
#787
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

I'm actually comparing 1.5.6 and 1.5.5 as far as versions.

BTW, I've uploaded a version that does not have the "newly" created commenting such that only the new table type display should be presented.

You can find it at: https://github.com/mc12345678/User_Tracking/tree/remove_comments

Would appreciate some feedback on it. Also what browser are you using? I've been using firefox primarily.

15 Jul 2017, 11:15 AM
#788
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

I'm actually using Firefox as well and as I mentioned Zen Cart v1.51.

I used the new file you provided overwriting the old one, and this is really weird.

I get no content loaded, just the typical admin style menu and then the bottom centered Zen Cart logo.

What is weird is here is all the HTML after the <!-- header_eof //-->:

(You can see it just is posting essentially nothing)

<!-- body_text_eof //--> <table border="0" width="100%" cellspacing="4" cellpadding="4" bgcolor="FFFFFF" align="center"> <tr class="infoBoxHeading"> </tr> </table> <table border="0" width="100%" cellspacing="4" cellpadding="4" bgcolor="FFFFFF" align="center"> <tr> </tr> <tr bgcolor="ffffff"> </tr> </table> <!-- body_eof //--> <!-- footer //--> <table border="0" width="100%" cellspacing="10" cellpadding="10"> <tr> <td align="center" class="smallText" height="100" valign="bottom"><a href="http://www.zen-cart.com" target="_blank"><img src="images/small_zen_logo.gif" alt="Zen Cart:: the art of e-commerce" border="0"></a><br /><br />E-Commerce Engine Copyright © 2003-2017 <a href="http://www.zen-cart.com" target="_blank">Zen Cart®</a><br /><a href="https://scor-pal.com/workshop/server_info.php">Zen Cart v1.5.1/v1.5.1</a></td> </tr> </table> <!-- footer_eof //--> <br /> </body> </html>
15 Jul 2017, 11:34 AM
#789
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

I also just tried something out of interest. I tried in Chrome/Firefox and Edge for all 3.

I uploaded v1.5.5 admin/user_tracking.php and I get as I mentioned the page loads but then all the table data is reported but commented out.

I uploaded v1.5.4 same file and I get a blank page completely so nothing loads (not the menu, etc.).

I uploaded v1.5.3 same file and it works flawlessly seeing all the data.

I uploaded v1.5.2 same file and it also works flawlessly.

15 Jul 2017, 9:13 PM
#790
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

Nitroedge:

I also just tried something out of interest. I tried in Chrome/Firefox and Edge for all 3.

I uploaded v1.5.5 admin/user_tracking.php and I get as I mentioned the page loads but then all the table data is reported but commented out.

I uploaded v1.5.4 same file and I get a blank page completely so nothing loads (not the menu, etc.).

I uploaded v1.5.3 same file and it works flawlessly seeing all the data.

I uploaded v1.5.2 same file and it also works flawlessly.

So, that makes me wonder about the fileset on the system related to table generation. I mean I have considered possibly providing a specific table file, but figured if it were possible with the builtin/existing unchanged software, then that seemed ideal, but you say that there are no mydebug logs being generated as a result of this, are there any being generated from the admin side? Ie. can you create an error condition and cause an error to be generated?

Then also see how the following files differ from a vanilla ZC 1.5.1 installation:
admin/includes/classes/box.php
admin/includes/classes/table_block.php

I'm wondering/somewhat thinking that even in the older version(s) where the box class was used that perhaps it wasn't displaying in your setup for some reason...

Ackkk.. I figured it out... Somewhere between ZC 1.5.1 and 1.5.5, the admin/includes/classes/table_block.php file changed ever so slightly, but just enough that it at least impacted this operation to where "nothing" gets displayed in ZC 1.5.1. So, gotta figure out the best way to provide all of the "support" for the plugin to work and to not negatively affect other plugins. Guess either I could provide the files necessary to maybe offer the individual design(s) or in this case provide the "minor" fix that was applied to ZC 1.5.2 and above (which ideally would also be applied to ZC 1.5.1 to make better use of the table_block class. I'll add this to the instructions, though ideally you know you would also update to a more recent version of ZC at this point considering that ZC 1.5.1 is more than 5 years old.

https://github.com/zencart/zencart/commit/f891d240fe199af7510a9a4ae72024f66dd1f33c

15 Jul 2017, 10:20 PM
#791
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

Thanks again for taking the time to help me out!
I'm super new to Github and trying to understand how it works. I see that your link shows the alterations to the 2 files and I was wondering how I do I actually download the 2 files in their altered format?

16 Jul 2017, 3:06 AM
#792
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

Nitroedge:

Thanks again for taking the time to help me out!
I'm super new to Github and trying to understand how it works. I see that your link shows the alterations to the 2 files and I was wondering how I do I actually download the 2 files in their altered format?
From an Internet search on 'github download single file repo', I was presented with the following "instructions":
Go to the file you want to download.
Click it to view the contents within the GitHub UI.
In the top right, right click the Raw button.
Save as...

So from the link above you can click in the upper right of each file (though really it is only the second file that has a change that affects operation, the removal of the closing php section is more about preventing future issues than something functional.

Anyways, the information provided in the links above should have been enough to identify where in the file(s) to make the change(s). Hopefully the question was more about general usage. Suggest reading through the github instructions/help file(s).

16 Jul 2017, 11:53 AM
#793
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

Thanks, worked perfectly and I can report the page is loading correctly now with all the new features and functionality.

I have been testing it and the only problem I have is I am getting the following error in the admin debug logs each time I view the report:

[16-Jul-2017 07:50:39 America/Detroit] PHP Warning: array_key_exists() expects parameter 2 to be array, null given in user_tracking.php on line 283

This error occurs whether I have show/hide spiders or show/hide filters on. It appears to occur each time the User Tracking report is loaded or refreshed.

16 Jul 2017, 12:55 PM
#794
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

Nitroedge:

Thanks, worked perfectly and I can report the page is loading correctly now with all the new features and functionality.

I have been testing it and the only problem I have is I am getting the following error in the admin debug logs each time I view the report:

[16-Jul-2017 07:50:39 America/Detroit] PHP Warning: array_key_exists() expects parameter 2 to be array, null given in user_tracking.php on line 283

This error occurs whether I have show/hide spiders or show/hide filters on. It appears to occur each time the User Tracking report is loaded or refreshed.
I see why/how it is generated. When first going through the records, if $user_tracking hasn't been declared as an array() (which I thought it had, but I see that it wasn't) then when testing if a key is in the non-declared array an error like that could be expected. This is done by inserting a line before the while (!$whos_online->EOF related line that has:

$user_tracking = array();

Alternatively that if statement:

     if ($user_filter_search == 'HideOnly' && array_key_exists('filterwordfound', $user_tracking[$whos_online->fields['session_id']])) {

Could be made false earlier by inserting ```
&& !empty($user_tracking)


I'm thinking the first solution of establishing the variable as an array is the better solution (1 assignment to put the variable in a known and needed state of being an array and it does not increase processing for each loop by basically evaluating if $user_tracking is an array on each loop), but I need to look at the code that is after the while loop to see if the code that follows would behave incorrectly in the condition that there were no records to review/retrieve. 

And yup, just after the closing curly parenthesis of the while loop the check is if $user_tracking is an array. :P this same check is used later in the code as well. So more does need to be changed than just adding the one line to prevent generating that warning which I guess I'm surprised has been supressed in the environment tested. Here at the is_array($user_tracking) == true would want to instead use the !empty($user_tracking) check instead when using the previous $user_tracking = array(); statement.

Alright patch coming up... :)
16 Jul 2017, 1:30 PM
#795
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

Patch posted at github to eliminate the warning message on the admin side:
https://github.com/mc12345678/User_Tracking/commit/d4de8bbd60f3ccae3eb43a334914374bb14b621a

Now to see if it can be inserted into the code that was uploaded/updated earlier this week or if I need to generate yet another newer version. :)

Wouldn't want someone to come along, not read this forum, download the fileset, it generate a mydebug log for each time the report is accessed and then to say hey, this plugin is crap because it generated an warning..... (Sorry, been somewhat tracking the behavior of plugin usage/dismissal. I REALLY thank YOU for pointing out the issues that you have identified. As I say, without knowing that there is a problem and how to recreate it, there is nothing (known) to fix.)

I must say that I don't like the idea that have to tell users of ZC 1.5.1 (and likely 1.5.0) that they really need to upgrade because there was really an error that was introduced/in existence back in those versions that prevented proper use of the code... Ie. It seems a waste to have to provide either/both the table_block.php and/or box.php classes in such a way that they are functional when at this time, nothing additional is really being done. Yeah, overall the presentation of the data would be better/easier if a unique "box" style were provided in the plugin because I've been trying to get creative at not displaying the "header" of the box, but here and there a "top" is still present. If I "took control" of the box class for UT (by providing a separate box class), then when I don't want a header it would be easier by just not providing a header and only providing content and I'd be able to control some of the internal formatting a little better. Just hadn't had the "need" to do that for myself when all I want is to see the data that is provided. :)

16 Jul 2017, 1:42 PM
#796
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

Realized that still needed to do the test of !empty in the if statement at least when hide only was selected... so, the new single change/patch that addresses all of the locations for this is at: https://github.com/mc12345678/User_Tracking/commit/4fe01ae0f969e2575c2767015ea4c809b7449861, the previously provided link will still "work" but it will not resolve the warning that was observed. Overall, the code is better because of the change, but the only thing that was needed to prevent that message was the !empty($user_tracking) that I was trying not to include if I didn't have to. :)

The master branch is also up-to-date with these changes.

mc12345678:

Patch posted at github to eliminate the warning message on the admin side:
https://github.com/mc12345678/User_Tracking/commit/d4de8bbd60f3ccae3eb43a334914374bb14b621a

Now to see if it can be inserted into the code that was uploaded/updated earlier this week or if I need to generate yet another newer version. :)

Wouldn't want someone to come along, not read this forum, download the fileset, it generate a mydebug log for each time the report is accessed and then to say hey, this plugin is crap because it generated an warning..... (Sorry, been somewhat tracking the behavior of plugin usage/dismissal. I REALLY thank YOU for pointing out the issues that you have identified. As I say, without knowing that there is a problem and how to recreate it, there is nothing (known) to fix.)

I must say that I don't like the idea that have to tell users of ZC 1.5.1 (and likely 1.5.0) that they really need to upgrade because there was really an error that was introduced/in existence back in those versions that prevented proper use of the code... Ie. It seems a waste to have to provide either/both the table_block.php and/or box.php classes in such a way that they are functional when at this time, nothing additional is really being done. Yeah, overall the presentation of the data would be better/easier if a unique "box" style were provided in the plugin because I've been trying to get creative at not displaying the "header" of the box, but here and there a "top" is still present. If I "took control" of the box class for UT (by providing a separate box class), then when I don't want a header it would be easier by just not providing a header and only providing content and I'd be able to control some of the internal formatting a little better. Just hadn't had the "need" to do that for myself when all I want is to see the data that is provided. :)

16 Jul 2017, 10:37 PM
#797
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

Fantastic and glad I could help. The reason I still run v1.51 is because my template is so heavily modified it would be a real task (and risk to having the store down for awhile) to merge all the files and update to v1.55. I will try out your new file and report back, thanks!

16 Jul 2017, 10:50 PM
#798
nitroedge avatar

nitroedge

New Zenner

Join Date:
Mar 2014
Location:
Canada
Posts:
22
Plugin Contributions:
0

Re: User tracking mod

Uploaded the new file and works with the default options loaded. No debug log file is generated.

But if you change the default Filter option (List All) and select (Hide Filtered), you should see it will refresh the data but then create a similar debug error on line 285.

"[16-Jul-2017 18:43:19 America/Detroit] PHP Warning: array_key_exists() expects parameter 2 to be array, null given in user_tracking.php on line 285

The problem seems to be isolated to the above scenario.
No errors are reported if you choose (Show Filtered), or change the (Min Clicks) option, or (Show/Hide Spiders) options. No errors are also reported if you choose different dates as well. :)

17 Jul 2017, 2:05 AM
#799
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

You, unlike me at the time of testing, must have had at least one visit recorded.

sigh I knew I should have focused more on the true solution and not just what seemed to work.

Explanation: when the setting is to filter out the undesirables, then the first criteria of the if statement is satisfied as true. When the loop has been executed at least once, the second criteria is true (!empty), but, on that second "trip" the applicable session may not have been the same as before and therefore there may not be a record (non-empty sub-array) and therefore the code attempts to check for a key against a basically non-assigned array which is what throws that warning.

So need yet another && !empty($user_tracking[$whos_online->fields['session_id']]) inserted after the first !empty($user_tracking)

Bugger. :/ at least DrByte has also offered some optimization improvements that would make the resubmission of the latest more worth while. :)

18 Jul 2017, 11:52 AM
#800
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: User tracking mod

Will be issuing version 1.5.8 to ZC in the next couple of days, at least. This version can be found on github at the version 1.5.8 branch:

Version 1.5.8:

    • Add an additional check to prevent an admin mydebug log being when the selection is made to display filtered entries to hide entries that accessed an item on the list of filtered URIs.
    • Incorporate optimizations provided by DrByte to improve the quality of the program
    • Joined admin/includes/functions/extra_functions/user_tracking.php into the function code for the catalog side which meant that was able to incorporate into the catalog observer. Functions can be reached through the use of $user_tracking_observe->zen_update_user_tracking() instead of just zen_update_user_tracking().
    • Installer is expected to remove admin/includes/classes/class.user_tracking.php and
      admin/includes/functions/extra_functions/user_tracking.php if either or both are present because these files are no longer needed or used.
    • Incorporated ip data collection code into the program to support compatibility between ZC versions where for example the admin side doesn't have the same ip collection code.
    • Cleaned up the look of the code to be consistent within an individual file.

This modification nearly updates/modifies all files while removing some of them as well.