Projekt

Allgemein

Profil

Revision 2

Unterschiede anzeigen:

admin/includes/extra/modules/add_db_fields/category_keywords.php
1
<?php   
2
/* -----------------------------------------------------------------------------------------
3
   Modul Kategorie-Keywords f?r modified eCommerce Shopsoftware 2.0.6.0     
4
   Autor: Daniel Lonn, Agentur Webknecht [webknecht.net | modified-multishop.de]
5
   Released under the GNU General Public License
6
   ---------------------------------------------------------------------------------------*/
7
if(defined('MODULE_CATEGORY_KEYWORDS_STATUS') && MODULE_CATEGORY_KEYWORDS_STATUS == 'True'){   
8
 $add_categories_description_fields[]='categories_keywords';
9
}
10
?>
admin/includes/extra/modules/new_category/category_keywords.php
1
<?php   
2
/* -----------------------------------------------------------------------------------------
3
   Modul Kategorie-Keywords f?r modified eCommerce Shopsoftware 2.0.6.0     
4
   Autor: Daniel Lonn, Agentur Webknecht [webknecht.net | modified-multishop.de]
5
   Released under the GNU General Public License
6
   ---------------------------------------------------------------------------------------*/
7
   
8
if(defined('MODULE_CATEGORY_KEYWORDS_STATUS') && MODULE_CATEGORY_KEYWORDS_STATUS == 'True'){   
9
  ?>    
10
  <div style="clear:both;"></div>
11
    <div style="padding:5px;clear:both;">
12
      <?php   
13
        for ($i = 0; $i < sizeof($languages); $i++) {  
14
          $categories_desc_fields = $catfunc->get_categories_desc_fields($cInfo->categories_id, $languages[$i]['id']);
15
          $lng_image = xtc_image(DIR_WS_LANGUAGES . $languages[$i]['directory'] .'/admin/images/'. $languages[$i]['image'], $languages[$i]['name']);
16
          ?>                                
17
          <div class="main" style="vertical-align:top; padding: 3px; line-height:20px;">                    
18
            <?php echo $lng_image . '&nbsp;' . TEXT_CATEGORY_KEYWORDS; ?> <br />
19
            <?php echo xtc_draw_input_field('categories_keywords[' . $languages[$i]['id'] . ']',(isset($_POST['categories_keywords'][$languages[$i]['id']]) ? stripslashes($_POST['categories_keywords'][$languages[$i]['id']]) : $categories_desc_fields['categories_keywords']),'style="width:100%"'); ?>
20
          </div>
21
        <?php } ?>                              
22
    </div>
23
  <?php
24
}    
25
?>
admin/includes/modules/system/category_keywords.php
1
<?php
2
/* -----------------------------------------------------------------------------------------
3
   Modul Kategorie-Keywords f?r modified eCommerce Shopsoftware 2.0.6.0     
4
   Autor: Daniel Lonn [www.webknecht.net]
5
   Released under the GNU General Public License
6
   ---------------------------------------------------------------------------------------*/
