Index: /changelog
===================================================================
--- /changelog	(revision 7911)
+++ /changelog	(revision 7912)
@@ -468,2 +468,3 @@
 - Bugfix: PasswortzurÃŒcksetzen funktioniert jetzt auch, wenn paralell ein gelÃ¶schter Kunde mit gleicher E-Mail existiert
 - Bugfix: Produktartikel Neu Aufbauen beachtet den "Entwurfs - Status"
+- Bugfix: Produktartikel Neu-Aufbau mit Resten alter "Ãbersetzungen" korrigiert (Produktstatus wurde ÃŒberschrieben)
Index: /model/wpsg_customer.class.php
===================================================================
--- /model/wpsg_customer.class.php	(revision 7911)
+++ /model/wpsg_customer.class.php	(revision 7912)
@@ -31,5 +31,5 @@
 			$custom = @unserialize($this->data['custom']);
 
-			if ($custom !== false) {
+			if (wpsg_isSizedArray($custom)) {
 
 				$arRequired = $this->shop->loadPflichtFeldDaten();
Index: /mods/wpsg_mod_produktartikel.class.php
===================================================================
--- /mods/wpsg_mod_produktartikel.class.php	(revision 7911)
+++ /mods/wpsg_mod_produktartikel.class.php	(revision 7912)
@@ -13,5 +13,5 @@
         var $free = false;
         var $default_page = 'wpsg-Admin';
-    
+
         /**
          * Constructor
@@ -19,24 +19,24 @@
         public function __construct()
         {
-    
+
             parent::__construct();
-    
+
             $this->name = __('ProduktArtikel', 'wpsg');
             $this->group = __('Produkte', 'wpsg');
             $this->desc = __('Produkte sind ein eigener Wordpress Artikeltyp und erscheinen so als Artikel und in der Suche.', 'wpsg');
-    
+
         } // public function __construct()
-    
+
         public function init() {
 
             $this->create_wpsg_post_types();
-    
+
         } // public function init()
-    
+
         public function wpsg_enqueue_scripts()
         {
-    
+
             if (is_admin()) return;
-    
+
             if (	(	$this->shop->get_option('wpsg_mod_produktartikel_facebook') == '1' ||
                     $this->shop->get_option('wpsg_mod_produktartikel_google') == '1' ||
@@ -44,17 +44,17 @@
                 $this->shop->get_option('wpsg_mod_produktartikel_noJS') != '1')
             {
-    
+
                 wp_enqueue_script('wpsg_mod_produktartikel_shariff', $this->shop->getRessourceURL('js/shariff/shariff.min.js'));
                 wp_enqueue_style ('wpsg_mod_produktartikel_shariff', $this->shop->getRessourceURL('js/shariff/shariff.min.css'));
-    
-            }
-    
+
+            }
+
         } // public function wpsg_enqueue_scripts()
-    
+
         public function install()
         {
-    
+
             require_once(WPSG_PATH_WP.'/wp-admin/includes/upgrade.php');
-    
+
             /**
              * Produkt Tabelle erweitern
@@ -64,23 +64,23 @@
                 gtin VARCHAR (255) NOT NULL
             ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
-    
+
             dbDelta($sql);
-    
+
             // Standard Path Key setzen
             if ($this->shop->get_option('wpsg_mod_produktartikel_pathkey') === false || $this->shop->get_option('wpsg_mod_produktartikel_pathkey') == '')
             {
-    
+
                 $this->shop->update_option('wpsg_mod_produktartikel_pathkey', 'produkt');
-    
-            }
-    
+
+            }
+
             // Standard Path Key (Kategorien) setzen
             if ($this->shop->get_option('wpsg_mod_produktartikel_pathkey_cat') === false || $this->shop->get_option('wpsg_mod_produktartikel_pathkey_cat') == '')
             {
-    
+
                 $this->shop->update_option('wpsg_mod_produktartikel_pathkey_cat', 'produkte');
-    
-            }
-    
+
+            }
+
             $this->shop->checkDefault('wpsg_mod_produktartikel_showui', '0');
             $this->shop->checkDefault('wpsg_mod_produktartikel_showHome', '0');
@@ -100,30 +100,30 @@
                 KEY wpsg_produkt_id (`wpsg_produkt_id`)
             ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
-    
+
             dbDelta($sql);
-    
+
         }
-    
+
         public function be_ajax() {
 
             if (wpsg_isSizedString($_REQUEST['do'], 'setWPMLPathKey'))
             {
-    
+
                 $icl_sitepress_settings = $this->shop->get_option('icl_sitepress_settings');
-    
+
                 $icl_sitepress_settings['custom_posts_sync_option'][$this->shop->get_option('wpsg_mod_produktartikel_pathkey')] = '1';
                 $this->shop->update_option('icl_sitepress_settings', $icl_sitepress_settings);
-    
+
                 $this->shop->addBackendMessage(__('Der Custom Post Type fÃŒr die Produkte kann nun ÃŒbersetzt werden.', 'wpsg'));
                 $this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=ueber&subaction=systemcheck');
-    
+
             }
             else if (wpsg_isSizedString($_REQUEST['do'], 'index_rebuild'))
             {
-    
+
                 $arProductIDs = $this->db->fetchAssocField("SELECT `id` FROM `".WPSG_TBL_PRODUCTS."` ", "id");
 
                 if (wpsg_isSizedArray($arProductIDs)) {
-    
+
                     // Ich lÃ¶sche alle Posts zu denen es die Produkte nicht mehr gibt
                     $this->db->Query("
@@ -134,177 +134,180 @@
                             `wpsg_produkt_id` > 0
                     ");
-    
+
                     $this->shop->update_option('wpsg_mod_produktartikel_rebuild', array(
                         'max' => sizeof($arProductIDs),
                         'product_ids' => $arProductIDs
                     ), false, false, WPSG_SANITIZE_NONE);
-    
+
                     $this->shop->addBackendMessage(__('Zuordnungen werden neu aufgebaut. Bitte schlieÃen Sie die Seite nicht bis der Vorgang abgeschlossen ist.', 'wpsg'));
-    
+
                 } else {
-    
+
                     \update_option('wpsg_mod_produktartikel_rebuild', null);
-    
+
                     $this->shop->addBackendMessage(__('Ein Aufbau der Zuordnung nicht nicht notwendig.', 'wpsg'));
-    
-                }
-    
+
+                }
+
                 $this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_produktartikel');
-    
+
             } else if (wpsg_isSizedString($_REQUEST['do'], 'rebuild')) {
-    
+
             	ob_start();
-            	
+
                 $arToDo = $this->shop->get_option('wpsg_mod_produktartikel_rebuild');
                 $arProductIDs = $arToDo['product_ids'];
-    
+
                 $i = 0;
                 $limit = 20;
-    
+
                 foreach ($arProductIDs as $k => $product_id)
                 {
-    
+
                     $product_data = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($product_id)."' ");
                     $post_data = $this->db->fetchRow("SELECT * FROM `".$this->shop->prefix."posts` WHERE `wpsg_produkt_id` = '".wpsg_q($product_id)."' ");
-    
+
                     $_REQUEST['wpsg_mod_produktartikel']['path'] = wpsg_getStr($post_data['post_name'], '');
                     $_REQUEST['wpsg_mod_produktartikel']['kommentare'] = wpsg_getStr($post_data['comment_status'], '');
                     $_REQUEST['wpsg_produktartikel_menuorder'] = wpsg_getStr($post_data['menu_order'], '');
                     $_REQUEST['disabled'] = $product_data['disabled'];
-    
+
                     if (wpsg_isSizedInt($product_data['lang_parent'])) {
-    
+
+                    	$product_trans_data = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($product_data['lang_parent'])."' ");
+
+                    	$_REQUEST['disabled'] = $product_trans_data['disabled'];
                         $_REQUEST['wpsg_lang'] = $product_data['lang_code'];
-    
+
                         $this->produkt_save_translation($product_data['lang_parent'], $product_data['id']);
-    
+
                     } else {
-    
+
                         $this->produkt_save($product_data['id']);
-    
+
                         $this->shop->callMod('wpsg_mod_productvariants', 'produkt_save', array(&$product_data['id']));
-    
+
                     }
-    
+
                     unset($arProductIDs[$k]);
-    
+
                     $i ++;
-    
+
                     if ($i >= $limit) break;
-    
-                }
-    
+
+                }
+
                 if (wpsg_isSizedArray($arProductIDs))
                 {
-    
+
                     $arToDo['product_ids'] = $arProductIDs;
                     $this->shop->update_option('wpsg_mod_produktartikel_rebuild', $arToDo, false, false, WPSG_SANITIZE_NONE);
                     $done = 1 - (sizeof($arProductIDs) / $arToDo['max']);
-    
+
                 }
                 else
                 {
-    
+
                     \update_option('wpsg_mod_produktartikel_rebuild', null);
                     $done = 1;
-    
-                }
-    
+
+                }
+
                 ob_end_clean();
-                
+
                 wpsg_header::JSONData(array(
                     'done' => $done
                 ));
-    
-            }
-    
+
+            }
+
         }
-    
+
         public function the_excerpt(&$content)
         {
-    
+
             global $post;
-    
+
             if (get_post_type($post) == $this->shop->get_option('wpsg_mod_produktartikel_pathkey'))
             {
-    
+
                 $produkt_id = $post->wpsg_produkt_id;
                 $content = $this->shop->renderProdukt($produkt_id);
-    
-            }
-    
+
+            }
+
         } // public function the_excerpt(&$content)
-    
+
         public function content_filter(&$content) {
 
             global $post;
-    
+
             // Artikel ist ein Produkt, hier das Rendern des Templates ÃŒbernehmen
             if (get_post_type($post) == $this->shop->get_option('wpsg_mod_produktartikel_pathkey'))
             {
-    
+
                 $produkt_id = $post->wpsg_produkt_id;
                 $content = $this->shop->renderProdukt($produkt_id);
-    
+
                 return -2;
-    
-            }
-    
+
+            }
+
         } // public function content_filter()
-    
+
         public function pre_get_posts(&$query) {
 
             if (wpsg_isSizedInt($this->shop->get_option('wpsg_mod_produktartikel_onlyMainQuery')) && !$query->is_main_query()) return;
-    
+
             if ($this->shop->get_option('wpsg_mod_produktartikel_showHome') == '1' && is_home())
             {
-    
+
                 $this->setPostType($query);
-    
-            }
-    
+
+            }
+
             if ($this->shop->get_option('wpsg_mod_produktartikel_showCategory') == '1' && is_tax($this->shop->get_option('wpsg_mod_produktartikel_pathkey_cat')))
             {
-    
+
                 $this->setPostType($query);
-    
-            }
-    
+
+            }
+
             if ($this->shop->get_option('wpsg_mod_produktartikel_showFeed') == '1' && is_feed())
             {
-    
+
                 $this->setPostType($query);
-    
-            }
-    
+
+            }
+
             if ($this->shop->get_option('wpsg_mod_produktartikel_showSearch') == '1' && is_search())
             {
-    
+
                 $this->setPostType($query);
-    
-            }
-    
+
+            }
+
             if (is_single() && $query->is_main_query())
             {
-    
+
                 $this->setPostType($query);
-    
-            }
-    
+
+            }
+
         } // public function pre_get_posts(&$query)
-    
+
         public function settings_edit()
         {
-    
+
             // Rebuild
             $this->shop->view['ToRebuild'] = wpsg_getArray($this->shop->get_option('wpsg_mod_produktartikel_rebuild'));
-    
+
             // VerfÃŒgbare Produkttemplates
             $this->shop->view['arTemplates'] = $this->shop->loadProduktTemplates(true);
-    
+
             $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_produktartikel/settings_edit.phtml');
-    
+
         }
-    
+
         public function settings_save()
         {
@@ -321,131 +324,131 @@
 	        $this->shop->update_option('wpsg_mod_produktartikel_onlyMainQuery', $_REQUEST['wpsg_mod_produktartikel_onlyMainQuery'], false, false, WPSG_SANITIZE_CHECKBOX);
 
-    
+
             $this->shop->update_option('wpsg_mod_produktartikel_showui', $_REQUEST['wpsg_mod_produktartikel_showui'], false, false, WPSG_SANITIZE_CHECKBOX);
             $this->shop->update_option('wpsg_mod_produktartikel_ean', $_REQUEST['wpsg_mod_produktartikel_ean'], false, false, WPSG_SANITIZE_CHECKBOX);
             $this->shop->update_option('wpsg_mod_produktartikel_gtin', $_REQUEST['wpsg_mod_produktartikel_gtin'], false, false, WPSG_SANITIZE_CHECKBOX);
             $this->shop->update_option('wpsg_mod_produktartikel_comment', $_REQUEST['wpsg_mod_produktartikel_comment'], false, false, WPSG_SANITIZE_INT);
-            
+
             $this->shop->update_option('wpsg_mod_produktartikel_hometemplate', wpsg_xss($_REQUEST['wpsg_mod_produktartikel_hometemplate']));
             $this->shop->update_option('wpsg_mod_produktartikel_listtemplate', wpsg_xss($_REQUEST['wpsg_mod_produktartikel_listtemplate']));
             $this->shop->update_option('wpsg_mod_produktartikel_searchtemplate', wpsg_xss($_REQUEST['wpsg_mod_produktartikel_searchtemplate']));
-            
+
             $this->shop->update_option('wpsg_mod_produktartikel_postthumbnail', $_REQUEST['wpsg_mod_produktartikel_postthumbnail'], false, false, WPSG_SANITIZE_CHECKBOX);
-    
+
             //$this->shop->update_option('wpsg_mod_produktartikel_positionnumber', $_REQUEST['wpsg_mod_produktartikel_positionnumber'], false, false, WPSG_SANITIZE_CHECKBOX);
-            
+
             $pathkey_alt = $this->shop->get_option('wpsg_mod_produktartikel_pathkey');
             $pathkey_new = $this->shop->clear($_REQUEST['wpsg_mod_produktartikel_pathkey']);
-    
+
             $this->shop->update_option('wpsg_mod_produktartikel_rating', $_REQUEST['wpsg_mod_produktartikel_rating'], false, false, WPSG_SANITIZE_TEXTFIELD);
-    
+
             if ($pathkey_alt != $_REQUEST['wpsg_mod_produktartikel_pathkey'] && $pathkey_new != '')
             {
-    
+
                 $this->db->UpdateQuery($this->shop->prefix."posts", array(
                     'post_type' => wpsg_q($pathkey_new)
                 ), "`post_type` = '".wpsg_q($pathkey_alt)."'");
-    
+
                 $this->shop->update_option('wpsg_mod_produktartikel_pathkey', $pathkey_new, false, false, WPSG_SANITIZE_TEXTFIELD);
-    
+
                 $this->shop->addBackendMessage(__('Path Key erfolgreich geÃ€ndert. Die Produkt URLs haben sich geÃ€ndert!', 'wpsg'));
-    
+
             }
             else if (trim($_REQUEST['wpsg_mod_produktartikel_pathkey']) == '')
             {
-    
+
                 $this->shop->addBackendError(__('Der Path Key darf nicht leer sein!', 'wpsg'));
-    
-            }
-    
+
+            }
+
             $pathkey_cat_old = $this->shop->get_option('wpsg_mod_produktartikel_pathkey_cat');
             $pathkey_cat_new = $this->shop->clear($_REQUEST['wpsg_mod_produktartikel_pathkey_cat']);
-    
+
             if ($pathkey_cat_old != $_REQUEST['wpsg_mod_produktartikel_pathkey_cat'] && $pathkey_cat_new != '')
             {
-    
+
                 $this->db->UpdateQuery($this->shop->prefix."term_taxonomy", array(
                     'taxonomy' => wpsg_q($pathkey_cat_new)
                 ), " `taxonomy` = '".wpsg_q($pathkey_cat_old)."' ");
-    
+
                 $this->db->UpdateQuery($this->shop->prefix."postmeta", array(
                     'meta_value' => wpsg_q($pathkey_cat_new)
                 ), " `meta_key` = '_menu_item_object' AND `meta_value` = '".wpsg_q($pathkey_cat_old)."' ");
-    
+
                 $this->shop->update_option('wpsg_mod_produktartikel_pathkey_cat', $pathkey_cat_new, false, false, WPSG_SANITIZE_TEXTFIELD);
-    
+
                 $this->shop->addBackendMessage(__('Path Key (Kategorie) erfolgreich geÃ€ndert. Die Kategorie URLs haben sich geÃ€ndert!', 'wpsg'));
-    
+
             }
             else if (trim($_REQUEST['wpsg_mod_produktartikel_pathkey_cat']) == '')
             {
-    
+
                 $this->shop->addBackendError(__('Der Path Key (Kategorie) darf nicht leer sein!', 'wpsg'));
-    
-            }
-    
+
+            }
+
             $this->create_wpsg_post_types();
             flush_rewrite_rules();
-    
+
         } // public function settings_save()
-    
+
         public function wpsg_add_pages($default_page)
         {
-    
+
             $callback = add_submenu_page($default_page, __("Produktkategorien", "wpsg"), __("Produktkategorien", "wpsg"), 'wpsg_produkt', 'wpsg-Productcategories', 'callback');
-    
+
             $this->default_page = $default_page;
-            
+
             add_action("load-".$callback, function() { header('Location: '.admin_url('edit-tags.php?taxonomy='.$this->shop->get_option('wpsg_mod_produktartikel_pathkey_cat'))); exit; } );
-    
+
             add_filter('parent_file', array($this, 'setParentmenu'), 10, 1);
             add_filter('submenu_file', array($this, 'setSubmenu'), 10, 1);
-    
+
         } // public function wpsg_add_pages()
-    
+
         function setParentmenu($parent_file)
         {
-    
+
             if (wpsg_isSizedString($_REQUEST['taxonomy'], $this->shop->get_option('wpsg_mod_produktartikel_pathkey_cat'))) $parent_file = $this->default_page;
-    
+
             return $parent_file;
         }
-    
+
         function setSubmenu($submenu_file)
         {
-    
+
             if ($submenu_file == 'edit-tags.php?taxonomy='.$this->shop->get_option('wpsg_mod_produktartikel_pathkey_cat')) $submenu_file = 'wpsg-Productcategories';
-    
+
             return $submenu_file;
-    
+
         }
-    
+
         public function admin_includes()
         {
-    
+
             echo wpsg_drawForm_Checkbox('wpsg_mod_produktartikel_noJS', __('Socialshareprivacy nicht einbinden (Produktartikel)', 'wpsg'), $this->shop->get_option('wpsg_mod_produktartikel_noJS'), array(
                 'hint' => wpsg_translate('nohspc_'.__('Ist diese Option aktiv, so wird die benÃ¶tigte JavaScript Bibliothek <u>nicht</u> eingebunden, auch wenn die Optionen im <a href="#1#">Produktartikelmodul</a> aktiv sind.', 'wpsg'), WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_produktartikel')
             ));
-    
+
         } // function admin_includes()
-    
+
         public function admin_includes_save()
         {
-    
+
             $this->shop->update_option('wpsg_mod_produktartikel_noJS', $_REQUEST['wpsg_mod_produktartikel_noJS'], false, false, WPSG_SANITIZE_CHECKBOX);
-    
+
         } // function admin_includes_save()
-    
+
         public function produkt_copy(&$produkt_id, &$copy_id)
         {
-    
+
             global $current_user;
-    
+
             $product_source = $this->shop->cache->loadProduct($produkt_id);
             $product_target = $this->shop->cache->loadProduct($copy_id);
-    
+
             $post_content = $this->renderProdukt($copy_id);
             $post_content = $this->clear_post_content($post_content);
-    
+
             $post_data = $this->db->fetchRow("
                     SELECT
@@ -457,5 +460,5 @@
                         `post_type` = '".wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."'
                 ");
-    
+
             $data = array(
                 "post_title" => wpsg_q($product_target['name']),
@@ -471,17 +474,17 @@
                 'post_date' => 'NOW()'
             );
-    
+
             $post_id = $this->db->ImportQuery($this->shop->prefix.'posts', $data);
-    
+
             $this->updatePostThumbnail($copy_id);
-    
+
             // Taxonomie mit kopieren
             $this->db->Query("DELETE FROM `".$this->shop->prefix."term_relationships` WHERE `object_id` = '".wpsg_q($post_id)."'");
-    
+
             $arTaxOriginalProduct = $this->db->fetchAssocField("SELECT `term_taxonomy_id` FROM `".$this->shop->prefix."term_relationships` WHERE `object_id` = '".wpsg_q($post_data['id'])."' ");
-    
+
             foreach ($arTaxOriginalProduct as $term_taxonomy_id)
             {
-    
+
                 $this->db->ImportQuery($this->shop->prefix.'term_relationships', array(
                     'object_id' => wpsg_q($post_id),
@@ -489,20 +492,20 @@
                     'term_order' => '0'
                 ));
-    
+
                 $count = $this->db->fetchOne("SELECT COUNT(*) FROM `".$this->shop->prefix."term_relationships` WHERE `term_taxonomy_id` = '".wpsg_q($term_taxonomy_id)."'");
-    
+
                 $this->db->UpdateQuery($this->shop->prefix."term_taxonomy", array(
                     'count' => wpsg_q($count)
                 ), "`term_taxonomy_id` = '".wpsg_q($term_taxonomy_id)."'");
-    
-            }
-    
+
+            }
+
         } // public function produkt_copy(&$produkt_id, &$copy_id)
-    
+
         public function produkt_del($produkt_id)
         {
-    
+
             global $wpdb;
-    
+
             $post_id = $this->db->fetchOne("
                     SELECT
@@ -514,36 +517,36 @@
                         `post_type` = '".wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."'
                 ");
-    
+
             $this->db->Query("DELETE FROM `".$this->shop->prefix."posts` WHERE `wpsg_produkt_id` = '".wpsg_q($produkt_id)."'");
-    
+
             $this->db->Query("DELETE FROM `".$this->shop->prefix."term_relationships` WHERE `object_id` = '".wpsg_q($post_id)."'");
-    
+
             $this->db->Query("DELETE FROM `".$this->shop->prefix."postmeta` WHERE `post_id` = '".wpsg_q($post_id)."'");
-    
+
             $this->updateTaxonomieCount();
-    
+
         } // public function produkt_del($produkt_id)
-    
+
         public function wp_head()
         {
-    
+
             global $post;
-    
+
             if (is_single($post) && get_post_type($post) == $this->shop->get_option('wpsg_mod_produktartikel_pathkey'))
             {
-    
+
                 $produkt_id = $post->wpsg_produkt_id;
-    
+
                 $this->shop->view['data'] = $this->shop->loadProduktArray($produkt_id);
                 $this->shop->view['data']['url'] = '';
                 $this->getProduktlink($produkt_id, $this->shop->view['data']['url']);
-    
+
                 $this->shop->view['data']['beschreibung'] = preg_replace("/\r|\n/", "", wpsg_hspc(strip_tags($this->shop->view['data']['beschreibung'])));
-    
+
                 $arBilder = array();
                 $arBilder = $this->shop->imagehandler->getAttachmentIDs($produkt_id);
-    
+
                 if (isset($arBilder) && (sizeof($arBilder) > 0)) $this->shop->view['data']['bilder'] = $arBilder;
-    
+
                 /*
                 if ($this->shop->get_option('wpsg_mod_produktartikel_facebook') == '1')
@@ -556,17 +559,17 @@
                 }
                 */
-    
-            }
-    
+
+            }
+
         } // public function wp_head()
-    
+
         public function produkt_edit_allgemein(&$produkt_data) {
-    
+
             $post_id = $this->hasPostId($produkt_data['id']);
-    
+
             $this->shop->view['data'] = $produkt_data;
-    
+
             if (wpsg_isSizedInt($post_id)) {
-    
+
                 $this->shop->view['data']['post_name'] = $this->db->fetchOne("
                     SELECT
@@ -577,22 +580,22 @@
                         `ID` = '".wpsg_q($post_id)."' 
                 ");
-    
-            }
-    
+
+            }
+
             $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_produktartikel/produkt_edit_allgemein.phtml');
-    
+
         } // public function produkt_edit_allgemein(&$produkt_data)
-    
+
         public function product_addedit_content(&$product_content, &$product_data)
         {
-    
+
             global $wpdb;
-    
+
             // Bei Ãbersetzungen nichts machen
             if (isset($_REQUEST['wpsg_lang'])) return;
-    
+
             if (wpsg_isSizedInt($product_data['id']))
             {
-    
+
                 $product_data = wpsg_array_merge($product_data, (array)$this->db->fetchRow("
                         SELECT
@@ -607,39 +610,39 @@
                             `post_type` = '".wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."'
                     "));
-    
-            }
-    
+
+            }
+
             $product_content['wpsg_mod_produktartikel'] = array(
                 'title' => __('Kategorie / Artikel', 'wpsg'),
                 'content' => $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_produktartikel/produkt_addedit_content.phtml', false)
             );
-    
+
         } // public function product_addedit_content(&$product_content, &$product_data)
-    
+
         public function produkt_save_translation(&$product_id, &$trans_id)
         {
-    
+
             if (function_exists('icl_object_id')) //if (is_plugin_active('sitepress-multilingual-cms/sitepress.php'))
             {
-    
+
                 // WPML
                 $post_id = $this->getPostIdFromProductId($product_id);
-    
+
                 if (wpsg_isSizedInt($post_id))
                 {
-    
+
                     $trans_product = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($trans_id)."' ");
                     $post = $this->db->fetchRow("SELECT * FROM `".$this->shop->prefix."posts` WHERE `ID` = '".$post_id."' ");
-    
+
                     if (wpsg_isSizedString($_REQUEST['wpsg_mod_produktartikel']['path'])) $path = $_REQUEST['wpsg_mod_produktartikel']['path'];
                     else $path = $trans_product['name'];
-    
+
                     $trans_post_id = $this->getPostIdFromProductId($trans_id, $path, (($post['comment_status'] === 'open')?'1':'0'), $post['menu_order'], true);
-    
+
                     // Gibt es zu dem Post schon eine trid?
                     $trid = $this->db->fetchOne("SELECT `trid` FROM `".$this->shop->prefix."icl_translations` WHERE `element_type` = '".wpsg_q('post_'.$this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."' AND `element_id` = '".wpsg_q($post_id)."' ");
                     if (!wpsg_isSizedInt($trid))
                     {
-    
+
                         $trid = 1 + $this->db->fetchOne("SELECT MAX(`trid`) FROM ".$this->shop->prefix."icl_translations");
                         $this->db->ImportQuery($this->shop->prefix."icl_translations", array(
@@ -650,12 +653,12 @@
                             'source_language_code' => 'NULL'
                         ));
-    
+
                     }
-    
+
                     // Gibt es schon einen ICL Eintrag zur Ãbersetzung?
                     $icl_id = $this->db->fetchOne("SELECT `translation_id` FROM `".$this->shop->prefix."icl_translations` WHERE `element_type` = '".wpsg_q('post_'.$this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."' AND `element_id` = '".wpsg_q($trans_post_id)."' ");
                     if (!wpsg_isSizedInt($icl_id))
                     {
-    
+
                         $this->db->ImportQuery($this->shop->prefix."icl_translations", array(
                             'element_type' => wpsg_q('post_'.$this->shop->get_option('wpsg_mod_produktartikel_pathkey')),
@@ -665,28 +668,28 @@
                             'source_language_code' => wpsg_q($this->shop->getDefaultLanguageCode())
                         ));
-    
+
                     }
-    
+
                 } else throw new \Exception(wpsg_translate(__('Custom Post Type existiert zu Produkt (ID:#1#) noch nicht.', 'wpsg'), $product_id));
-    
+
             }
             else
             {
-    
+
                 // qTranslate
                 // Da sich die Ãbersetzung geÃ€ndert hat muss das Produkt erneut gespeichert werden
                 $this->produkt_save($product_id);
-    
-            }
-    
+
+            }
+
         } // public function produkt_save_translation(&$produkt_id, &$trans_id)
-    
+
         public function produkt_save_before(&$produkt_data) {
-    
+
             $produkt_data['ean'] = wpsg_tf(wpsg_sinput("key", wpsg_getStr($_REQUEST['wpsg_mod_produktartikel']['ean']), "isFloat"));
             $produkt_data['gtin'] = wpsg_tf(wpsg_sinput("key", wpsg_getStr($_REQUEST['wpsg_mod_produktartikel']['gtin']), "isFloat"));
-    
+
         } // public function produkt_save_before(&$produkt_data)
-    
+
         public function produkt_save(&$product_id) {
 
@@ -694,13 +697,13 @@
 
             $this->getPostIdFromProductId($product_id, $_REQUEST['wpsg_mod_produktartikel']['path'], $comment, $_REQUEST['wpsg_produktartikel_menuorder'], true, ((($_REQUEST['disabled']??'0') === '1')?'1':'0') );
-    
+
         } // public function produkt_save($produkt_id)
-    
+
         public function create_wpsg_post_types() {
-    
+
             $show_ui = false;
 
             if ($this->shop->get_option('wpsg_mod_produktartikel_showui') == '1') $show_ui = true;
-    
+
             register_taxonomy($this->shop->get_option('wpsg_mod_produktartikel_pathkey_cat'), $this->shop->get_option('wpsg_mod_produktartikel_pathkey'), array(
                 'label' => __('Produktkategorien', 'wpsg'),
@@ -714,5 +717,5 @@
                 'hierarchical' => true
             ));
-    
+
             register_post_type($this->shop->get_option('wpsg_mod_produktartikel_pathkey'),
                 array(
@@ -731,67 +734,67 @@
                 )
             );
-    
+
         } // public function create_wpsg_post_types()
-    
+
         public function getProduktlink($product_id, &$url, $language_code = false) {
-    
+
             $product_id = $this->shop->getProduktId($product_id);
             $post_id = $this->hasPostId($product_id);
-    
+
             if (wpsg_isSizedInt($post_id)) {
-    
+
                 if (function_exists('qtrans_convertURL')) {
-    
+
                     $url = get_permalink($post_id);
                     $url = qtrans_convertURL($url);
-    
+
                 } else {
-    
+
                     if (function_exists('icl_object_id') && $language_code !== false) {
-    
+
                         $post_id = apply_filters('wpml_object_id', $post_id, $this->shop->get_option('wpsg_mod_produktartikel_pathkey'), true, $language_code);
-    
+
                     }
-    
+
                     $url = get_permalink($post_id);
-    
-                }
-    
+
+                }
+
                 return -1;
-    
-            }
-    
+
+            }
+
         } // public function getProduktlink($produkt_id)
-    
+
         public function renderProdukt_templateSelect(&$produkt_data, &$template_file)
         {
-    
+
             if (($GLOBALS['wp_the_query']->is_tax || $GLOBALS['wp_the_query']->is_post_type_archive($this->shop->get_option('wpsg_mod_produktartikel_pathkey'))) && $this->shop->get_option('wpsg_mod_produktartikel_listtemplate') != '-1' && $this->shop->get_option('wpsg_mod_produktartikel_listtemplate') != false)
             {
-    
+
                 $template_file = WPSG_PATH_PRODUKTTEMPLATES.$this->shop->get_option('wpsg_mod_produktartikel_listtemplate');
-    
+
             }
             else if ($GLOBALS['wp_the_query']->is_search && $this->shop->get_option('wpsg_mod_produktartikel_searchtemplate') != '-1' && $this->shop->get_option('wpsg_mod_produktartikel_searchtemplate') != false)
             {
-    
+
                 $template_file = WPSG_PATH_PRODUKTTEMPLATES.$this->shop->get_option('wpsg_mod_produktartikel_searchtemplate');
-    
+
             }
             else if ($GLOBALS['wp_the_query']->is_home && $this->shop->get_option('wpsg_mod_produktartikel_hometemplate') != '-1' && $this->shop->get_option('wpsg_mod_produktartikel_hometemplate') != false)
             {
-    
+
                 $template_file = WPSG_PATH_PRODUKTTEMPLATES.$this->shop->get_option('wpsg_mod_produktartikel_hometemplate');
-    
-            }
-    
+
+            }
+
         } // public function renderProdukt_templateSelect(&$produkt_data, &$template_file)
