Produktempfehlungen in Kategorieübersicht

Thema wurde von seba, 21. Januar 2016 erstellt.

  1. seba

    seba Neues Mitglied

    Registriert seit:
    7. Januar 2016
    Beiträge:
    4
    Danke erhalten:
    0
    Ich möchte die Produktempfehlungen als Slider in den Kategorieübersichten anzeigen...

    Leider konnte ich über die Suche keine Lösung finden - zumindest nicht für GX2...

    Wäre schön wenn mir jemand helfen könnte?
     
  2. seba

    seba Neues Mitglied

    Registriert seit:
    7. Januar 2016
    Beiträge:
    4
    Danke erhalten:
    0
    #2 seba, 22. Januar 2016
    Zuletzt bearbeitet: 22. Januar 2016
    quick & dirty:

    - Ordner + Datei anlegen
    /user_classes/overloads/TopProductsMainContentView/MyTopProductsMainContentView.inc.php

    PHP:
    <?php
    class MyTopProductsMainContentView extends MyTopProductsMainContentView_parent
    {
        protected 
    $customers_fsk18_display;
        protected 
    $customers_status_id;
        protected 
    $languages_id;
          protected 
    $categorie_id;

        protected function 
    set_validation_rules()
        {
            
    $this->validation_rules_array['customers_fsk18_display']    = array('type' => 'int');
            
    $this->validation_rules_array['customers_status_id']        = array('type' => 'int');
            
    $this->validation_rules_array['languages_id']                = array('type' => 'int');
            
    $this->validation_rules_array['categorie_id']                = array('type' => 'int');
        }

        protected function 
    build_sql_query()
        {
            
    $t_fsk_lock ''
        
            if(
    $this->customers_fsk18_display == 0)
            {
                
    $t_fsk_lock ' AND p.products_fsk18 != 1';
            }

            if(
    GROUP_CHECK == 'true')
            {
                
    $t_group_check ' AND p.group_permission_' $this->customers_status_id ' = 1 ';
            }

     if(
    $this->categorie_id != "")
     {              
        
            
    $t_new_products_query "SELECT 
                                        p.products_id
                                    FROM
                                        " 
    TABLE_PRODUCTS " p, 
                                        products_to_categories c
                                    WHERE
                                        p.products_status = '1' AND
                                        p.products_startpage = '1' AND
                                        " 
    $t_group_check "
                                        " 
    $t_fsk_lock 
                      p.products_id = c.products_id AND 
                      c.categories_id = " 
    $this->categorie_id "
                                    ORDER BY 
                                        p.products_startpage_sort ASC"
    ;
     }else{
            
    $t_new_products_query "SELECT 
                                        products_id
                                    FROM
                                        " 
    TABLE_PRODUCTS " p
                                    WHERE
                                        p.products_status = '1' AND
                                        p.products_startpage = '1'
                                        " 
    $t_group_check "
                                        " 
    $t_fsk_lock 
                                    ORDER BY 
                                        p.products_startpage_sort ASC"
    ;
    }                                   
            return 
    $t_new_products_query;  
        }  
    }
    in der templates/TEMPLATENAME/module/product_listing/product_listing_v1.html

    folgendes an gewünschte Stelle setzen:

    PHP:
    {php}
    if (isset(
    $_GET['cPath'])) {
      
    $cPath xtc_input_validation($_GET['cPath'], 'cPath''');
    } else {
      
    $cPath '';
    }
     
    if (
    xtc_not_null($cPath)) {
      
    $cPath_array xtc_parse_category_path($cPath);
      
    $cPath implode('_'$cPath_array);
      
    $current_category_id $cPath_array[(sizeof($cPath_array) - 1)];
    } else {
      
    $current_category_id 0;


    $coo_top_products_content_view2 MainFactory::create_object('TopProductsMainContentView');
    $coo_top_products_content_view2->set_('customers_fsk18_display'$_SESSION['customers_status']['customers_fsk18_display']);
    $coo_top_products_content_view2->set_('customers_status_id'$_SESSION['customers_status']['customers_status_id']);
    $coo_top_products_content_view2->set_('languages_id'$_SESSION['languages_id']);
    $coo_top_products_content_view2->set_('categorie_id'$current_category_id);

    $module_content_top $coo_top_products_content_view2->get_html();
    echo 
    $module_content_top;
    {/
    php}

    Nun werden in den Kategorieübersichten die Empfehlungen abhängig von der gewählten Kategorie angezeit...
    Wie gesagt, nicht ganz sauber - aber es funktioniert... ;)
     
  3. barbara

    barbara G-WARD 2014-2020

    Registriert seit:
    14. August 2011
    Beiträge:
    35.352
    Danke erhalten:
    11.198
    Danke vergeben:
    1.601
    Hallo Seba,

    zunächst danke für die Lösung.
    Bitte schreibe die Codes doch in eine Code-Box, dann ist es besser zu lesen und das Programm fügt keine Leerzeichen ein.
    Die Icons für Code-Boxen findest Du über dem Textfeld.
    Codebox.JPG
     
  4. Anonymous

    Anonymous Erfahrener Benutzer

    Registriert seit:
    26. Oktober 2011
    Beiträge:
    967
    Danke erhalten:
    149
    Danke vergeben:
    130
    @ Seba

    Wenn du das mit den Overloads machst, dann ist es auch Update sicher !