Projekt

Allgemein

Profil

Revision 1

Unterschiede anzeigen:

api/autocomplete/autocomplete.php
1
<?php
2
/* -----------------------------------------------------------------------------------------
3
   $Id: autocomplete.php 13450 2021-03-05 16:29:46Z GTB $
4

  
5
   modified eCommerce Shopsoftware
6
   http://www.modified-shop.org
7

  
8
   Copyright (c) 2009 - 2013 [www.modified-shop.org]
9
   -----------------------------------------------------------------------------------------
10
   Released under the GNU General Public License
11
   ---------------------------------------------------------------------------------------*/
12

  
13
  chdir('../../');
14
  include('includes/application_top.php');
15

  
16

  
17
  // include needed functions
18
  require_once (DIR_FS_INC.'xtc_parse_search_string.inc.php');
19
  
20
  $module_smarty = new Smarty;
21
  $module_smarty->assign('language', $_SESSION['language']);
22
  
23
  if (isset($_POST['queryString'])) {
24
    
25
    $from_str = $where_str = '';
26
    
27
    $queryString = stripslashes(trim(decode_utf8(urldecode($_POST['queryString']))));    
28
    $categories_id = !empty($_POST['categories_id']) ? (int)$_POST['categories_id'] : false;
29
    $inc_subcat = !empty($_POST['inc_subcat']) ? (int)$_POST['inc_subcat'] : null;
30

  
31
    // create $search_keywords array
32
    $keywordcheck = xtc_parse_search_string($queryString, $search_keywords);
33
        
34
    if ($keywordcheck === true && mb_strlen($queryString, $_SESSION['language_charset']) >= SEARCH_AC_MIN_LENGTH) {
35
      
36
      $from_str .= SEARCH_IN_ATTR == 'true' ? " LEFT OUTER JOIN ".TABLE_PRODUCTS_ATTRIBUTES." AS pa ON (p.products_id = pa.products_id) 
37
                                                LEFT OUTER JOIN ".TABLE_PRODUCTS_OPTIONS_VALUES." AS pov ON (pa.options_values_id = pov.products_options_values_id) " : "";
38
      $from_str .= SEARCH_IN_MANU == 'true' ? " LEFT OUTER JOIN ".TABLE_MANUFACTURERS." AS m ON (p.manufacturers_id = m.manufacturers_id) " : "";
39

  
40
      if (SEARCH_IN_FILTER == 'true') {
41
        $from_str .= "LEFT JOIN ".TABLE_PRODUCTS_TAGS." pt ON (pt.products_id = p.products_id)
42
                      LEFT JOIN ".TABLE_PRODUCTS_TAGS_VALUES." ptv ON (ptv.options_id = pt.options_id AND ptv.values_id = pt.values_id AND ptv.status = '1' AND ptv.languages_id = '".(int)$_SESSION['languages_id']."') ";
43
      }
44

  
45
      //include subcategories if needed
46
      if ($categories_id !== false) {
47
        if ($inc_subcat == '1') {
48
          $subcategories_array = array();
49
          xtc_get_subcategories($subcategories_array, $categories_id);
50
          $from_str .= " LEFT OUTER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) ";
51
          $where_str .= " AND p2c.categories_id IN ('".$categories_id."' ";
52
          foreach ($subcategories_array AS $scat) {
53
            $where_str .= ", '".$scat."'";
54
          }
55
          $where_str .= ") ";
56
        } else {
57
          $from_str .= " LEFT OUTER JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) ";
58
          $where_str .= " AND p2c.categories_id = '".$categories_id."' ";
59
        }
60
      }
61
      
62
      include(DIR_WS_INCLUDES.'build_search_query.php');
63
      
64
      $where_str .= " ) ";
65
                                                   
66
      $autocomplete_search_query = "SELECT ".$product->default_select."
67
                                      FROM ".TABLE_PRODUCTS." p 
68
                                      JOIN ".TABLE_PRODUCTS_DESCRIPTION." pd 
69
                                           ON p.products_id = pd.products_id
70
                                              AND pd.language_id = '".(int)$_SESSION['languages_id']."'
71
                                              AND trim(pd.products_name) != ''
72
                                           ".$from_str."
73
                                     WHERE p.products_status = '1' 
74
                                            ".$where_str."
75
                                            ".PRODUCTS_CONDITIONS_P."
76
                                   GROUP BY p.products_id 
77
                                   ORDER BY p.products_id ASC
78
                                      LIMIT ".MAX_DISPLAY_ADVANCED_SEARCH_RESULTS;
79
      
80
      $autocomplete_search_query = xtc_db_query($autocomplete_search_query);                      
81
      if (xtc_db_num_rows($autocomplete_search_query) > 0) {
82
        $module_content = array();
83
        while ($autocomplete_search = xtc_db_fetch_array($autocomplete_search_query)) {
84
          $module_content[] = $product->buildDataArray($autocomplete_search);
85
        }
86
        $module_smarty->assign('module_content', $module_content);
87
      } else {
88
        $module_smarty->assign('error', 'true');
89
      }
90
      $module_smarty->caching = 0;
91
      $module_smarty->display(CURRENT_TEMPLATE.'/module/autocomplete.html');
92
    }
93
  }
94
?>
templates/tpl_modified/lang/lang_english.custom
1
zoomtext = 'For a larger view click on the thumbnail'
2
products_desc = 'Products description'
3
products_fsk18_check = 'This article can be purchased only after age verification.'
4
products_manufacturer_model = 'MPN:'
5
products_tags = 'Features'
6
heading_products_tags = 'Product Features'
7

  
8
first = '&laquo; first'
9
back = '&laquo; back'
10
overview = 'Overview'
11
next = 'next &raquo;'
12
last = 'last &raquo;'
13

  
14
heading_miscellaneous = 'Payment methods'
15
text_miscellaneous = 'Die Box kann unter tpl_modified/boxes/box_miscellaneous.html ver&auml;ndert werden. Die Sprachvariablen befinden sich in der Datei tpl_modified/lang/german/lang_german.custom.'
16

  
17
ab_admin = 'Adminarea'
18
ab_orders = 'Orders'
19
ab_contentmanager = 'Content Manager'
20
ab_customers = 'Customers'
21
ab_category = 'Category/Products'
22
ab_logoff = 'Logoff'
23
ab_news = 'News'
24
ab_offline = 'Shop Offline'
25
ab_update = 'Update'
26
ab_support = 'Support'
27
ab_shop = 'Shop'
28
ab_caching = 'Caching'
29

  
30
ab_edit_content = 'Edit content'
31
ab_edit_product = 'Edit product'
32
ab_edit_attributes = 'Edit product attributes'
33
ab_edit_category = 'Edit category'
34
ab_edit_xsell = 'Edit cross selling'
35
ab_edit_tags = 'Product features'
36

  
37
info_reviews = 'Reviews:'
38
info_review = 'Review:'
39

  
40
heading_trustedshops = 'Trusted Shops'
41

  
42
text_search_again = 'Sorry, we could not find a product matching your search request'
43

  
44
listing_listview = 'List view'
45
listing_boxview = 'Box view'
templates/tpl_modified/lang/lang_german.custom
1
zoomtext = 'F&uuml;r eine gr&ouml;&szlig;ere Ansicht klicken Sie auf das Vorschaubild'
2
products_desc = 'Produktbeschreibung'
3
products_fsk18_check = 'Dieser Artikel kann erst nach erfolgter Altersverifikation gekauft werden.'
4
products_manufacturer_model = 'HAN:'
5
products_tags = 'Eigenschaften'
6
heading_products_tags = 'Produkteigenschaften'
7

  
8
first = '&laquo; Erster'
9
back = '&laquo; vorheriger'
10
overview = '&Uuml;bersicht'
11
next = 'n&auml;chster &raquo;'
12
last = 'Letzter &raquo;'
13

  
14
heading_miscellaneous = 'Zahlungsmethoden'
15
text_miscellaneous = 'Die Box kann unter tpl_modified/boxes/box_miscellaneous.html ver&auml;ndert werden. Die Sprachvariablen befinden sich in der Datei tpl_modified/lang/german/lang_german.custom.'
16

  
17
ab_admin = 'Adminbereich'
18
ab_orders = 'Bestellungen'
19
ab_contentmanager = 'Content Manager'
20
ab_customers = 'Kunden'
21
ab_category = 'Kategorien/Artikel'
22
ab_logoff = 'Abmelden'
23
ab_news = 'News'
24
ab_offline = 'Shop Offline'
25
ab_update = 'Update'
26
ab_support = 'Support'
27
ab_shop = 'Shop'
28
ab_caching = 'Caching'
29

  
30
ab_edit_content = 'Content bearbeiten'
31
ab_edit_product = 'Artikel bearbeiten'
32
ab_edit_attributes = 'Attribute editieren'
33
ab_edit_category = 'Kategorie bearbeiten'
34
ab_edit_xsell = 'Cross Selling bearbeiten'
35
ab_edit_tags = 'Artikeleigenschaften'
36

  
37
info_reviews = 'Bewertungen:'
38
info_review = 'Bewertung:'
39

  
40
heading_trustedshops = 'Trusted Shops'
41

  
42
text_search_again = 'Die Suche ergab keine genauen Treffer'
43

  
44
listing_listview = 'Listenansicht'
45
listing_boxview = 'Boxansicht'
templates/tpl_modified/module/autocomplete.html
1
{config_load file="$language/lang_$language.conf" section="error_handler"}
2
{config_load file="lang_`$language`.custom"}
3
{config_load file="lang_`$language`.section" section="error_handler"}
4
{if $error}
5
  <span class="autocomplete_error">{#text_search_again#}</span>
6
{else}
7
  <ul id="autocomplete_main">
8
    {foreach item=products_data from=$module_content}
9
      <li class="cf autocomplete_content">
10
        <a class="autocomplete cf" href="{$products_data.PRODUCTS_LINK}">
11
          {if $products_data.PRODUCTS_IMAGE}
12
            <span class="autocomplete_image cf"><img src="{$products_data.PRODUCTS_IMAGE}" alt="{$products_data.PRODUCTS_NAME|onlytext}" title="{$products_data.PRODUCTS_NAME|onlytext}" /></span>
13
          {else}
14
            <span class="autocomplete_image cf">&nbsp;</span>
15
          {/if}
16
          <span class="hl_text" style="width:145px;">{$products_data.PRODUCTS_NAME}</span>
17
          <span class="hl_price" style="color:#555">
18
            {foreach name=inner item=price_data from=$products_data.PRODUCTS_PRICE_ARRAY}
19
              {include file="module/includes/price_box.html"}
20
            {/foreach}
21
            {if $products_data.PRODUCTS_PRICE_ARRAY.0.PRODUCTS_PRICE_FLAG != 'NotAllowed'}
22
              {if $products_data.PRODUCTS_VPE}<div class="lb_vpe" style="position:inherit;font-weight: normal;">{$products_data.PRODUCTS_VPE}</div>{/if}
23
            {/if}
24
          </span>
25
        </a>
26
      </li>
27
    {/foreach}            
28
  </ul>
29
  
30
  <ul id="autocomplete_pagination" class="cf">
31
    <li id="autocomplete_prev">&laquo;</li>
32
    <li id="autocomplete_count"></li>
33
    <li id="autocomplete_next">&raquo;</li>
34
  </ul>
35
{/if}
templates/tpl_modified/module/sub_categories_listing.html
1
{config_load file="$language/lang_$language.conf" section="categorie_listing"}
2
{config_load file="lang_`$language`.custom"}
3
{config_load file="lang_`$language`.section" section="categorie_listing"}
4
{if isset($categories_content) && $categories_content != '' && $TR_COLS > 0}
5
<h4>{#heading_more_categories#}</h4>
6
<div class="subcats cf">
7
  {foreach name=aussen item=categories_data from=$categories_content key=spalten}
8
  <div class="subcatlist{if $smarty.foreach.aussen.iteration is div by $TR_COLS} last{/if}">
9
    <a href="{$categories_data.CATEGORIES_LINK}">
10
      {if $categories_data.CATEGORIES_IMAGE}<span class="subcat_image"><span class="subcat_image_inner"><img src="{$categories_data.CATEGORIES_IMAGE}" alt="{$categories_data.CATEGORIES_NAME|onlytext}" /></span></span>{/if}
11
      <span class="subcat_title"><span class="subcat_title_inner">{$categories_data.CATEGORIES_NAME}</span></span>
12
    </a>
13
    {* <span class="subcat_desc">{$categories_data.CATEGORIES_DESCRIPTION}</span> *}
14
  </div>
15
  {if $smarty.foreach.aussen.iteration is div by $TR_COLS}<br class="clearfix" />{/if}
16
  {/foreach}
17
</div>
18
{/if}
templates/tpl_modified_responsive/lang/lang_english.custom
1
zoomtext = 'For a larger view click on the thumbnail'
2
products_desc = 'Products description'
3
products_fsk18_check = 'This article can be purchased only after age verification.'
4
products_manufacturer_model = 'MPN:'
5
products_tags = 'Features'
6
heading_products_tags = 'Product Features'
7

  
8
first = '&laquo; first'
9
back = '&laquo; back'
10
overview = 'Overview'
11
next = 'next &raquo;'
12
last = 'last &raquo;'
13

  
14
heading_miscellaneous = 'Payment methods'
15
text_miscellaneous = 'Die Box kann unter tpl_modified_responsive/boxes/box_miscellaneous.html ver&auml;ndert werden. Die Sprachvariablen befinden sich in der Datei tpl_modified_responsive/lang/german/lang_german.custom.'
16

  
17
ab_admin = 'Adminarea'
18
ab_orders = 'Orders'
19
ab_contentmanager = 'Content Manager'
20
ab_customers = 'Customers'
21
ab_category = 'Category/Products'
22
ab_logoff = 'Logoff'
23
ab_news = 'News'
24
ab_offline = 'Shop Offline'
25
ab_update = 'Update'
26
ab_support = 'Support'
27
ab_shop = 'Shop'
28
ab_caching = 'Caching'
29

  
30
ab_edit_content = 'Edit content'
31
ab_edit_product = 'Edit product'
32
ab_edit_attributes = 'Edit product attributes'
33
ab_edit_category = 'Edit category'
34
ab_edit_xsell = 'Edit cross selling'
35
ab_edit_tags = 'Product features'
36

  
37
info_reviews = 'Reviews:'
38
info_review = 'Review:'
39

  
40
heading_trustedshops = 'Trusted Shops'
41

  
42
text_search_again = 'Sorry, we could not find a product matching your search request'
43

  
44
listing_listview = 'List view'
45
listing_boxview = 'Box view'
46
header_menu = 'Menu'
templates/tpl_modified_responsive/lang/lang_german.custom
1
zoomtext = 'F&uuml;r eine gr&ouml;&szlig;ere Ansicht klicken Sie auf das Vorschaubild'
2
products_desc = 'Produktbeschreibung'
3
products_fsk18_check = 'Dieser Artikel kann erst nach erfolgter Altersverifikation gekauft werden.'
4
products_manufacturer_model = 'HAN:'
5
products_tags = 'Eigenschaften'
6
heading_products_tags = 'Produkteigenschaften'
7

  
8
first = '&laquo; Erster'
9
back = '&laquo; vorheriger'
10
overview = '&Uuml;bersicht'
11
next = 'n&auml;chster &raquo;'
12
last = 'Letzter &raquo;'
13

  
14
heading_miscellaneous = 'Zahlungsmethoden'
15
text_miscellaneous = 'Die Box kann unter tpl_modified_responsive/boxes/box_miscellaneous.html ver&auml;ndert werden. Die Sprachvariablen befinden sich in der Datei tpl_modified_responsive/lang/german/lang_german.custom.'
16

  
17
ab_admin = 'Adminbereich'
18
ab_orders = 'Bestellungen'
19
ab_contentmanager = 'Content Manager'
20
ab_customers = 'Kunden'
21
ab_category = 'Kategorien/Artikel'
22
ab_logoff = 'Abmelden'
23
ab_news = 'News'
24
ab_offline = 'Shop Offline'
25
ab_update = 'Update'
26
ab_support = 'Support'
27
ab_shop = 'Shop'
28
ab_caching = 'Caching'
29

  
30
ab_edit_content = 'Content bearbeiten'
31
ab_edit_product = 'Artikel bearbeiten'
32
ab_edit_attributes = 'Attribute editieren'
33
ab_edit_category = 'Kategorie bearbeiten'
34
ab_edit_xsell = 'Cross Selling bearbeiten'
35
ab_edit_tags = 'Artikeleigenschaften'
36

  
37
info_reviews = 'Bewertungen:'
38
info_review = 'Bewertung:'
39

  
40
heading_trustedshops = 'Trusted Shops'
41

  
42
text_search_again = 'Die Suche ergab keine genauen Treffer'
43

  
44
listing_listview = 'Listenansicht'
45
listing_boxview = 'Boxansicht'
46
header_menu = 'Men&uuml;'
templates/tpl_modified_responsive/module/autocomplete.html
1
{config_load file="$language/lang_$language.conf" section="error_handler"}
2
{config_load file="lang_`$language`.custom"}
3
{config_load file="lang_`$language`.section" section="error_handler"}
4
{if $error}
5
  <span class="autocomplete_error">{#text_search_again#}</span>
6
{else}
7
  <ul id="autocomplete_main">
8
    {foreach item=products_data from=$module_content}
9
      <li class="cf autocomplete_content">
10
        <a class="autocomplete cf" href="{$products_data.PRODUCTS_LINK}">
11
          {if $products_data.PRODUCTS_IMAGE}
12
            <span class="autocomplete_image cf">
13
              {if $smarty.const.PICTURESET_ACTIVE === true}
14
                <img class="lazyload" data-src="{$products_data.PRODUCTS_IMAGE|replace:"thumbnail_":"mini_"}" alt="{$products_data.PRODUCTS_NAME|onlytext}" title="{$products_data.PRODUCTS_NAME|onlytext}" />
15
              {else}
16
                <img class="lazyload" data-src="{$products_data.PRODUCTS_IMAGE}" alt="{$products_data.PRODUCTS_NAME|onlytext}" title="{$products_data.PRODUCTS_NAME|onlytext}" />
17
              {/if}
18
            </span>
19
          {else}
20
            <span class="autocomplete_image cf">&nbsp;</span>
21
          {/if}
22
          <span class="ac_text">{$products_data.PRODUCTS_NAME}</span>
23
          <span class="ac_price">
24
            {foreach name=inner item=price_data from=$products_data.PRODUCTS_PRICE_ARRAY}
25
              {include file="module/includes/price_box.html"}
26
            {/foreach}
27
            {if $products_data.PRODUCTS_PRICE_ARRAY.0.PRODUCTS_PRICE_FLAG != 'NotAllowed'}
28
              {if $products_data.PRODUCTS_VPE}<span class="ac_vpe">{$products_data.PRODUCTS_VPE}</div>{/if}
29
            {/if}
30
          </span>
31
        </a>
32
      </li>
33
    {/foreach}
34
  </ul>
35
  
36
  <ul id="autocomplete_pagination" class="cf">
37
    <li id="autocomplete_prev">&laquo;</li>
38
    <li id="autocomplete_count"></li>
39
    <li id="autocomplete_next">&raquo;</li>
40
  </ul>
41
{/if}
templates/tpl_modified_responsive/module/sub_categories_listing.html
1
{config_load file="$language/lang_$language.conf" section="categorie_listing"}
2
{config_load file="lang_`$language`.custom"}
3
{config_load file="lang_`$language`.section" section="categorie_listing"}
4
{if isset($categories_content) && $categories_content != '' && $TR_COLS > 0}
5
<h4>{#heading_more_categories#}</h4>
6
<div class="subcats cf">
7
  {foreach name=aussen item=categories_data from=$categories_content key=spalten}
8
  <div class="subcatlist">
9
    <div class="subcatlist_inner cf">
10
      <a href="{$categories_data.CATEGORIES_LINK}">
11
        {if $categories_data.CATEGORIES_IMAGE != '' || (isset($categories_data.CATEGORIES_IMAGE_LIST) && $categories_data.CATEGORIES_IMAGE_LIST != '')}
12
          <span class="subcat_image">
13
            <span class="subcat_image_inner cf">
14
              {if isset($categories_data.CATEGORIES_IMAGE_LIST) && $categories_data.CATEGORIES_IMAGE_LIST != ''}
15
                <img class="lazyload" data-src="{$categories_data.CATEGORIES_IMAGE_LIST}" alt="{$categories_data.CATEGORIES_NAME|onlytext}" />
16
              {else}
17
                <img class="lazyload" data-src="{$categories_data.CATEGORIES_IMAGE}" alt="{$categories_data.CATEGORIES_NAME|onlytext}" />
18
              {/if}
19
              <noscript><img src="{$categories_data.CATEGORIES_IMAGE}" alt="{$categories_data.CATEGORIES_NAME|onlytext}" /></noscript>
20
            </span>
21
          </span>
22
        {/if}
23
        <span class="subcat_title"><span class="subcat_title_inner">{$categories_data.CATEGORIES_NAME}</span></span>
24
      </a>
25
    </div>
26
  </div>
27
  {/foreach}
28
</div>
29
{/if}

Auch abrufbar als: Unified diff