Thread: Search Log

Page 4 of 10 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 95
  1. #31
    Join Date
    Jun 2006
    Posts
    7
    Plugin Contributions
    0

    Default Re: Search Log

    Quote Originally Posted by nick80
    about UTF8 search log, I mean the search keywords is in UTF8 format instead of normal ASCII format.

    right now, the keywords in UTF8 format are not stored into the database correctly.

    so, please look into this UTF8 issues.

    thanks.
    I am talking about the search log of non-english charactors.

  2. #32
    Join Date
    Feb 2005
    Location
    West Yorkshire, UK
    Posts
    70
    Plugin Contributions
    0

    Default Re: Search Log

    OK, I'm still learning this stuff and I've not got the UTF8 stuff just yet.

    I take it changing the code in tpl_advanced_search_default.php to this isn't enough?

    PHP Code:
    $mydate date("Y-m-d");
    $keyword string utf8_encode ($_GET['keyword']);
    $table_exists $db->Execute("insert into zen_search_log (searchterm, date) values ('$keyword','$mydate')"); 
    ---------------------------------------------
    www.seamless-packages.co.uk

  3. #33
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Search Log

    @nick80:

    Sorry for that. My mistake.


    I take it changing the code in tpl_advanced_search_default.php to this isn't enough?
    This coding block would need be posted into the related language file rather than the template file instead.

  4. #34
    Join Date
    Feb 2005
    Location
    West Yorkshire, UK
    Posts
    70
    Plugin Contributions
    0

    Default Re: Search Log

    I've upload the latest release here:
    http://www.seamless-packages.co.uk/z..._analyser.html

    I've introducted a tabbed menu to the top of the page to save space. This will come into it's own as the mod grows.

    I've added an export to Excel function. It's my first attempt at exporting data via PHP, but it seems to work quite well (even if I do say so myself ;) ) I had to put the code into a seperate file, which is not ideal, but as I said it works for now.

    I've added a lot of TheOracles fixes and suggested code from previous post as well.

    I will look into the flexable table naming next.

    As for UTF8. I'm not really up on this subject yet so will come back to it. Or maybe TheOracle and help me out with that one

    The installation files has all the instruction for installing from fresh or upgrading from 0.1 & 0.2, but if you have any trouble let me know.

    Hope you like the changes and keep the feedback coming!

    I'll try to get a new release out before/ over the weekend?
    ---------------------------------------------
    www.seamless-packages.co.uk

  5. #35
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Search Log

    Excellent. Thanks for the update woza.

    Now that the latest patches has been packed into your ZIP file, on the site, I will, now, begin the modifications for the index page since it might be possible that the UTF8 issue might be related with this one. Which is why, it's always important to build contributions under universal languages since, each master language files, has their own charset definition. To conclude - soon to be fixed.

    As for the Exporter, I did code this up for another PHP script in the past. I will take a look at your module and, if I see anything that needs to be modified in order to expand ít's behavior, then I will post the results if needed.

  6. #36
    Join Date
    Feb 2005
    Location
    West Yorkshire, UK
    Posts
    70
    Plugin Contributions
    0

    Default Re: Search Log

    Cool. The only code suggestion by yourself that i've not put into the latest reslease is the one on this post:
    http://www.zen-cart.com/forum/showpo...5&postcount=26

    That is because I've some issues with the page numbering and may change it.

    You'll have to explain the UTF8 stuff in zen to me someday
    ---------------------------------------------
    www.seamless-packages.co.uk

  7. #37
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Search Log

    If you're encountering issues with the HTML table presentation from the mentionned part,

    replace:

    PHP Code:
    <table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\"> 
        <tr> 
            <td width=\"110\"><?php echo SEARCHLOG_TERM?></td> 
            <td><?php echo NUMBER_TIMES_SEARCHED_FOR?></td> 
            <td><?php echo SEARCHLOG_DATE?></td> 
            <td><?php echo SEARCHLOG_ACTION?></td> 
        </tr>
    to read:

    PHP Code:
    echo "<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\"> 
        <tr> 
            <td width=\"110\">" 
    SEARCHLOG_TERM"</td> 
            <td>" 
    NUMBER_TIMES_SEARCHED_FOR"</td> 
            <td>" 
    SEARCHLOG_DATE"</td> 
            <td>" 
    SEARCHLOG_ACTION"</td> 
        </tr>"

    This is the way I personally do it usually.

  8. #38
    Join Date
    Mar 2006
    Posts
    85
    Plugin Contributions
    0

    Default Re: Search Log

    Hello got it installed and getting the following error before the column headings:


    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/diystore/public_html/catalog/admin/searchlog.php on line 303

    and this one after:

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/diystore/public_html/catalog/admin/searchlog.php on line 335

    can anyone help?
    Using: Zencart 1.3.7 and lovin' every minute of it.

  9. #39
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Search Log

    Be very careful with the keywords. They can be very dangerous - especially during SQL injections.

    From your installation.txt file, (v0.3 release),

    find:

    PHP Code:
    $keyword string utf8_encode ($_GET['keyword']);
    $table_exists $db->Execute("insert into zen_search_log (searchterm, date) values ('$keyword','$mydate')"); 
    replace with:

    PHP Code:
    $keyword = (strip_tags(trim(string utf8_encode($_GET['keyword']))));
    $table_exists $db->Execute("insert into " TABLE_SEARCHLOG " (searchterm, date) values ('$keyword','$mydate')"); 
    This patch also fix the SQL table name in case some users might use different prefix with their SQL database over Zen-Cart. Otherwise, errornous could be involved.

    Now, fixes for index.php file.

    From the v0.2 release, you asked your beta-testers to add a specific block into admin/index.php file.

    Replace that whole block -

    with this one:

    PHP Code:
    <div class="reportBox">
    <div class="header"><?php echo SEARCHLOG_TOP_5?></div>
    <?php
        
    echo "<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\">
        <tr>
            <td width=\"110\"><b>" 
    SEARCHLOG_TERM "</b></td>
            <td><b>" 
    SEARCHLOG_COUNT "</b></td>
        </tr>"
    ;
    $color1 "#F8E7F9";
    $color2 "#BFD8BC";
    $row_count 0;


         
    $sql "SELECT searchterm, count(*) AS Number
                      FROM " 
    TABLE_SEARCHLOG "
                           WHERE searchterm is not null and searchterm not like  ''
                            GROUP BY searchterm
                                  ORDER BY Number desc limit 0,5"
    ;
      
    $result mysql_query($sql);

      if (!
    $result) {
      
    $messageStack->add(ENTRY_SEARCHLOG_ID_NOT_FOUND'error');
      } 
    ###### End of if statement.

     
    while ($row = @mysql_fetch_array($result)) {
        
    $searchterm = (isset($row["searchterm"]) && !empty($row["searchterm"])) ? trim($row["searchterm"]) : "";
        
    $number = (isset($row["Number"]) && $row["Number"] != 0) ? intval(trim($row["Number"])) : 0;

        
    /* Now we do this small line which is basically going to tell
        PHP to alternate the colors between the two colors we defined above. */

        
    $row_color = ($row_count 2) ? trim($color1) : trim($color2);

        
    // Echo your table row and table data that you want to be looped over and over here.

        
    echo "<tr>
        <td width=\"110\" bgcolor=\"
    $row_color\" nowrap>" $searchterm "</td>
        <td bgcolor=\""
    .$row_color."\">" $number "</td>
        </tr>"
    ;

        
    // Add 1 to the row count

        
    $row_count++;
    }

    // Close out your table.

    echo "</table>";
    echo 
    '<a href=' zen_href_link(FILENAME_SEARCH_LOG'''NONSSL'). '>' VIEW_SEARCH_LOG '</a>';
    ?>
    </div>
    Then, under your admin/includes/languages/english/index.php file, add the following content on top of the ?> tag:

    PHP Code:
    //---------------------------------------------
    //--- Search logs language definitions --------
    //---------------------------------------------
    define('SEARCHLOG_TERM''<b>Search Term</b>');
    define('SEARCHLOG_TOP_5''Search Log Top 5');
    define('SEARCHLOG_COUNT''<b>count</b>');
    define('VIEW_SEARCH_LOG''View Search Log');
    define('ENTRY_SEARCHLOG_ID_NOT_FOUND''Error: Search ID could not be found.');
    define('ENTRY_SEARCHLOG_EMPTY_ROWS''There are currently no search logs entries in your ' DB_PREFIXTABLE_SEARCHLOG ' table. '); 
    Then, under your admin/includes/languages/english/html_includes folder, create a filename called: searchlog.php (note: That is NOT a suggestion but as part of the steps).

    Then, add the following content inside:

    PHP Code:
    <?php
    //---------------------------------------------
    //--- Search logs language definitions --------
    //---------------------------------------------
    define('BOX_REPORTS_SEARCH_LOG','Search Log');
    define('HEADING_TITLE','Search Log');
    define('DATE_RANGE''<strong>Date Range </strong>');
    define('MATCH_SEARCH_TERM''<strong>Match search term </strong>');
    define('MATCH_SEARCH''<strong>Search Match </strong>');
    define('NUMBER_TIMES_SEARCHED_FOR''<b>Number of times searched for</b>');
    define('GLOBAL_ACTIONS''<strong>Global Actions </strong>');
    define('INFO''<strong>Info</strong>');
    define('COMING_SOON''<strong>coming soon</strong>');
    define('ENTRY_DELETE_LINK''[ DELETE ] <b>cannot undo</b>');
    define('ENTRY_SEARCHLOG_DELETE_SUCCESSFUL''Success ! Selected item deleted:');
    define('ENTRY_SEARCHLOG_DELETE_FAILED''Error: Failed to delete the selected item named:');
    define('SEARCHLOG_FAILED_TO_SELECT_FIELDS''Error: Failed to select one or more fields from the ' TABLE_SEARCHLOG '. It might, also, be possible that your table is empty.');
    define('SEARCHLOG_DATE''<b>Date</b>');
    define('SEARCHLOG_ACTION''<b>Action</b>');
    define('SEARCHLOG_SELECT_PAGE''<center>Select a Page</center>');
    define('SEARCHLOG_PREVIOUS_PAGE''<< Previous');
    define('SEARCHLOG_NEXT_PAGE''Next >>');
    define('COPYRIGHT_AUTHOR_URL''Built by: <a href=\"http://www.seamless-packages.co.uk\">Seamless-packages</a><br />Author: Warren Lloyd <br />Version: 0.1 beta');
    ?>
    Then, on your next package, make sure to include the following folder inside with the bug fixes:

    - includes/extra_datafiles/searchlog.php.

    Then, add this inside that file:

    PHP Code:
    <?php
    define
    ('TABLE_SEARCHLOG''search_log');
    ?>
    Once you're done with these insertions, this release should, now, be considered as a final release for bug fixes. From there, I will dig into my personal library to see if I can find the exporter modules in order to adapt them over Zen-Cart.

    Until then - enjoy !
    Last edited by TheOracle; 13 Jul 2006 at 04:21 AM.

  10. #40
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Search Log

    <p><a href="?action=deleteall"><? echo DELETE_ALL_ENTRIES; ?></a></p>
    <p><a href="searchlog-export.php"><? echo EXPORT_ALL_ENTRIES; ?></a></p>
    echo "<a href=\"searchlog.php\">Back to all results</a>";
    From your admin/searchlog.php file,

    replace these three lines

    with:

    PHP Code:
    <p><a href="<?php echo zen_href_link(FILENAME_SEARCH_LOG"action=deleteall""NONSSL"); ?>"><? echo DELETE_ALL_ENTRIES; ?></a></p>
    <p><a href="<?php echo zen_href_link("searchlog-export.php""""NONSSL"); ?>"><? echo EXPORT_ALL_ENTRIES; ?></a></p>
    echo "<a href="<?php echo zen_href_link(FILENAME_SEARCH_LOG"""NONSSL"); ?>">Back to all results</a>";
    These should do the trick for the next release as well.

 

 
Page 4 of 10 FirstFirst ... 23456 ... LastLast

Similar Threads

  1. Customer Search Log
    By CJPinder in forum Addon Admin Tools
    Replies: 60
    Last Post: 27 Jan 2023, 11:06 PM
  2. log of Search history
    By Genzai in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 14 May 2009, 08:08 PM
  3. Search log mod vs. user tracking
    By ashton0603 in forum General Questions
    Replies: 4
    Last Post: 30 Jan 2008, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg