Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: t10: Suchbegriffstatistik - Hilfe

    Buggyboy

    • Fördermitglied
    • Beiträge: 968
    • Geschlecht:
    t10: Suchbegriffstatistik - Hilfe
    am: 26. Juni 2014, 13:22:29
    Hallo!

    Ich habe mir das Modul von t10 runtergeladen und eingebaut.
    Ich komme im letzten Teil nicht weiter.
    Dort muß etwas in die advanced_search_result.php eingetragen werden.
    Leider finde ich den Abschnitt bei mir so nicht.

    Hat das Modul schon jemand erfolgreich in die 105D eingebaut und könnte mir helfen?

    Das muß gemacht werden:

    /advanced_search_result.php

    Damit der Suchbegriff sowie die gefundenen Produkte gespeichert werden können, fügen Sie die folgenden Zeilen VOR dem Includen des Product Listing und Header ein.
    Suchen Sie nach (etwa Zeile 240)

    Code: PHP  [Auswählen]
    $_GET['keywords'] = urlencode($keywords);

    Fügen Sie danach ein:

    Code: PHP  [Auswählen]
    // @t10: Search Stats
    // @t10: make sure not to count "searches" originating from backend
    if (!isset($_GET['dnt'])) {
        require_once(DIR_WS_CLASSES . 't10.searchstats.php');

        // num products
        $q = xtc_db_query($listing_sql);
        $n = xtc_db_num_rows($q);

        $t10_stats = new t10_searchstats($keywords, $n);
        $t10_stats->save();
    }
    // @t10: Search Stats END

    Alles andere habe ich schon.
    Nur finde ich die Stelle in meiner Datei nicht.
    Hier mal meine php-Datei:

    Code: PHP  [Auswählen]
    <?php

    /* -----------------------------------------------------------------------------------------
       $Id: advanced_search_result.php 1141 2005-08-10 11:31:36Z novalis $  

       XT-Commerce - community made shopping
       http://www.(( Wir dulden keine kommerziellen Werbelinks - Bitte Forenregeln beachten! ))

       Copyright (c) 2005 XT-Commerce
       -----------------------------------------------------------------------------------------
       based on:
       (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
       (c) 2002-2003 osCommerce(advanced_search_result.php,v 1.68 2003/05/14); www.oscommerce.com
       (c) 2003      nextcommerce (advanced_search_result.php,v 1.17 2003/08/21); www.nextcommerce.org

       Released under the GNU General Public License
       ---------------------------------------------------------------------------------------*/

    define('SEARCH_IN_AUTOR', true);

    include ('includes/application_top.php');
    // create smarty elements
    $smarty = new Smarty;
    // include boxes
    require (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/boxes.php');
    // include needed functions
    require_once (DIR_FS_INC.'xtc_parse_search_string.inc.php');
    require_once (DIR_FS_INC.'xtc_get_subcategories.inc.php');
    require_once (DIR_FS_INC.'xtc_get_currencies_values.inc.php');


    // security fix
    //set $_GET variables for function xtc_get_all_get_params()
    $keywords = $_GET['keywords'] = isset($_GET['keywords']) && !empty($_GET['keywords']) ? stripslashes(trim(urldecode($_GET['keywords']))) : false;
    $pfrom = $_GET['pfrom'] = isset($_GET['pfrom']) && !empty($_GET['pfrom']) ? stripslashes($_GET['pfrom']) : false;
    $pto = $_GET['pto'] = isset($_GET['pto']) && !empty($_GET['pto']) ? stripslashes($_GET['pto']) : false;
    $manufacturers_id  = $_GET['manufacturers_id'] = isset($_GET['manufacturers_id']) && xtc_not_null($_GET['manufacturers_id']) ? (int)$_GET['manufacturers_id'] : false;
    $categories_id = $_GET['categories_id'] = isset($_GET['categories_id']) && xtc_not_null($_GET['categories_id']) ? (int)$_GET['categories_id'] : false;
    $_GET['inc_subcat'] = isset($_GET['inc_subcat']) && xtc_not_null($_GET['inc_subcat']) ? (int)$_GET['inc_subcat'] : 0;
    // reset error
    $errorno = 0;




    /*
     * check search entry
     */


    $error = 0; // reset error flag to false
    $errorno = 0;
    $keyerror = 0;

    $_GET['keywords'] = urldecode($_GET['keywords']); // web28 - 2011-03-27 - FIX page search results -> urldecode($_GET['keywords'])


    if (isset ($_GET['keywords']) && empty ($_GET['keywords'])) {
            $keyerror = 1;
    }

    if ((isset ($_GET['keywords']) && empty ($_GET['keywords'])) && (isset ($_GET['pfrom']) && empty ($_GET['pfrom'])) && (isset ($_GET['pto']) && empty ($_GET['pto']))) {
            $errorno += 1;
            $error = 1;
    }
    elseif (isset ($_GET['keywords']) && empty ($_GET['keywords']) && !(isset ($_GET['pfrom'])) && !(isset ($_GET['pto']))) {
            $errorno += 1;
            $error = 1;
    }

    if (strlen($_GET['keywords']) < 3 && strlen($_GET['keywords']) > 0 && $error == 0) {
            $errorno += 1;
            $error = 1;
            $keyerror = 1;
    }

    if (strlen($_GET['pfrom']) > 0) {
            $pfrom_to_check = xtc_db_input($_GET['pfrom']);
            if (!settype($pfrom_to_check, "double")) {
                    $errorno += 10000;
                    $error = 1;
            }
    }

    if (strlen($_GET['pto']) > 0) {
            $pto_to_check = $_GET['pto'];
            if (!settype($pto_to_check, "double")) {
                    $errorno += 100000;
                    $error = 1;
            }
    }

    if (strlen($_GET['pfrom']) > 0 && !(($errorno & 10000) == 10000) && strlen($_GET['pto']) > 0 && !(($errorno & 100000) == 100000)) {
            if ($pfrom_to_check > $pto_to_check) {
                    $errorno += 1000000;
                    $error = 1;
            }
    }

    if (strlen($_GET['keywords']) > 0) {
            if (!xtc_parse_search_string(stripslashes($_GET['keywords']), $search_keywords)) {
                    $errorno += 10000000;
                    $error = 1;
                    $keyerror = 1;
            }
    }

    if ($error == 1 && $keyerror != 1) {

            xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH, 'errorno='.$errorno.'&'.xtc_get_all_get_params(array ('x', 'y'))));

    } else {

            /*
             *    search process starts here
             */


            $breadcrumb->add(NAVBAR_TITLE1_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH));
            $breadcrumb->add(NAVBAR_TITLE2_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords='.htmlspecialchars(xtc_db_input($_GET['keywords'])) .'&search_in_description='.xtc_db_input($_GET['search_in_description']).'&categories_id='.(int)$_GET['categories_id'].'&inc_subcat='.xtc_db_input($_GET['inc_subcat']).'&manufacturers_id='.(int)$_GET['manufacturers_id'].'&pfrom='.xtc_db_input($_GET['pfrom']).'&pto='.xtc_db_input($_GET['pto']).'&dfrom='.xtc_db_input($_GET['dfrom']).'&dto='.xtc_db_input($_GET['dto']).'&autor='.xtc_db_input($_GET['autor'])));

            require (DIR_WS_INCLUDES.'header.php');

            // define additional filters //

            //fsk18 lock
            if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
                    $fsk_lock = " AND p.products_fsk18 != '1' ";
            } else {
                    unset ($fsk_lock);
            }

            //group check
            if (GROUP_CHECK == 'true') {
                    $group_check = " AND p.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 ";
            } else {
                    unset ($group_check);
            }

            //manufacturers if set
            if (isset ($_GET['manufacturers_id']) && xtc_not_null($_GET['manufacturers_id'])) {
                    $manu_check = " AND p.manufacturers_id = '".(int)$_GET['manufacturers_id']."' ";
            }

            if (isset ($_GET['autor']) && xtc_not_null($_GET['autor'])) {
                    $autor_check = " AND p.products_autor LIKE ('%".strip_tags(stripslashes($_GET['autor']))."%') ";
            }

            //include subcategories if needed
            if (isset ($_GET['categories_id']) && xtc_not_null($_GET['categories_id'])) {
                    if ($_GET['inc_subcat'] == '1') {
                            $subcategories_array = array ();
                            xtc_get_subcategories($subcategories_array, (int)$_GET['categories_id']);
                            $subcat_join = " LEFT OUTER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) ";
                            $subcat_where = " AND p2c.categories_id IN ('".(int) $_GET['categories_id']."' ";
                            foreach ($subcategories_array AS $scat) {
                                    $subcat_where .= ", '".$scat."'";
                            }
                            $subcat_where .= ") ";
                    } else {
                            $subcat_join = " LEFT OUTER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) ";
                            $subcat_where = " AND p2c.categories_id = '".(int) $_GET['categories_id']."' ";
                    }
            }

            if ($_GET['pfrom'] || $_GET['pto']) {
                    $rate = xtc_get_currencies_values($_SESSION['currency']);
                    $rate = $rate['value'];
                    if ($rate && $_GET['pfrom'] != '') {
                            $pfrom = $_GET['pfrom'] / $rate;
                    }
                    if ($rate && $_GET['pto'] != '') {
                            $pto = $_GET['pto'] / $rate;
                    }
            }

            //price filters
            if (($pfrom != '') && (is_numeric($pfrom))) {
                    $pfrom_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) >= ".$pfrom.") ";
            } else {
                    unset ($pfrom_check);
            }

            if (($pto != '') && (is_numeric($pto))) {
                    $pto_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) <= ".$pto." ) ";
            } else {
                    unset ($pto_check);
            }

            //build query
            //BOF - Hetfield - 2009-08-11 - BUGFIX: vpe in advanced_search_result
            $select_str = "SELECT distinct
                              p.products_id,
                              p.products_price,
                              p.products_model,
    p.products_ean,
                        p.products_autor,
                        p.products_zustand,
                        p.products_spieleranzahl,
                        p.products_spielzeit,
                        p.products_spielalter,
                              p.products_quantity,
                              p.products_shippingtime,
                              p.products_fsk18,
                              p.products_image,
                              p.products_weight,
                              p.products_tax_class_id,
                        p.products_vpe,
                        p.products_vpe_status,
                        p.products_vpe_value,
                              pd.products_name,
                              pd.products_short_description,
                              pd.products_description "
    ;
            //EOF - Hetfield - 2009-08-11 - BUGFIX: vpe in advanced_search_result
            $from_str  = "FROM ".TABLE_PRODUCTS." AS p LEFT JOIN ".TABLE_PRODUCTS_DESCRIPTION." AS pd ON (p.products_id = pd.products_id) ";
            $from_str .= $subcat_join;
            if (SEARCH_IN_ATTR == 'true') { $from_str .= " LEFT OUTER JOIN ".TABLE_PRODUCTS_ATTRIBUTES." AS pa ON (p.products_id = pa.products_id) LEFT OUTER JOIN ".TABLE_PRODUCTS_OPTIONS_VALUES." AS pov ON (pa.options_values_id = pov.products_options_values_id) "; }
            $from_str .= "LEFT OUTER JOIN ".TABLE_SPECIALS." AS s ON (p.products_id = s.products_id) AND s.status = '1'";

            if ((DISPLAY_PRICE_WITH_TAX == 'true') && ((isset ($_GET['pfrom']) && xtc_not_null($_GET['pfrom'])) || (isset ($_GET['pto']) && xtc_not_null($_GET['pto'])))) {
                    if (!isset ($_SESSION['customer_country_id'])) {
                            $_SESSION['customer_country_id'] = STORE_COUNTRY;
                            $_SESSION['customer_zone_id'] = STORE_ZONE;
                    }
                    $from_str .= " LEFT OUTER JOIN ".TABLE_TAX_RATES." tr ON (p.products_tax_class_id = tr.tax_class_id) LEFT OUTER JOIN ".TABLE_ZONES_TO_GEO_ZONES." gz ON (tr.tax_zone_id = gz.geo_zone_id) ";
                    $tax_where = " AND (gz.zone_country_id IS NULL OR gz.zone_country_id = '0' OR gz.zone_country_id = '".(int) $_SESSION['customer_country_id']."') AND (gz.zone_id is null OR gz.zone_id = '0' OR gz.zone_id = '".(int) $_SESSION['customer_zone_id']."')";
            } else {
                    unset ($tax_where);
            }

            //where-string
            $where_str = " WHERE p.products_status = '1' "." AND pd.language_id = '".(int) $_SESSION['languages_id']."'".$subcat_where.$fsk_lock.$manu_check.$autor_check.$group_check.$tax_where.$pfrom_check.$pto_check;


            //go for keywords... this is the main search process
            if (isset ($_GET['keywords']) && xtc_not_null($_GET['keywords'])) {
                    if (xtc_parse_search_string(stripslashes($_GET['keywords']), $search_keywords)) {
                            $where_str .= " AND ( ";
                            for ($i = 0, $n = sizeof($search_keywords); $i < $n; $i ++) {
                                    switch ($search_keywords[$i]) {
                                            case '(' :
                                            case ')' :
                                            case 'and' :
                                            case 'or' :
                                                    $where_str .= " ".$search_keywords[$i]." ";
                                                    break;
                                            default :
                                            // BOF - Dokuman - 2009-05-27 - search for umlaut letters
                                            //see http://www.gunnart.de/tipps-und-tricks/xtcommerce-suche-nach-umlauten/           
                                            /*
                                                    $where_str .= " ( ";
                                                    $where_str .= "pd.products_keywords LIKE ('%".addslashes($search_keywords[$i])."%') ";

    $where_str .= "OR p.products_ean LIKE ('%".addslashes($search_keywords[$i])."%') ";

                                                    if (SEARCH_IN_DESC == 'true') {
                                                       $where_str .= "OR pd.products_description LIKE ('%".addslashes($search_keywords[$i])."%') ";
                                                       $where_str .= "OR pd.products_short_description LIKE ('%".addslashes($search_keywords[$i])."%') ";
                                                    }                                              
                                                    $where_str .= "OR pd.products_name LIKE ('%".addslashes($search_keywords[$i])."%') ";
                                                    $where_str .= "OR p.products_model LIKE ('%".addslashes($search_keywords[$i])."%') ";

    $where_str .= "OR p.products_autor LIKE ('%".addslashes($search_keywords[$i])."%') ";
      $where_str .= "OR p.products_zustand LIKE ('%".addslashes($search_keywords[$i])."%') ";
      $where_str .= "OR p.products_spieleranzahl LIKE ('%".addslashes($search_keywords[$i])."%') ";
      $where_str .= "OR p.products_spielzeit LIKE ('%".addslashes($search_keywords[$i])."%') ";
      $where_str .= "OR p.products_spielalter LIKE ('%".addslashes($search_keywords[$i])."%') ";



                                                    if (SEARCH_IN_ATTR == 'true') {
                                                       $where_str .= "OR (pov.products_options_values_name LIKE ('%".addslashes($search_keywords[$i])."%') ";
                                                       $where_str .= "AND pov.language_id = '".(int) $_SESSION['languages_id']."')";
                                                    }
                                            */

                                           
                                            // Wurde nach Umlauten gesucht?
              $ent_keyword = htmlentities($search_keywords[$i]);
              $ent_keyword = ($ent_keyword != $search_keywords[$i]) ? addslashes($ent_keyword) : false;

              // addslashes langt einmal ...
              $keyword = addslashes($search_keywords[$i]);

              $where_str .= " ( ";
              $where_str .= "pd.products_keywords LIKE ('%".$keyword."%') ";
              $where_str .= ($ent_keyword) ? "OR pd.products_keywords LIKE ('%".$ent_keyword."%') " : '';
              if (SEARCH_IN_DESC == 'true') {
                 $where_str .= "OR pd.products_description LIKE ('%".$keyword."%') ";
                 $where_str .= ($ent_keyword) ? "OR pd.products_description LIKE ('%".$ent_keyword."%') " : '';
                 $where_str .= "OR pd.products_short_description LIKE ('%".$keyword."%') ";
                 $where_str .= ($ent_keyword) ? "OR pd.products_short_description LIKE ('%".$ent_keyword."%') " : '';
              }
              if (SEARCH_IN_AUTOR == 'true') {
                 $where_str .= "OR p.products_autor LIKE ('%".$keyword."%') ";
                 $where_str .= ($ent_keyword) ? "OR p.products_autor LIKE ('%".$ent_keyword."%') " : '';
              }
              $where_str .= "OR pd.products_name LIKE ('%".$keyword."%') ";
              $where_str .= ($ent_keyword) ? "OR pd.products_name LIKE ('%".$ent_keyword."%') " : '';
              $where_str .= "OR p.products_model LIKE ('%".$keyword."%') ";
              $where_str .= ($ent_keyword) ? "OR p.products_model LIKE ('%".$ent_keyword."%') " : '';
              if (SEARCH_IN_ATTR == 'true') {
                 $where_str .= "OR (pov.products_options_values_name LIKE ('%".$keyword."%') ";
                 $where_str .= ($ent_keyword) ? "OR pov.products_options_values_name LIKE ('%".$ent_keyword."%') " : '';
                 $where_str .= "AND pov.language_id = '".(int) $_SESSION['languages_id']."')";
              }
                                            // EOF - Dokuman - 2009-05-27 - search for umlaut letters
                                           
                                                    $where_str .= " ) ";
                                                    break;
                                    }
                            }
                            $where_str .= " ) GROUP BY p.products_id ORDER BY p.products_id ";
                    }
            }

            //glue together
            $listing_sql = $select_str.$from_str.$where_str;
            require (DIR_WS_MODULES.FILENAME_PRODUCT_LISTING);

    //BOC search keywords statistics, excluded admin in count, noRiddle  
            //Take search keywords into statistics #####
            $report_search_keywords = strtolower(addslashes($_GET['keywords']));
            $report_last_search = date("Y-m-d H:i:s");
            //verify whether keyword combination is already in data base #####
            $sql_query = "SELECT search_id, search_text FROM search_keywords WHERE search_text='".$report_search_keywords."'";
            $keywords_query=xtc_db_query($sql_query);
            //if keywords exist than only UPDATE otherwise INSERT INTO
        if ($_SESSION['customers_status']['customers_status_id'] != '0') {
            if (xtc_db_num_rows($keywords_query)) {
                xtc_db_query("UPDATE search_keywords SET hits=hits+1, last_search='".$report_last_search."' WHERE search_text='".$report_search_keywords."'");
            } else {
            //keywords not found in database
            xtc_db_query("insert into search_keywords (search_text, search_result, hits, last_search) values ('" .$report_search_keywords . "','" . $search_result . "','1','" . $report_last_search . "')");      
            }
        }
       //EOC search keywords statistics, excluded admin in count, noRiddle


    }
    $smarty->assign('language', $_SESSION['language']);
    $smarty->caching = 0;
    if (!defined(RM))
            $smarty->load_filter('output', 'note');
    $smarty->display(CURRENT_TEMPLATE.'/index.html');
    include ('includes/application_bottom.php');
    ?>

    Wäre nett wenn jemand helfen kann.
    t10 hab ich zwar schon angeschrieben, aber noch keine Reaktion...

    LG
    peter

    Linkback: https://www.modified-shop.org/forum/index.php?topic=30479.0

    Buggyboy

    • Fördermitglied
    • Beiträge: 968
    • Geschlecht:
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #1 am: 26. Juni 2014, 13:36:42
    Hi!

    Will mal eben selbst beantworten und nicht in meinem Thread ändern:

    Das Modul ist für 106 Modified.

    Für 105D:
    /advanced_search_result.php

    Suche:

    Code: PHP  [Auswählen]
    //glue together
            $listing_sql = $select_str.$from_str.$where_str;
            require (DIR_WS_MODULES.FILENAME_PRODUCT_LISTING);

    Und füge darunter ein:

    Code: PHP  [Auswählen]
    // @t10: Search Stats
    // @t10: make sure not to count "searches" originating from backend
    if (!isset($_GET['dnt'])) {
        require_once(DIR_WS_CLASSES . 't10.searchstats.php');

        // num products
        $q = xtc_db_query($listing_sql);
        $n = xtc_db_num_rows($q);

        $t10_stats = new t10_searchstats($keywords, $n);
        $t10_stats->save();
    }
    // @t10: Search Stats END

    Dann klappt es auch mit der Suche...

    Quelle: t10: Suchbegriffstatistik

    Bis peter

    fishnet

    • Fördermitglied
    • Beiträge: 4.821
    • Geschlecht:
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #2 am: 27. Juni 2014, 17:36:36
    Hi Peter,
    ja lustig, das im Download steht "für alle Versionen" und man es für 1.05 dann doch anpassen muss  :-P
    deine admin/t10_searchstats.php funktioniert ? Kannst du mir die mal schicken ?  Die aus dem Download funktioniert bei mir grad nicht und ich weiß nicht, ob es an der Datei oder an der Datenbank liegt... will nur grad die Datei ausschließen...  :-?
    Gruß
    Karsten

    fishnet

    • Fördermitglied
    • Beiträge: 4.821
    • Geschlecht:
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #3 am: 29. Juni 2014, 15:18:23
    Also, die Datei "t10.searchstats.php" scheint in einem 1.05 ohne SP nicht zu funktionieren... ich geb das mal weiter.

    0815

    • Viel Schreiber
    • Beiträge: 905
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #4 am: 04. September 2015, 14:19:11
    Hallo,

    gab's in der Angelegenheit evtl. zwischenzeitlich schon eine Lösung.

    Habe mir das Modul eben auch installiert (1.05.) und so weit zum Laufen bekommen, dass die Suchbegriffe in die Datenbank geschrieben und auch im Backend ausgegeben werden.

    Was jetzt leider nicht funktioniert ist die Produktzuordnung.
    Beim Klick auf den entsprechenden Button ändert sich die URL von /admin/t10_searchstats.php in /admin/t10_searchstats.php#. Sonst passiert leider nichts.

    Ich nehme an, dass hier das zugehörige Javascript nicht geladen wird, aber es könnte sicherlich auch ein anderes Problem vorliegen.
    Das error_reporting gibt schon mal keine Fehler aus.

    0815

    • Viel Schreiber
    • Beiträge: 905
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #5 am: 04. September 2015, 15:48:55
    Oh, ganz vergessen!

    Ich musste in der Datei noch folgende Zeile auskommentieren:
    Code: PHP  [Auswählen]
    $qSplit = new splitPageResults($_GET['page'], '20', $q, $qNumRows);

    Die Zeile hat zu einer SQL-Fehlermeldung geführt, wenn man im Backend die Statistik aufgerufen hat.
    Warum das so ist konnte ich noch nicht nachvollziehen.

    0815

    • Viel Schreiber
    • Beiträge: 905
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #6 am: 05. September 2015, 13:54:37
    Also laut Firebug werden alle Javascript Dateien korrekt geladen.
    Was nicht funktioniert ist der Aufruf des ausklappenden Suchmenüs.

    Der Aufruf soll wohl über die Klasse class="button toggleSearch" erfolgen.
    Bei mir scheint das leider nicht zu funktionieren.

    Woran könnte das liegen, bzw. wie kann man die Ursache ermitteln?

    0815

    • Viel Schreiber
    • Beiträge: 905
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #7 am: 05. September 2015, 16:33:39
    OK, Fehler gefunden!

    Das über die PHP-Datei geladene Script t10.helper.js, welches vermutlich für die kostenpflichtige Varaiante des Moduls benötigt wird, steht in Konflikt mit der Datei t10.searchstats.js.

    Kommentiert man also folgende Zeile in der /admin/t10_searchstats.php (die in der kostenfreien Variante des Moduls offensichtlich gar nicht benötigt wird) aus ...
    Code: PHP  [Auswählen]
    <script src="includes/javascript/t10.helper.js"></script>
    ... dann funktioniert auch die Produktzuordnung.

    Auch den Fehler bzgl.
    Code: PHP  [Auswählen]
    $qSplit = new splitPageResults($_GET['page'], '20', $q, $qNumRows);
    konnte ich beseitigen.
    Ich habe einfach die Datei /admin/includes/classes/split_page_results.php durch eine aktuelle Version ersetzt.

    wicki

    • Frisch an Board
    • Beiträge: 91
    • Geschlecht:
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #8 am: 14. September 2015, 20:09:40
    shop 106 modified
    advance_search_result.php

    suchen nach
    Code: PHP  [Auswählen]
    $_GET['keywords'] = urlencode($keywords);

    fügen sie danach
    Code: PHP  [Auswählen]
    // @t10: Search Stats
    // @t10: make sure not to count "searches" originating from backend
    if (!isset($_GET['dnt'])) {
        require_once(DIR_WS_CLASSES . 't10.searchstats.php');

        // num products
        $q = xtc_db_query($listing_sql);
        $n = xtc_db_num_rows($q);

        $t10_stats = new t10_searchstats($keywords, $n);
        $t10_stats->save();
    }
    // @t10: Search Stats END

    nur stehe ich bei dem satz an
    (Damit der Suchbegriff sowie die gefundenen Produkte gespeichert werden können, fügen Sie die folgenden Zeilen VOR dem Includen des Product Listing und Header ein.)

    habe es so gemacht....aber irgendwie ist da was falsch

    Code: PHP  [Auswählen]
    <?php
    /* -----------------------------------------------------------------------------------------
       $Id: advanced_search_result.php 3413 2012-08-10 15:53:56Z web28 $

       modified eCommerce Shopsoftware
       http://www.modified-shop.org

       Copyright (c) 2009 - 2013 [www.modified-shop.org]
       -----------------------------------------------------------------------------------------
       based on:
       (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
       (c) 2002-2003 osCommerce(advanced_search_result.php,v 1.68 2003/05/14); www.oscommerce.com
       (c) 2003 nextcommerce (advanced_search_result.php,v 1.17 2003/08/21); www.nextcommerce.org
       (c) 2006 XT-Commerce (advanced_search_result.php 1141 2005-08-10)

       Released under the GNU General Public License
       ---------------------------------------------------------------------------------------*/


    include ('includes/application_top.php');

    // create smarty elements
    $smarty = new Smarty;

    // include boxes
    require (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/boxes.php');

    // include needed functions
    require_once (DIR_FS_INC.'xtc_parse_search_string.inc.php');
    require_once (DIR_FS_INC.'xtc_get_subcategories.inc.php');
    require_once (DIR_FS_INC.'xtc_get_currencies_values.inc.php');

    // security fix
    //set $_GET variables for function xtc_get_all_get_params()
    $keywords = $_GET['keywords'] = isset($_GET['keywords']) && !empty($_GET['keywords']) ? stripslashes(trim(urldecode($_GET['keywords']))) : false;
    $pfrom = $_GET['pfrom'] = isset($_GET['pfrom']) && !empty($_GET['pfrom']) ? stripslashes($_GET['pfrom']) : false;
    $pto = $_GET['pto'] = isset($_GET['pto']) && !empty($_GET['pto']) ? stripslashes($_GET['pto']) : false;
    $manufacturers_id  = $_GET['manufacturers_id'] = isset($_GET['manufacturers_id']) && xtc_not_null($_GET['manufacturers_id']) ? (int)$_GET['manufacturers_id'] : false;
    $categories_id = $_GET['categories_id'] = isset($_GET['categories_id']) && xtc_not_null($_GET['categories_id']) ? (int)$_GET['categories_id'] : false;
    $_GET['inc_subcat'] = isset($_GET['inc_subcat']) && xtc_not_null($_GET['inc_subcat']) ? (int)$_GET['inc_subcat'] : null;
    // reset error
    $errorno = 0;

    // error check
    if ($keywords && strlen($keywords) < 3 && strlen($keywords) > 0) {
      $errorno += 1;
    }
    if (!$keywords && !$pfrom && !$pto && isset($_GET['x'])) {
      $errorno += 1;
    }
    if ($pfrom && !settype($pfrom, "float")) {
      $errorno += 10000;
    }
    if ($pto && !settype($pto, "float")) {
      $errorno += 100000;
    }
    if ($pfrom && !(($errorno & 10000) == 10000) && $pto && !(($errorno & 100000) == 100000) && $pfrom > $pto) {
      $errorno += 1000000;
    }
    if ($keywords && !xtc_parse_search_string($keywords, $search_keywords)) {
      $errorno += 10000000;
    }

    if ($errorno) {
      xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH, 'errorno='.$errorno.'&'.xtc_get_all_get_params()));

    } else {

      // build breadcrumb
      $breadcrumb->add(NAVBAR_TITLE1_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH));
      $breadcrumb->add(NAVBAR_TITLE2_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, xtc_get_all_get_params()));

      // default values
      $subcat_join  = '';
      $subcat_where = '';
      $tax_where    = '';
      $cats_list    = '';
      $left_join    = '';

      // fsk18 lock
      $fsk_lock = $_SESSION['customers_status']['customers_fsk18_display'] == '0' ? " AND p.products_fsk18 != '1' " : "";

      // group check
      $group_check = GROUP_CHECK == 'true' ? " AND p.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 " : "";

      // manufacturers check
      $manu_check = $manufacturers_id !== false ? " AND p.manufacturers_id = '".$manufacturers_id."' " : "";

      //include subcategories if needed
      if ($categories_id !== false) {
        if (isset($_GET['inc_subcat']) && $_GET['inc_subcat'] == '1') {
          $subcategories_array = array();
          xtc_get_subcategories($subcategories_array, $categories_id);
          $subcat_join = " LEFT OUTER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) ";
          $subcat_where = " AND p2c.categories_id IN ('".$categories_id."' ";
          foreach ($subcategories_array AS $scat) {
            $subcat_where .= ", '".$scat."'";
          }
          $subcat_where .= ") ";
        } else {
          $subcat_join = " LEFT OUTER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) ";
          $subcat_where = " AND p2c.categories_id = '".$categories_id."' ";
        }
      }

      // price by currency
      $NeedTax = false;
      if ($pfrom || $pto) {
        $rate = xtc_get_currencies_values($_SESSION['currency']);
        $rate = $rate['value'];
        if ($rate && $pfrom) {
          $pfrom = $pfrom / $rate;
        }
        if ($rate && $pto) {
          $pto = $pto / $rate;
        }
        if($_SESSION['customers_status']['customers_status_show_price_tax']) {
          $NeedTax = true;
        }
      }
     
      //price filters
      if (($pfrom != '') && (is_numeric($pfrom))) {
        if($NeedTax)
          $pfrom_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) >= round((".$pfrom."/(1+tax_rate/100)),".PRICE_PRECISION.") ) ";
        else
          $pfrom_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) >= round(".$pfrom.",".PRICE_PRECISION.") ) ";
      } else {
        $pfrom_check = '';
      }

      if (($pto != '') && (is_numeric($pto))) {
        if($NeedTax)
          $pto_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) <= round((".$pto."/(1+tax_rate/100)),".PRICE_PRECISION.") ) ";
        else
          $pto_check = " AND (IF(s.status = '1' AND p.products_id = s.products_id, s.specials_new_products_price, p.products_price) <= round(".$pto.",".PRICE_PRECISION.") ) ";
      } else {
        $pto_check = '';
      }

      //build query
      $add_select = 'p.products_manufacturers_model,';
      $select_str = "SELECT distinct
                        $add_select
                        p.products_id,
                        p.products_ean,
                        p.products_quantity,
                        p.products_shippingtime,
                        p.products_model,
                        p.products_image,
                        p.products_price,
                        p.products_weight,
                        p.products_tax_class_id,
                        p.products_fsk18,
                        p.products_vpe,
                        p.products_vpe_status,
                        p.products_vpe_value,
                        pd.products_name,
                        pd.products_short_description,
                        pd.products_description "
    ;

      $from_str  = "FROM ".TABLE_PRODUCTS." AS p LEFT JOIN ".TABLE_PRODUCTS_DESCRIPTION." AS pd ON (p.products_id = pd.products_id) ";
      $from_str .= $subcat_join;
      $from_str .= SEARCH_IN_ATTR == 'true' ? " LEFT OUTER JOIN ".TABLE_PRODUCTS_ATTRIBUTES." AS pa ON (p.products_id = pa.products_id) LEFT OUTER JOIN ".TABLE_PRODUCTS_OPTIONS_VALUES." AS pov ON (pa.options_values_id = pov.products_options_values_id) " : "";
      $from_str .= "LEFT OUTER JOIN ".TABLE_SPECIALS." AS s ON (p.products_id = s.products_id) AND s.status = '1'";

      if($NeedTax) {
        if (!isset ($_SESSION['customer_country_id'])) {
          $_SESSION['customer_country_id'] = STORE_COUNTRY;
          $_SESSION['customer_zone_id'] = STORE_ZONE;
        }
        $from_str .= " LEFT OUTER JOIN ".TABLE_TAX_RATES." tr ON (p.products_tax_class_id = tr.tax_class_id) LEFT OUTER JOIN ".TABLE_ZONES_TO_GEO_ZONES." gz ON (tr.tax_zone_id = gz.geo_zone_id) ";
        $tax_where = " AND (gz.zone_country_id IS NULL OR gz.zone_country_id = '0' OR gz.zone_country_id = '".(int) $_SESSION['customer_country_id']."') AND (gz.zone_id is null OR gz.zone_id = '0' OR gz.zone_id = '".(int) $_SESSION['customer_zone_id']."')";
      }

      //where-string
      $where_str = "
      WHERE p.products_status = 1
      AND pd.language_id = '"
    .$_SESSION['languages_id']."'"  
      .$subcat_where
      .$fsk_lock
      .$manu_check
      .$group_check
      .$tax_where
      .$pfrom_check
      .$pto_check;

      //go for keywords... this is the main search process
      if ($keywords) {
        if (xtc_parse_search_string($keywords, $search_keywords)) {
          $where_str .= " AND ( ";
          for ($i = 0, $n = sizeof($search_keywords); $i < $n; $i ++) {
            switch ($search_keywords[$i]) {
              case '(' :
              case ')' :
              case 'and' :
              case 'or' :
                $where_str .= " ".$search_keywords[$i]." ";
                break;
              default :
              $ent_keyword = encode_htmlentities($search_keywords[$i]); // umlauts
              $ent_keyword = $ent_keyword != $search_keywords[$i] ? addslashes($ent_keyword) : false;
              $keyword = addslashes($search_keywords[$i]);
              $where_str .= " ( ";
              $where_str .= "pd.products_keywords LIKE ('%".$keyword."%') ";
              $where_str .= $ent_keyword ? "OR pd.products_keywords LIKE ('%".$ent_keyword."%') " : '';
              if (SEARCH_IN_DESC == 'true') {
                 $where_str .= "OR pd.products_description LIKE ('%".$keyword."%') ";
                 $where_str .= $ent_keyword ? "OR pd.products_description LIKE ('%".$ent_keyword."%') " : '';
                 $where_str .= "OR pd.products_short_description LIKE ('%".$keyword."%') ";
                 $where_str .= $ent_keyword ? "OR pd.products_short_description LIKE ('%".$ent_keyword."%') " : '';
              }
              $where_str .= "OR pd.products_name LIKE ('%".$keyword."%') ";
              $where_str .= $ent_keyword ? "OR pd.products_name LIKE ('%".$ent_keyword."%') " : '';
              $where_str .= "OR p.products_model LIKE ('%".$keyword."%') ";
              $where_str .= $ent_keyword ? "OR p.products_model LIKE ('%".$ent_keyword."%') " : '';
              $where_str .= "OR p.products_ean LIKE ('%".$keyword."%') ";
              $where_str .= $ent_keyword ? "OR p.products_ean LIKE ('%".$ent_keyword."%') " : '';
              $where_str .= "OR p.products_manufacturers_model LIKE ('%".$keyword."%') ";
              $where_str .= $ent_keyword ? "OR p.products_manufacturers_model LIKE ('%".$ent_keyword."%') " : '';
              if (SEARCH_IN_ATTR == 'true') {
                $where_str .= "OR pa.attributes_model LIKE ('%".$keyword."%') ";
                $where_str .= ($ent_keyword) ? "OR pa.attributes_model LIKE ('%".$ent_keyword."%') " : '';
                $where_str .= "OR pa.attributes_ean LIKE ('%".$keyword."%') ";
                $where_str .= ($ent_keyword) ? "OR pa.attributes_ean LIKE ('%".$ent_keyword."%') " : '';
                $where_str .= "OR (pov.products_options_values_name LIKE ('%".$keyword."%') ";
                $where_str .= ($ent_keyword) ? "OR pov.products_options_values_name LIKE ('%".$ent_keyword."%') " : '';
                $where_str .= "AND pov.language_id = '".(int) $_SESSION['languages_id']."')";
              }
              $where_str .= " ) ";
              break;
            }
          }
          $where_str .= " ) GROUP BY p.products_id ORDER BY p.products_id ";
        }
      }

      // glue together
      $listing_sql = $select_str.$from_str.$where_str;

      $_GET['keywords'] = urlencode($keywords);
      require (DIR_WS_MODULES.FILENAME_PRODUCT_LISTING);
      // @t10: Search Stats
      // @t10: make sure not to count "searches" originating from backend
      if (!isset($_GET['dnt'])) {
      require_once(DIR_WS_CLASSES . 't10.searchstats.php');

        // num products
        $q = xtc_db_query($listing_sql);
        $n = xtc_db_num_rows($q);

        $t10_stats = new t10_searchstats($keywords, $n);
        $t10_stats->save();
    }
    // @t10: Search Stats END
      require (DIR_WS_INCLUDES.'header.php');
    }
    $smarty->assign('language', $_SESSION['language']);
    if (!defined('RM')) {
      $smarty->load_filter('output', 'note');
    }
    $smarty->display(CURRENT_TEMPLATE.'/index.html');
    include ('includes/application_bottom.php');
    ?>

    karsta.de

    • Experte
    • Beiträge: 3.048
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #9 am: 14. September 2015, 23:00:31
    entfernt

    0815

    • Viel Schreiber
    • Beiträge: 905
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #10 am: 14. September 2015, 23:09:18
    Meine bisherige Erfahrung mit dem Modul hat leider gezeigt, dass u.a. sehr viele Suchanfragen durch den Google AdsBot ausgelöst werden. Dies geschieht leider mehrfach täglich und das meistens mit identischen Suchanfragen, die i.d.R. dann auch rein gar nichts mit der Produktpalette zu tun haben.

    Um die Statistik von solchen Suchanfragen zu bereinigen, habe ich in die Datei /includes/t10.searchstats.php noch folgenden Code eingefügt:

    Suchen nach:
    Code: PHP  [Auswählen]
    // save the queryn to database
            public function save() {
                   
                    if (empty($this->query))
                            return false;
    Danach einfügen:
    Code: PHP  [Auswählen]
     function crawlerDetect($USER_AGENT) {
                 $crawlers_agents = 'AdsBot-Google|AdsBot-Google-Mobile|AdsBot|Google|GoogleBot|Googlebot|TwengaBot|Bot|Spider|spider|Crawler|crawler';
                 $crawlers = explode('|', $crawlers_agents);
            foreach($crawlers as $crawler) {
            if ( strpos($USER_AGENT, $crawler)!== false)
                return true;
                            }
                return false;
            }

    if(crawlerDetect($_SERVER['HTTP_USER_AGENT']) === true)
    return false;

    Die Werte für $crawlers_agents kann man natürlich individuell ändern/erweitern.

    Bonner

    • Fördermitglied
    • Beiträge: 848
    • Geschlecht:
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #11 am: 16. September 2015, 11:12:31
    Danke für den Tip, 0815!

    Das es die Datei 2x gibt: der richtige Pfad ist shoproot/includes/classes/t10.searchstats.php  ;-)

    Bonner

    0815

    • Viel Schreiber
    • Beiträge: 905
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #12 am: 16. September 2015, 11:23:19
    Uuuups, stimmt!  :thumbs:

    ... und für den Fall, dass ich es noch nicht erwähnt habe, ich finde das Modul total krass! ... macht Spaß damit zu arbeiten und es bringt auch richtig was, denn nun laufen erheblich weniger Suchanfragen ins leere.

    Vermutlich werde ich an der Bot-Erkennung noch ein wenig optimieren, denn es tauchen bei mir noch immer einige Suchanfragen auf die keinen Sinn ergeben, mehrfach täglich aufgerufen werden, aber die zugehörige IP in der access_log keinen Bot/Crawler ausweist.

    total10

    • Neu im Forum
    • Beiträge: 29
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #13 am: 16. September 2015, 17:20:27
    Hallo 0815,

    freut mich, dass dir unser Modul gefällt - wenn du nichts dagegen hast würde ich mir das hinsichtlich des Adwordsbots gerne mal ansehen, vielleicht kannst du mir da mal einen oder zwei Einträge aus dem Access-Log schicken ? mb[at]t10.de
    Ich sehe es häufig, dass z.B. Adwords anzeigen direkt auf eine gefüllte Suche gehen, diese erscheinen dann natürlich in dem Modul weit oben, aber dass sind i.d.R. schon echte Besucher, dass mit den Crawlern habe ich so noch nicht gesehen.

    Mit besten Grüßen aus Hamburg

    Mario

    0815

    • Viel Schreiber
    • Beiträge: 905
    Re: t10: Suchbegriffstatistik - Hilfe
    Antwort #14 am: 16. September 2015, 17:32:11
    Hallo,

    die Einträge in der access_log enden jeweils auf

    HTTP/1.1" 200 5996 "-" "AdsBot-Google (+http://www.google.com/adsbot.html)

    oder

    HTTP/1.1" 200 7765 "-" "AdsBot-Google-Mobile (+http://www.google.com/mobile/adsbot.html)
    rechtstexte für onlineshop
    181 Antworten
    35845 Aufrufe
    26. April 2024, 14:58:39 von HaldOn
    2 Antworten
    2265 Aufrufe
    21. Februar 2016, 16:28:45 von tuvalu
    7 Antworten
    3253 Aufrufe
    17. April 2014, 23:38:10 von rico41
    31 Antworten
    16658 Aufrufe
    13. Oktober 2012, 21:47:37 von vsell
               
    anything