Quote Originally Posted by mc12345678 View Post
Sorry that I did not also give the comment/question more of an explanation.

The array of arrays is to provide a dropdown that is 1) understandable to users, but with stored data that does not require manipulation when used in the calculations... The look of the install is "more complicated", but when the sql is properly formatted and applied, the configuration panel use is simplified and clearer. This reduces the need to use statements such as:

Choose 60 for hours, 1440 for days, etc... Instead one chooses hours, or days and the value 60 or 1440, respectively is stored in the database and used in calculations...

The SQL that has worked for me, recognizing the "issue" with the incorrect use of double quotes which was also identified through review of the ZC default installation sql for similar type of options to be provided is:



The above worked on a ZC 1.5.4 installation and was finally error free... Didn't perform as desired, but didn't "throw an error"... Torvista may have other improvements in mind.
Acckkkk.. Worked, but didn't... Ie. It installed without error, but it did not provide the desired result... Feel like I should hang up my hat...

Incorrectly identified that one liner as a select_option instead of a select drop_down...

Therefore, now with that one change... The SQL to install User Tracking for the first time should be:
PHP Code:
# If this script has been run before, this line is likely to cause an  error. Check logs folder (ZC V >=1.5.1) or cache folder (ZC V <=  1.5.0)  If this is the SQL command that caused an error, it may be  removed or commented.
INSERT INTO admin_pages (page_keylanguage_keymain_pagemenu_key,  display_on_menusort_orderVALUES ('UserTracking',  'BOX_TOOLS_USER_TRACKING''FILENAME_USER_TRACKING''tools''Y',  10000);

# If this script has been run before, this line is likely to cause an  error. Check logs folder (ZC V >=1.5.1) or cache folder (ZC V <=  1.5.0)  If this is the SQL command that caused an error, it may be  removed or commented.
INSERT INTO configuration_group (`configuration_group_title`,  `configuration_group_description`, `visible`) VALUES ('User Tracking  Config''User Tracking'1);

# Do not remove these SQL lines.  They are needed for further processing.
SELECT @UserTrackgID := configuration_group_id
FROM configuration_group where configuration_group_title 
'User Tracking Config';
UPDATE configuration_group SET sort_order = @UserTrackgID WHERE  configuration_group_id = @UserTrackgID AND configuration_group_id != 0;

# If this script has been run before, this line is likely to cause an  error. Check logs folder (ZC V >=1.5.1) or cache folder (ZC V <=  1.5.0)  If this is the SQL command that caused an error, it may be  removed or commented.
INSERT INTO admin_pages (page_keylanguage_keymain_pagepage_params,  menu_keydisplay_on_menusort_orderVALUES ('UserTrackingConfig',  'BOX_TOOLS_USER_TRACKING_CONFIG''FILENAME_CONFIGURATION',  CONCAT('gID=', @UserTrackgID), 'configuration''Y', @UserTrackgID);

# DROP TABLE IF EXISTS user_tracking;  
/* The above line is not necessary on a new install as there is no expectation of another plugin
 naming the table the same.  If however, the below line is a problem, then either the above DROP TABLE should be uncommented
 or the below CREATE TABLE should be commented using double forward  slashes.  This will depend on whether the table exists by running this  previously or if another application has created this table. */
CREATE TABLE user_tracking (
  `
customer_idint(11) default NULL,
  `
click_idint(11) default NULL,
  `
full_namevarchar(64NOT NULL default '',
  `
session_idvarchar(32NOT NULL default '',
  `
ip_addressvarchar(15NOT NULL default '',
  `
time_entryvarchar(14NOT NULL default '',
  `
time_last_clickvarchar(14NOT NULL default '',
  `
last_page_urlvarchar(128NOT NULL default '',
  `
referer_urlvarchar(254NOT NULL default '',
  `
page_descvarchar(64NOT NULL default '',
  `
customers_host_addressvarchar(64NOT NULL default ''
ENGINE=MyISAM;

# DELETE FROM configuration where configuration_group_id = @UserTrackgID and @UserTrackgID != 0;  
/* The above line is not necessary for a new installation as this  information is not already entered in the database; however, if while  attempting to run this query, there may be an error at the insert below  and therefore this may need to be uncommented to move forward with it.   Be advised, this will remove all options that are currently on the User  Trackings configuration menu. */

# If this script has been run before, one or more of the below lines are  likely to cause an error. Check logs folder (ZC V >=1.5.1) or cache  folder (ZC V <= 1.5.0). The line(s) below up to the SQL command that  caused the error may be removed or commented out.

INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking Visitors''ZEN_CONFIG_USER_TRACKING''true''Check the  Customers/Guests behaviour? (each click will be recorded)',  @UserTrackgID1NOW(), NULL'zen_cfg_select_option(array(\'true\',  \'false\'),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (ADMIN)''ADMIN_CONFIG_USER_TRACKING''true''Check the  ADMINs behaviour? (each click will be recorded)', @UserTrackgID2,  NOW(), NULL'zen_cfg_select_option(array(\'true\', \'false\'),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (exclude this IP-Address)''CONFIG_USER_TRACKING_EXCLUDED',  'your IP''Do NOT record this IP Address<br>(like  webmaster/owners/Beta-testers)', @UserTrackgID10NOW(), NULLNULL);
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Session Limit)''CONFIG_USER_TRACKING_SESSION_LIMIT''50',  'Displaying the latest # sessions of this 24 hour period.<br>(SET  to 999999 for unlimited per 24 hour  period)<br>NOTE:<BR>Watch you space !', @UserTrackgID15,  NOW(), NULLNULL);
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Admin User Can Delete)',  'CONFIG_USER_TRACKING_ADMIN_CAN_DELETE''true''Allow Record Deletion  to be Active?<br/>Setting this to true will override ENTRY and  SESSION purges.<br/>Default <b>true</b><br/>',  @UserTrackgID25NOW(), NULL'zen_cfg_select_option(array(\'true\',  \'false\'),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Admin User Can Delete Historical Data)',  'CONFIG_USER_TRACKING_ADMIN_CAN_DELETE_RECORDS''false''Allow Record  Deletion of records older than now - the purge duration set  below.<br/>This value is ignored if Admin User Can Delete is set  to true.  Otherwise set this to true to allow deletion of  visits.<br/>Default <b>false</b>.<br/>',  @UserTrackgID26NOW(), NULL'zen_cfg_select_option(array(\'true\',  \'false\'),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Admin User Can Delete SESSIONS)',  'CONFIG_USER_TRACKING_ADMIN_CAN_DELETE_SESSIONS''false''Allow  SESSION Deletion to be Active?<br/>This setting is ignored if  Admin User Can Delete is set to true.<br/>Default  <b>false</b><br/>', @UserTrackgID27NOW(), NULL,  'zen_cfg_select_option(array(\'true\', \'false\'),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Admin User Can Delete IP)',  'CONFIG_USER_TRACKING_ADMIN_CAN_DELETE_IP''false''Allow Deletion of  records that match the identified IP address?<br/>This setting is  ignored if Admin User Can Delete is set to true.<br/>Default  <b>false</b><br/>', @UserTrackgID28NOW(), NULL,  'zen_cfg_select_option(array(\'true\', \'false\'),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Purge this Number)''CONFIG_USER_TRACKING_PURGE_NUMBER''3',  'What is the number associated with purging before the current  date/time?<br/><br/>An example would be to choose 3 here and  units of days to delete data greater than 3 days before  today.<br/>', @UserTrackgID30NOW(), NULLNULL);
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Purge Units)''CONFIG_USER_TRACKING_PURGE_UNITS''1440',  'Pick the units associate with the periodicity to allow purging  data.<br/>', @UserTrackgID31NOW(), NULL,  'zen_cfg_select_drop_down(array(array(\'id\'=>\'60\',  \'text\'=>\'Hours\'), array(\'id\'=>\'1440\',  \'text\'=>\'Days\'),array(\'id\'=>\'10080\',  \'text\'=>\'Weeks\'),array(\'id\'=>\'43200\',  \'text\'=>\'Months (Based on 30 days)\')),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Type of User Interaction to Record)',  'CONFIG_USER_TRACKING_TRACK_TYPE_RECORD''1''Type of user tracking to  record?<br/><br/>1 - All visitors.<br/>2 - Visitors  views where sessions have been started.<br/>3 - All users except  bots/spiders ( requires Configuration->Sessions->Prevent Spider  Sessions->true)  (Don\'t know if this works with Zen-Cart versions  older than 1.2.6d)<br/><br/>Related to above: If you set  Force Cookie Use->true, then at the first user entry, sessions do not  start!!! And in variants 2 and 3, user-tracking will not have started.  In this case you lose one click and do not log the referal. But if this  user is a returning user and has an old/previous zen cookie the session  started and your tracking system will collect this info. So, the result  beforehand is not logged or will not be known.<br/>',  @UserTrackgID40NOW(), NULL'zen_cfg_select_option(array(\'1\',  \'2\',\'3\'),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (your favorite WHOIS URL)''USER_TRACKING_WHOIS_URL',  'http://www.dnsstuff.com/tools/whois.ch?ip=''Put here you favorite  WHOIS tracking site<br>(the IP will follow automaticly after this  url)', @UserTrackgID50NOW(), NULLNULL);
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Show Product Category when tracking product clicks)',  'ZEN_CONFIG_SHOW_USER_TRACKING_CATEGORY''true''Show Product Category  when tracking product clicks', @UserTrackgID60NOW(), NULL,  'zen_cfg_select_option(array(\'true\', \'false\'),');
INSERT INTO configuration (configuration_titleconfiguration_key,  configuration_valueconfiguration_descriptionconfiguration_group_id,  sort_orderdate_addeduse_functionset_functionVALUES ('User  Tracking (Version Installed)''CONFIG_USER_TRACKING_VERSION''1.5',  'Shows the version number associated with user tracking and should be  updated with each upgrade', @UserTrackgID1000NOW(), NULL,  'zen_cfg_select_option(array(\'CONFIG_USER_TRACKING_VERSION\'),');