7

  
8
defined( '_VALID_XTC' ) or die( 'Direct Access to this location is not allowed.' );
9

  
10
if (!class_exists('category_keywords')) {
11
    class category_keywords
12
    {             
13
        var $code, $title, $description, $enabled;
14

  
15
        function __construct() 
16
        {
17
            $this->code = 'category_keywords';
18
            $this->enabled = ((MODULE_CATEGORY_KEYWORDS_STATUS == 'True') ? true : false);
19
            $this->title =  MODULE_CATEGORY_KEYWORDS_TEXT_TITLE;
20
            $this->description = MODULE_CATEGORY_KEYWORDS_TEXT_INFO;
21
            $this->sort_order = MODULE_CATEGORY_KEYWORDS_SORT_ORDER;                  
22
        }
23

  
24
        function process($file) 
25
        {
26
            //...
27
        }
28

  
29
        function display() 
30
        {
31
            return array('text' => '<br>' . MODULE_CATEGORY_KEYWORDS_TEXT_DESCRIPTION  .
32
                    '<br>' . '<br>' . xtc_button(BUTTON_REVIEW_APPROVE) . '&nbsp;' .
33
                    xtc_button_link(BUTTON_CANCEL, xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module='.$this->code))
34
                    );
35
        }
36

  
37
        function check() 
38
        {    
39
            if(!isset($this->_check)) {
40
              $check_query = xtc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_CATEGORY_KEYWORDS_STATUS'");
41
              $this->_check = xtc_db_num_rows($check_query);
42
            }
43
            return $this->_check;
44
        }
45
 
46
        function install() 
47
        {                                                                                                                                                                                          
48
            xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_CATEGORY_KEYWORDS_STATUS', 'True',  '6', '1', 'xtc_cfg_select_option(array(\'True\', \'False\'), ', now())");
49
            xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_CATEGORY_KEYWORDS_SHOW', 'True',  '6', '2', 'xtc_cfg_select_option(array(\'True\', \'False\'), ', now())");
50
            xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_CATEGORY_KEYWORDS_INCLUDE_CATEGORIES', 'True',  '6', '3', 'xtc_cfg_select_option(array(\'True\', \'False\'), ', now())");
51
            
52
            $this->install_db(); 
53
        }
54

  
55
        function remove()
56
        {                
57
            xtc_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key LIKE 'MODULE_CATEGORY_KEYWORDS_%'");
58
            $this->uninstall_db();
59
        }
60

  
61
        function keys() 
62
        {
63
            return array('MODULE_CATEGORY_KEYWORDS_STATUS', 'MODULE_CATEGORY_KEYWORDS_SHOW', 'MODULE_CATEGORY_KEYWORDS_INCLUDE_CATEGORIES');
64
        }
65
        
66
        function install_db() 
67
        {  
68
            $this->uninstall_db(); 
69
            xtc_db_query("ALTER TABLE " . TABLE_CATEGORIES_DESCRIPTION . " ADD categories_keywords VARCHAR( 255 ) NOT NULL AFTER categories_description");
70
        }
71
        
72
        function uninstall_db() 
73
        {      
74
            xtc_db_query("ALTER TABLE " . TABLE_CATEGORIES_DESCRIPTION . " DROP categories_keywords");
75
        }
76
    }
77
}
78
?>
includes/extra/default/listing_sql/category_keywords.php
1
<?php
2
/* -----------------------------------------------------------------------------------------
3
   Modul Kategorie-Keywords f?r modified eCommerce Shopsoftware 2.0.6.0     
4
   Autor: Daniel Lonn [www.webknecht.net]
5
   Released under the GNU General Public License
6
   ---------------------------------------------------------------------------------------*/
7
          
8
if(defined('MODULE_CATEGORY_KEYWORDS_STATUS') 
9
    && MODULE_CATEGORY_KEYWORDS_STATUS == 'True' 
10
    && (basename($PHP_SELF) == FILENAME_ADVANCED_SEARCH_RESULT || basename($PHP_SELF) == 'autocomplete.php')
11
    && $categories_id == false // adv. search: subcategories not selected
12
    && sizeof($search_keywords) > 0
13
    ) {   
14
      $sql_categories_keywords = '';
15
      $where_str_cat = " ( ";
16

  
17
      for ($i = 0, $n = sizeof($search_keywords); $i < $n; $i ++) {      
18
          switch ($search_keywords[$i]) {
19
            case '(' :
20
            case ')' :
21
            case 'and' :
22
            case 'or' :
23
              $where_str .= " ".$search_keywords[$i]." ";
24
              break;
25
            default :
26
              $ent_keyword = encode_htmlentities($search_keywords[$i]);
27
              $ent_keyword = $ent_keyword != $search_keywords[$i] ? xtc_db_input($ent_keyword) : false;
28
              $keyword = xtc_db_input($search_keywords[$i]);
29
              $where_str_cat .= " ( ";
30
              $where_str_cat .= "cd.categories_keywords LIKE ('%".$keyword."%') ";
31
              $where_str_cat .= $ent_keyword ? "OR cd.categories_keywords LIKE ('%".$ent_keyword."%') " : '';
32
              
33
              if (MODULE_CATEGORY_KEYWORDS_INCLUDE_CATEGORIES == 'True') {
34
                 $where_str_cat .= "OR cd.categories_name LIKE ('%".$keyword."%') ";
35
                 $where_str_cat .= $ent_keyword ? "OR cd.categories_name LIKE ('%".$ent_keyword."%') " : '';
36
                 $where_str_cat .= "OR cd.categories_heading_title LIKE ('%".$keyword."%') ";
37
                 $where_str_cat .= $ent_keyword ? "OR cd.categories_heading_title LIKE ('%".$ent_keyword."%') " : '';
38
              }
39
                      
40
              $where_str_cat .= " ) OR ";        
41
            break;
42
          }
43
      } 
44
      if($where_str_cat != " ( "){
45
        $where_str_cat = substr($where_str_cat, 0, strlen($where_str_cat)-3);
46
        $where_str_cat .= " ) ";
47
        $listing_sql_categories = "Select * from ".TABLE_CATEGORIES." c LEFT JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd on c.categories_id = cd.categories_id where $where_str_cat AND cd.language_id = '".(int)$_SESSION['languages_id']."'";
48
        $categories_query = xtc_db_query($listing_sql_categories);
49
        $categories_keyword_content = array();
50
        while ($categories = xtc_db_fetch_array($categories_query)) {
51
           if(!in_array($categories['categories_id'], $arr_categories_affected)){
52
              $arr_categories_affected[]=$categories['categories_id'];
53
           }
54
           if(MODULE_CATEGORY_KEYWORDS_SHOW == 'True') {
55
             $cPath_new = xtc_category_link($categories['categories_id'],$categories['categories_name']);
56
             $image = '';
57
             if ($categories['categories_image'] != '') {
58
                $image = DIR_WS_IMAGES.'categories/'.$categories['categories_image'];
59
                if(!file_exists($image)){
60
                   $image = DIR_WS_IMAGES.'categories/noimage.gif';
61
                }
62
                $image = $image;
63
             }     
64
             $categories_keyword_content[] = array ('CATEGORIES_NAME' => $categories['categories_name'],
65
             'CATEGORIES_HEADING_TITLE' => $categories['categories_heading_title'],
66
             'CATEGORIES_IMAGE' => (($image != '') ? DIR_WS_BASE . $image : ''),
67
             'CATEGORIES_LINK' => xtc_href_link(FILENAME_DEFAULT, $cPath_new),
68
             'CATEGORIES_DESCRIPTION' => $categories['categories_description']);
69
           } 
70
        }  
71

  
72
        if(count($arr_categories_affected)>0){
73
           $str_categories = ",".join($arr_categories_affected, ",").",";
74
           $sql_categories_keywords = " (INSTR('$str_categories', concat(',',p2c.categories_id,',')))";
75
        }     
76
      }
77
      if($sql_categories_keywords){  
78
        $listing_sql_keywords = "SELECT p.products_id
79
                                        FROM ".TABLE_PRODUCTS." p
80
                                        JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." AS p2c ON (p.products_id = p2c.products_id) ";
81
        if($pfrom_check != '' || $pto_check != '') {
82
            $listing_sql_keywords .= "LEFT OUTER JOIN ".TABLE_SPECIALS." AS s ON (p.products_id = s.products_id) ".SPECIALS_CONDITIONS_S." ";  
83
        }                
84
        if($NeedTax) {
85
          $listing_sql_keywords .= " LEFT OUTER JOIN ".TABLE_TAX_RATES." tr ON (p.products_tax_class_id = tr.tax_class_id) 
86
                         LEFT OUTER JOIN ".TABLE_ZONES_TO_GEO_ZONES." gz ON (tr.tax_zone_id = gz.geo_zone_id) ";
87
        }                            
88
        $listing_sql_keywords .= "WHERE p.products_status = '1'
89
                                        ".PRODUCTS_CONDITIONS_P."
90
                                        AND $sql_categories_keywords $pfrom_check $pto_check";
91
        if($manu_check!="") {
92
            $listing_sql_keywords .= " AND p.manufacturers_id = '".$manufacturers_id."' ";         
93
        }                      
94
        if($NeedTax) {
95
          $listing_sql_keywords .= " AND (gz.zone_country_id IS NULL OR gz.zone_country_id = '0' OR gz.zone_country_id = '".(int) $_SESSION['customer_country_id']."') 
96
                         AND (gz.zone_id is null OR gz.zone_id = '0' OR gz.zone_id = '".(int) $_SESSION['customer_zone_id']."')";
97
        } 
98
                                    
99
        $keywords_query = xtc_db_query($listing_sql_keywords);
100
        $arr_included_products=array();
101
        while ($products_from_keywords = xtc_db_fetch_array($keywords_query)) {
102
           $arr_included_products[] = "'" . $products_from_keywords['products_id'] . "'";                  
103
        }     
104
        if(count($arr_included_products>0)){
105
           $listing_sql = str_replace("WHERE p.products_id IN (", "WHERE p.products_id IN (".join($arr_included_products, ",") . ",", $listing_sql);  
106
 
107
        }
108
        
109
      }
110
}     
111
 
112
?>
includes/extra/define_add_select/category_keywords.php
1
<?php   
2
/* -----------------------------------------------------------------------------------------
3
   Modul Kategorie-Keywords f?r modified eCommerce Shopsoftware 2.0.6.0     
4
   Autor: Daniel Lonn, Agentur Webknecht [webknecht.net | modified-multishop.de]
5
   Released under the GNU General Public License
6
   ---------------------------------------------------------------------------------------*/
7
if(defined('MODULE_CATEGORY_KEYWORDS_STATUS') && MODULE_CATEGORY_KEYWORDS_STATUS == 'True'){   
8
 $add_categories_description_fields[]='categories_keywords';
9
}
10
?>
includes/extra/modules/categories_listing/categories_smarty/category_keywords.php
1
<?php   
2
/* -----------------------------------------------------------------------------------------
3
   Modul Kategorie-Keywords f?r modified eCommerce Shopsoftware 2.0.6.0     
4
   Autor: Daniel Lonn, Agentur Webknecht [webknecht.net | modified-multishop.de]
5
   Released under the GNU General Public License
6
   ---------------------------------------------------------------------------------------*/
7
   
8
  if(defined('MODULE_CATEGORY_KEYWORDS_STATUS') 
9
      && MODULE_CATEGORY_KEYWORDS_STATUS == 'True' 
10
      && MODULE_CATEGORY_KEYWORDS_SHOW == 'True' 
11
      && basename($PHP_SELF) == FILENAME_ADVANCED_SEARCH_RESULT
12
      && count($categories_keyword_content) > 0 
13
      ) {  
14
          $categorie_smarty->assign('categories_content', $categories_keyword_content);
15
          $categorie_smarty->assign('KEYWORD_RESULT', true);
16
  }
17
   
18
?>
lang/english/extra/admin/category_keywords.php
1
<?php   
2
/* -----------------------------------------------------------------------------------------
3
   Modul Kategorie-Keywords für modified eCommerce Shopsoftware 2.0.6.0     
4
   Autor: Daniel Lonn, Agentur Webknecht [webknecht.net | modified-multishop.de]
5
   Released under the GNU General Public License
6
   ---------------------------------------------------------------------------------------*/
7
   
8
define('MODULE_CATEGORY_KEYWORDS_TEXT_TITLE', 'Kategorie-Keywords');
9
define('MODULE_CATEGORY_KEYWORDS_TEXT_DESCRIPTION', '<strong>Shopsuche: Erg&auml;nzung von Kategorie-Keywords</strong><br />Ist der Suchbegriff Bestandteil von Kategorie-Keywords werden zus&auml;tzlich zum regul&auml;ren Suchergebnis alle Artikel der betreffenden Kategorie gelistet. Optional werden ausserdem  die erfassten Kategorien oberhalb des Suchergebnisses platziert. <br />Bei bereits gew&auml;hlter Kategorie in der erweiterten Suche erfolgt kein Abgleich der Kategorie-Keywords.');
10
define('MODULE_CATEGORY_KEYWORDS_TEXT_INFO', MODULE_CATEGORY_KEYWORDS_TEXT_DESCRIPTION);
11

  
12
define('MODULE_CATEGORY_KEYWORDS_STATUS_TITLE', 'Modul aktivieren?');
13
define('MODULE_CATEGORY_KEYWORDS_STATUS_DESC', '');
14
define('MODULE_CATEGORY_KEYWORDS_SHOW_TITLE', 'Kategorie-Listing anzeigen?');
15
define('MODULE_CATEGORY_KEYWORDS_SHOW_DESC', 'Listing der erfassten Kategorien &uuml;ber dem Suchergebnis');
16
define('MODULE_CATEGORY_KEYWORDS_INCLUDE_CATEGORIES_TITLE', 'Kategorienamen als Keyword verwenden');
17
define('MODULE_CATEGORY_KEYWORDS_INCLUDE_CATEGORIES_DESC', '');
18

  
19
define('TEXT_CATEGORY_KEYWORDS', 'Keywords f&uuml;r die Suche (kommagetrennt):');
20
?>
lang/german/extra/admin/category_keywords.php
1
<?php   
2
/* -----------------------------------------------------------------------------------------
3
   Modul Kategorie-Keywords für modified eCommerce Shopsoftware 2.0.6.0     
4
   Autor: Daniel Lonn, Agentur Webknecht [webknecht.net | modified-multishop.de]
5
   Released under the GNU General Public License
6
   ---------------------------------------------------------------------------------------*/
7
   
8
define('MODULE_CATEGORY_KEYWORDS_TEXT_TITLE', 'Kategorie-Keywords');
9
define('MODULE_CATEGORY_KEYWORDS_TEXT_DESCRIPTION', '<strong>Shopsuche: Erg&auml;nzung von Kategorie-Keywords</strong><br />Ist der Suchbegriff Bestandteil von Kategorie-Keywords werden zus&auml;tzlich zum regul&auml;ren Suchergebnis alle Artikel der betreffenden Kategorie gelistet. Optional werden ausserdem  die erfassten Kategorien oberhalb des Suchergebnisses platziert. <br />Bei bereits gew&auml;hlter Kategorie in der erweiterten Suche erfolgt kein Abgleich der Kategorie-Keywords.');
10
define('MODULE_CATEGORY_KEYWORDS_TEXT_INFO', MODULE_CATEGORY_KEYWORDS_TEXT_DESCRIPTION);
11

  
12
define('MODULE_CATEGORY_KEYWORDS_STATUS_TITLE', 'Modul aktivieren?');
13
define('MODULE_CATEGORY_KEYWORDS_STATUS_DESC', '');
14
define('MODULE_CATEGORY_KEYWORDS_SHOW_TITLE', 'Kategorie-Listing anzeigen?');
15
define('MODULE_CATEGORY_KEYWORDS_SHOW_DESC', 'Listing der erfassten Kategorien &uuml;ber dem Suchergebnis');
16
define('MODULE_CATEGORY_KEYWORDS_INCLUDE_CATEGORIES_TITLE', 'Kategorienamen als Keyword verwenden');
17
define('MODULE_CATEGORY_KEYWORDS_INCLUDE_CATEGORIES_DESC', '');
18

  
19
define('TEXT_CATEGORY_KEYWORDS', 'Keywords f&uuml;r die Suche (kommagetrennt):');
20

  
21

  
22
?>

Auch abrufbar als: Unified diff