Index: ds/wpsg_mod_productview.class.php
===================================================================
--- /mods/wpsg_mod_productview.class.php	(revision 6528)
+++ 	(revision )
@@ -1,406 +1,0 @@
-<?php
-
-	/**
-	 * Modul welches ProduktÃŒbersichtsseiten ermÃ¶glicht
-	 */
-	class wpsg_mod_productview extends wpsg_mod_basic
-	{
-
-		var $lizenz = 1;
-		var $id = 5100;
-		var $hilfeURL = false;
-				
-		const DISPLAYMODE_FILTER_SMALL = '0';
-		const DISPLAYMODE_FILTER_CHECKBOX = '1';
-		
-		public function __construct()
-		{
-				
-			parent::__construct();
-				
-			$this->name = __('Produktansichten', 'wpsg');
-			$this->group = __('Produkte', 'wpsg');
-			$this->desc = __('ErmÃ¶glicht die Darstellung von Produktlisten ÃŒber Shortcodes.', 'wpsg');
-				
-		} // public function __construct()
-		
-		public function init()
-		{
-		
-			add_shortcode('wpsg_productview', array($this, 'wpsg_sc_productview'));
-			add_shortcode('wpsg_productview_filter', array($this, 'wpsg_sc_productview_filter'));
-				
-		} // public function init()
-
-		public function produkt_ajax()
-		{
-			
-			$this->shop->view['arSelect'] = ['-1' => __('Alle Produkte', 'wpsg'), '0' => __('Manuelle Produktauswahl')];
-			$this->shop->view['arProductgroups'] = [];
-			$this->shop->view['arCategories'] = [];
-			
-			if ($this->shop->hasMod('wpsg_mod_productgroups'))
-			{
-				
-				$this->shop->view['arSelect'][9] = __('Produktgruppenauswahl', 'wpsg');
-				$this->shop->view['arProductgroups'] = (array)$this->shop->callMod('wpsg_mod_productgroups', 'getAllProductGroups'); 			
-				
-			}
-			
-			if ($this->shop->hasMod('wpsg_mod_produktartikel'))
-			{
-				
-				$this->shop->view['arSelect'][15] = __('Produktkategorien', 'wpsg');
-				$this->shop->view['arCategories'] = (array)$this->shop->callMod('wpsg_mod_produktartikel', 'getCategorySelectArray');
-				
-			}
-			
-			die($this->shop->render(WPSG_PATH_VIEW.'/mods/mod_productview/shortcodegenerator.phtml'));
-			
-		} // public function produkt_ajax()
-		
-		public function wpsg_enqueue_scripts()
-		{
-				
-			if (!is_admin())
-			{
-					
-				wp_enqueue_script('wpsg_mod_productview_js', $this->shop->getRessourceURL('mods/mod_productview/productview.js'), array('jquery', 'jquery-ui-slider'));
-				 		
-			}
-				
-		} // public function wpsg_enqueue_scripts()
-		
-		public function tinymce_button(&$buttons) 
-		{ 
-		
-			array_push($buttons, '|', 'wpsgModProductviewPlugin');
-			
-		}
-		
-		public function tinymce_plugin(&$plugin_array) 
-		{ 
-			
-			if (wpsg_getStr($_REQUEST['page']) != 'wpsg-Produkt')
-			{
-			
-				$plugin_array['wpsgModProductviewPlugin'] = $this->shop->getRessourceURL('mods/mod_productview/mce_plugin.js');
-				
-			}
-			
-		} // public function tinymce_plugin($plugin_array)
-		
-		public function settings_edit()
-		{
-			
-			$this->shop->render(WPSG_PATH_VIEW.'mods/mod_productview/settings_edit.phtml');
-			
-		} // public function settings_edit()
-		
-		public function settings_save()
-		{
-			 
-		} // public function settings_save()
-		
-		/* Modulfunktionen */
-		
-		public function refreshRedirect()
-		{
-						
-			$atts = $_REQUEST['wpsg_atts'];
-						
-			if (wpsg_isSizedString($atts['filter'])) parse_str($atts['filter'], $atts['filter']);
-			
-			if (isset($atts['filter']['attributs'])) $atts['filter']['attributs'] = wpsg_trim($atts['filter']['attributs']);
-			if (isset($atts['filter']['variants'])) $atts['filter']['variants'] = wpsg_trim($atts['filter']['variants']);
-			
-			die($this->wpsg_sc_productview($atts));
-			
-		} // public function refreshRedirect()
-		 	
-		/**
-		 * Filter fÃŒr die Produktansicht
-		 * filter = Kommagetrennte Filter
-		 * 			pricefilter (Preisfilter)
-		 * 			catfilter (Liste mit Unterkategorien)
-		 * 			pv_1_checkbox = pv_1 (Produktvariable ID1 mit Mehrfachauswahl ÃŒber Checkboxen)
-		 * 			pv_2_small (Produktvariable ID2 mit Mehrfachauswahl ÃŒber grafische Boxen)
-		 * 			pa_1 (Produktattribut ID1 ÃŒber Checkboxen)
-		 */
-		public function wpsg_sc_productview_filter($atts)		
-		{
-			
-			$arVariantsGlobal = false;
-			$arAttributsGlobal = false;
-			
-			$this->shop->view['displayMode'] = array();
-			$this->shop->view['arVariants'] = array();
-			$this->shop->view['arAttributs'] = array();
-			$this->shop->view['showFilter'] = array();
-			
-			$atts['filter'] = wpsg_trim(explode(',', $atts['filter']));
-			
-			if (!wpsg_isSizedArray($atts['filter'])) $atts['filter'] = array('catfilter', 'pricefilter');
-			
-			$arSubCatIDs = false;
-			if ($this->shop->hasMod('wpsg_mod_produktartikel')) $arSubCatIDs = $this->shop->callMod('wpsg_mod_produktartikel', 'getSubCategoryID', array(get_queried_object()->term_id));
-						
-			foreach ($atts['filter'] as $k => $v)
-			{
-				
-				$arCode = explode('_', $v);
-				
-				if ($v === 'catfilter' && $this->shop->hasMod('wpsg_mod_produktartikel'))
-				{
-					
-					$arCat = $this->shop->callMod('wpsg_mod_produktartikel', 'getSubCategory', array(get_queried_object()->term_id));
-					
-					if (wpsg_isSizedArray($arCat))
-					{
-					
-						$this->shop->view['showFilter']['catfilter'] = array(
-							'type' => 'catfilter',
-							'cat' => $arCat						
-						);
-						
-					}
-					
-				} 
-				else if (preg_match('/pricefilter/', $v) && $this->shop->canDisplayPrice()) 
-				{
-					
-					$this->shop->view['showFilter']['pricefilter'] = array(
-						'type' => 'pricefilter',
-						'min' => wpsg_product::findMinPrice(array('cat_ids' => $arSubCatIDs)), 
-						'max' => wpsg_product::findMaxPrice(array('cat_ids' => $arSubCatIDs))
-					);
-					
-				}
-				else if (preg_match('/^pv_\d/', $v) && $this->shop->hasMod('wpsg_mod_productvariants'))
-				{
-					
-					if ($arVariantsGlobal === false) $arVariantsGlobal = $this->shop->callMod('wpsg_mod_productvariants', 'getVariants', array(false, true));
-					 
-					if (array_key_exists($arCode[1], $arVariantsGlobal))
-					{
-													
-						if (wpsg_getStr($arCode[2]) === 'small' || wpsg_getStr($arCode[2]) === self::DISPLAYMODE_FILTER_SMALL) $displayMode = self::DISPLAYMODE_FILTER_SMALL;
-						else $displayMode = self::DISPLAYMODE_FILTER_CHECKBOX; 
-						
-						// VerfÃŒgbare Variationen ermitteln						
-						$variation = $this->shop->callMod('wpsg_mod_productvariants', 'getVariationOfVariant', array($arVariantsGlobal[$arCode[1]]['id'], false, array(
-							'cat_ids' => $arSubCatIDs
-						)));
-																		
-						if (wpsg_isSizedArray($variation))
-						{
-						
-							$this->shop->view['showFilter'][] = array(
-								'type' => 'productvariants',
-								'displayMode' => $displayMode,
-								'variant' => $arVariantsGlobal[$arCode[1]],
-								'variation' => $variation
-							);
-							
-						}
-						
-					}
-					
-				}
-				else if (preg_match('/^pa_\d/', $v) && $this->shop->hasMod('wpsg_mod_produktattribute'))
-				{
-					
-					if ($arAttributsGlobal === false) $arAttributsGlobal = $this->shop->callMod('wpsg_mod_produktattribute', 'getProductattributs');
-															
-					if (array_key_exists($arCode[1], $arAttributsGlobal))
-					{
-					
-						$arAttributValue = $this->shop->callMod('wpsg_mod_produktattribute', 'getAttributValues', array($arCode[1], array(
-							'cat_ids' => $arSubCatIDs
-						)));
-						
-						$attribute = $arAttributsGlobal[$arCode[1]];
-						
-						// EintrÃ€ge entfernen zu denen es keine Produkte gibt
-						foreach ($attribute['auswahl'] as $k => $value) if (!in_array($k, $arAttributValue)) unset($attribute['auswahl'][$k]);
-												
-						if (wpsg_isSizedArray($attribute['auswahl']))
-						{
-						
-							$this->shop->view['showFilter'][] = array(
-								'type' => 'productattributs',
-								'attribute' => $attribute							
-							);
-							
-						}
-						
-					}
-					
-				}
-				
-			}
-			
-			if (!wpsg_isSizedArray($this->shop->view['showFilter'])) return '';
-			
-			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_productview/productview_filter.phtml', false);
-			
-		} // public function wpsg_sc_productview_filter($atts)
-		
-		/**
-		 * Shortcode fÃŒr die Anzeige der Produkte
-		 */
-		public function wpsg_sc_productview($atts)
-		{
-						
-			$this->shop->view['wpsg_mod_productview']['arOrder'] = array(
-				'price_asc' => __('Preis aufsteigend', 'wpsg'),
-				'price_desc' => __('Preis absteigend', 'wpsg')
-			);
-				
-			if (wpsg_isSizedString($atts['order']) && array_key_exists($atts['order'], $this->shop->view['wpsg_mod_productview']['arOrder'])) $this->shop->view['wpsg_mod_productview']['order'] = $atts['order'];
-			else 
-			{
-				
-				$this->shop->view['wpsg_mod_productview']['order'] = 'price_asc';
-				$atts['order'] = $this->shop->view['wpsg_mod_productview']['order'];
-				
-			}
-	 
-			$arProductviewArray = $this->getSelectedProductArray($atts);
-			   
-			$this->shop->view['wpsg_mod_productview'] = wpsg_array_merge($this->shop->view['wpsg_mod_productview'], $arProductviewArray);
-			$this->shop->view['wpsg_mod_productview']['index'] = wpsg_getInt($GLOBALS['wpsg_mod_productview_index'], 1);
-			$this->shop->view['wpsg_mod_productview']['atts'] = $atts;
- 
-			$this->shop->view['wpsg_mod_productview']['pageMax'] = $arProductviewArray['page'] * $arProductviewArray['per_page'];
-			if ($this->shop->view['wpsg_mod_productview']['pageMax'] > $arProductviewArray['count']) $this->shop->view['wpsg_mod_productview']['pageMax'] = $arProductviewArray['count']; 
-			
-			if (wpsg_isSizedInt($atts['cols'], 3))
-			{
-				
-				$this->shop->view['wpsg_mod_productview']['cols'] = 3;
-				$this->shop->view['wpsg_mod_productview']['col_class']['title'] = 'col-lg-0 col-md-0 col-sm-0';
-				$this->shop->view['wpsg_mod_productview']['col_class']['order'] = 'col-lg-4 col-md-6 col-sm-6';
-				$this->shop->view['wpsg_mod_productview']['col_class']['info'] = 'col-lg-8 col-md-6 col-sm-6';
-				$this->shop->view['wpsg_mod_productview']['col_class']['product'] = 'col-lg-4 col-md-4 col-sm-4';
-								
-			}
-			else
-			{
-				
-				$this->shop->view['wpsg_mod_productview']['cols'] = 4;
-				$this->shop->view['wpsg_mod_productview']['col_class']['title'] = 'col-lg-3 col-md-3 col-sm-3';
-				$this->shop->view['wpsg_mod_productview']['col_class']['order'] = 'col-lg-3 col-md-3 col-sm-3';
-				$this->shop->view['wpsg_mod_productview']['col_class']['info'] = 'col-lg-6 col-md-6 col-sm-6';
-				$this->shop->view['wpsg_mod_productview']['col_class']['product'] = 'col-lg-3 col-lg-6 col-sm-6';
-				
-			}
-						
-			$this->shop->view['wpsg_mod_productview']['cols'] = wpsg_getStr($atts['cols'], '4');
-			$this->shop->view['wpsg_mod_productview']['mode'] = wpsg_getStr($atts['mode'], 'grid');
-
-			$GLOBALS['wpsg_mod_productview_index'] = $this->shop->view['wpsg_mod_productview']['index'] + 1; 
-			 
-			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_productview/productview.phtml', false);
-			
-		} // public function wpsg_sc_productview($atts)
-		
-		/**
-		 * Gibt die ProduktIDs fÃŒr die Anzeige anhand der Shortcode Einstellungen zurÃŒck
-		 */
-		private function getSelectedProductArray($atts)
-		{
-			
-			$arFilter = [];
-			$arReturn = [];
-			
-			if (wpsg_isSizedString($atts['product_ids']))
-			{
-			
-				$arFilter = array(
-					'product_ids' => wpsg_trim(array_unique(explode(',', $atts['product_ids'])))
-				);
-			
-			}
-			else if (wpsg_isSizedString($atts['productgroup_ids']))
-			{
-				
-				$arFilter = array(
-					'productgroup_ids' => wpsg_trim(array_unique(explode(',', $atts['productgroup_ids'])))
-				);
-				
-			}
-			else if (wpsg_isSizedString($atts['cat_ids']))
-			{
-				
-				$arCatIDs = wpsg_trim(explode(',', $atts['cat_ids']));
-				foreach ($arCatIDs as $k => $cat_id)
-				{
-					
-					$arSubCat = get_terms(array(
-						'taxonomy' => 'wpsgtax',
-						'child_of' => $cat_id							
-					));
-
-					if (wpsg_isSizedArray($arSubCat))
-					{
-
-						foreach ($arSubCat as $sub_cat)
-						{
-
-							$arCatIDs[] = $sub_cat->term_id;
-
-						}
-
-					}
-										
-				}
-				
-				$arFilter = array(
-					'cat_ids' => wpsg_trim($arCatIDs)
-				);
-				
-			}
-				
-			if (!wpsg_isSizedInt($atts['hideNotBuyable'])) $arFilter = wpsg_array_merge($arFilter, array('hideNotBuyable' => '1'));
-			if (wpsg_isSizedString($atts['filter']['price_min'])) $arFilter = wpsg_array_merge($arFilter, array('price_min' => $atts['filter']['price_min']));
-			if (wpsg_isSizedString($atts['filter']['price_max'])) $arFilter = wpsg_array_merge($arFilter, array('price_max' => $atts['filter']['price_max']));
-			if ($this->shop->hasMod('wpsg_mod_productvariants') && wpsg_isSizedArray($atts['filter']['variants'])) $arFilter['variants'] = $atts['filter']['variants'];
-			if ($this->shop->hasMod('wpsg_mod_produktattribute') && wpsg_isSizedArray($atFilter)) $arFilter['attributs'] = $atts['filter']['attributs'];
-			 
-			if (wpsg_isSizedString($atts['order']))
-			{
-				
-				$arOrderCode = explode('_', $atts['order']);
-				
-				if ($arOrderCode[0] === 'price') $arFilter['order'] = 'price';				
-				
-				if ($arOrderCode[1] === 'asc' && wpsg_isSizedString($arFilter['order'])) $arFilter['ascdesc'] = 'ASC';
-				else $arFilter['ascdesc'] = 'DESC';
-				
-			}
-		 
-			$arProductIDs = wpsg_product::find($arFilter, false);
-			$nCount = sizeof($arProductIDs);
-			
-			$nPage = wpsg_getInt($atts['page'], 1);			
-			$nPerPage = wpsg_getInt($atts['per_page'], 8);
-			$nPages = ceil($nCount / $nPerPage);
-			
-			$arReturn = wpsg_product::getInstance(array_slice($arProductIDs, ($nPage - 1) * $nPerPage, $nPerPage, true));
-												
-			return array(
-				'page' => $nPage, 
-				'per_page' => $nPerPage,
-				'pages' => $nPages, 
-				'count' => $nCount,
-				'product_ids' => $arProductIDs,
-				'products' => $arReturn,
-				'title' => wpsg_getStr($atts['title'])
-			);
-			
-		} // private function getSelectedProductArray($atts)
-		
-	} // class wpsg_mod_productview extends wpsg_mod_basic
-		
-?>