-    
+
         public function loadProduktArray(&$produkt_data) {
-    
+
             global $wpdb;
-    
+
             $product_id = $this->shop->getProduktId($produkt_data['id']);
-    
+
             $post_data = $this->db->fetchRow("
                 SELECT
@@ -805,7 +808,7 @@
 
             if (!wpsg_isSizedArray($post_data)) return;
-    
+
             $post_id = $post_data['id'];
-    
+
             $arCat = $this->db->fetchOne("
                 SELECT
@@ -816,13 +819,13 @@
                     `object_id` = '".wpsg_q($post_id)."'
             ");
-    
+
             $permalink = get_permalink($post_id);
-    
+
             if (wpsg_isSizedInt($post_id) && wpsg_isSizedString($permalink)) {
-    
+
                 if ($this->shop->get_option('wpsg_mod_produktartikel_comment') === '1') $comment_status = 'open';
                 else if ($this->shop->get_option('wpsg_mod_produktartikel_comment') === '2') $comment_status = 'closed';
                 else $comment_status = $post_data['comment_status'];
-    
+
                 $produkt_data = wpsg_array_merge($produkt_data, array(
                     'post_id' => $post_id,
@@ -833,20 +836,20 @@
 					'menu_order' => $post_data['menu_order']
                 ));
-    
-            }
-    
+
+            }
+
         } // public function loadProduktArray(&$produkt_data)
-    
+
         public function systemcheck(&$arData)
         {
-    
+
             if (function_exists('icl_object_id'))
             {
-    
+
                 $icl_sitepress_settings = $this->shop->get_option('icl_sitepress_settings');
-    
+
                 if (wpsg_getStr($icl_sitepress_settings['custom_posts_sync_option'][$this->shop->get_option('wpsg_mod_produktartikel_pathkey')]) !== '1')
                 {
-    
+
                     $arData[] = array(
                         'wpsg_mod_produktartikel_wpml_custom_post_type',
@@ -857,11 +860,11 @@
                         )
                     );
-    
-                }
-    
-            }
-    
+
+                }
+
+            }
+
         } // public function systemcheck($arData)
-    
+
         /* Modulfunktionen */
 
@@ -903,27 +906,27 @@
 
             }
-            
+
             return $arProductIDs;
-            
+
         } // public function getTop1CatProductIDs()
-        
+
         private function updateTaxonomieCount()
         {
-    
+
             $arTermTaxonomyID = $this->db->fetchAssocField("SELECT `term_taxonomy_id` FROM `".$this->shop->prefix."term_taxonomy` ");
-    
+
             foreach ($arTermTaxonomyID as $term_taxonomy_id)
             {
-    
+
                 $count = $this->db->fetchOne("SELECT COUNT(*) FROM `".$this->shop->prefix."term_relationships` WHERE `term_taxonomy_id` = '".wpsg_q($term_taxonomy_id)."'");
-    
+
                 $this->db->UpdateQuery($this->shop->prefix.'term_taxonomy', array(
                     'count' => wpsg_q($count)
                 ), " `term_taxonomy_id` = '".wpsg_q($term_taxonomy_id)."' ");
-    
-            }
-    
+
+            }
+
         } // private function updateTaxonomieCount()
-    
+
         /**
          * Aktualisiert das Post Thumbnail (Beitragsbild)
@@ -932,40 +935,40 @@
         public function updatePostThumbnail($product_id)
         {
-    
+
             // Wenn das Produktbildermodul inaktiv ist, muss ich hier nichts machen
             // Oder wenn Option nicht aktiv
             if (!wpsg_isSizedInt($this->shop->get_option('wpsg_mod_produktartikel_postthumbnail'))) return;
-    
+
             $post_id = $this->getPostIdFromProductId($product_id);	// Parent-ID
-    
+
             if ($post_id !== false)
             {
-    
+
                 // ID des bestehenden POST Thumbnail
                 $post_thumbnail_id = get_post_thumbnail_id($post_id);
-    
+
                 // Eventuell bestehendes Thumbnail lÃ¶schen
                 if (wpsg_isSizedInt($post_thumbnail_id))
                 {
-    
+
                     // Postmeta Typ _thumbnail_id lÃ¶schen
                     //delete_post_thumbnail($post_id);
                     // Postmeta Typ _wp_attachment_metadata und _wp_attached_file und Post lÃ¶schen
                     //wp_delete_attachment($post_thumbnail_id);
-    
-                }
-    
+
+                }
+
                 $attachs = $this->shop->imagehandler->getAttachmentIDs($product_id);
                 if (wpsg_isSizedArray($attachs))
                 {
                     $attach_id = $attachs[0];
-    
+
                     // Postmeta Typ _thumbnail_id anlegen
                     set_post_thumbnail($post_id, $attach_id);
                 }
             }
-    
+
         } // private function updatePostThumbnail($product_id)
-    
+
         /**
          * Gibt false zurÃŒck, wenn noch kein POST existiert oder die POST_ID
@@ -975,5 +978,5 @@
          */
         public function hasPostId($product_id) {
-    
+
             $post_id = $this->db->fetchOne("
                     SELECT
@@ -985,10 +988,10 @@
                         `post_type` = '".wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."'
                 ");
-    
+
             if (wpsg_isSizedInt($post_id)) return $post_id;
             else return false;
-    
+
         } // public function hasPostId($product_id)
-    
+
         /**
          * Gibt die Ausgabe fÃŒr ein Produkt zurÃŒck
@@ -997,13 +1000,13 @@
         public function renderProdukt($produkt_id, $force_template = false, $force_locale = false)
         {
-    
+
             $oProduct = wpsg_product::getInstance($produkt_id);
-    
+
             $content = $oProduct->getShortDescription().$this->shop->renderProdukt($produkt_id, $force_template, $force_locale);
-    
+
             return $content;
-    
+
         } // public function renderProdukt($produkt_id, $force_template = false, $force_locale = false)
-    
+
         /**
          * Gibt die Post_ID anhand einer ProduktID zurÃŒck.
@@ -1011,7 +1014,7 @@
          */
         public function getPostIdFromProductId($product_id, $path = false, $comment_status = false, $menu_order = false, $update = false, $disabled = false) {
-    
+
             global $current_user;
-    
+
             $post_id = $this->db->fetchOne("
 				SELECT
@@ -1035,74 +1038,74 @@
 					`id` != '".wpsg_q($post_id)."' 
 			");
-			 
+
 			foreach ($arPostDoubleIDs as $double_post_id) {
-				
+
 				\wp_delete_post($double_post_id);
-				
+
 			}
 
             if (wpsg_isSizedInt($post_id) && $update !== true) return $post_id;
             else {
-    
+
                 // Hier wird der CustomPost Type angelegt
                 $product = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($product_id)."'");
-    
+
                 $arLanguages = $this->shop->getStoreLanguages();
-    
+
                 if (wpsg_isSizedArray($arLanguages) && sizeof($arLanguages) > 1)
                 {
-    
+
                     if (function_exists('icl_object_id')) //if (is_plugin_active('sitepress-multilingual-cms/sitepress.php'))
                     {
-    
+
                         // WPML speichert in extra Post, hier nichts machen
                         $post_title = $product['name'];
                         $post_content = $this->renderProdukt($product_id);
-    
+
                     }
                     else
                     {
-    
+
                         // Fallback fÃŒr qTranslate => Alle Sprachen in einen Post
-    
+
                         $post_title = '';
                         $post_content = '';
-    
+
                         // Titel der Ãbersetzten Produkte heraussuchen
                         foreach ($arLanguages as $l)
                         {
-    
+
                             $produkt_trans = $this->db->fetchRow("SELECT `id`, `name` FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_code` = '".wpsg_q($l['lang'])."' AND `lang_parent` = '".wpsg_q($product_id)."'");
-    
+
                             if ($produkt_trans['id'] > 0) // Ãbersetzung existiert					{
                             {
-    
+
                                 $post_title .= '<!--:'.$l['lang'].'-->'.$produkt_trans['name'].'<!--:-->';
                                 $post_content .= '<!--:'.$l['lang'].'-->'.$this->renderProdukt($product_id, false, $l['locale']).'<!--:-->';
-    
+
                             }
                             else // Ãbersetzung existiert nicht, hier trage ich einfach den Originaltext ein
                             {
-    
+
                                 $post_title .= '<!--:'.$l['lang'].'-->'.$product['name'].'<!--:-->';
                                 $post_content .= '<!--:'.$l['lang'].'-->'.$this->renderProdukt($product_id).'<!--:-->';
-    
+
                             }
-    
+
                         }
-    
+
                     }
-    
+
                 }
                 else
                 {
-    
+
                     $post_title = $product['name'];
                     $post_content = $this->renderProdukt($product_id);
-    
-                }
-    
+
+                }
+
                 $post_content = $this->clear_post_content($post_content);
-    
+
                 $data = array(
                     "post_title" => wpsg_q($post_title),
@@ -1115,13 +1118,13 @@
                     "post_modified_gmt" => "NOW()"
                 );
-    
+
                 if ($comment_status !== false) $data['comment_status'] = wpsg_q(((wpsg_isSizedInt($comment_status))?'open':'closed'));
                 if ($menu_order !== false) $data['menu_order'] = $menu_order;
                 if ($disabled !== false)
                 {
-    
+
                     if ($disabled === '1') $data['post_status'] = 'draft';
                     else $data['post_status'] = 'publish';
-    
+
                 }
     
