[TYPO3-commerce] #7134: CategoryTree will be displayed in other Linkhandler Tabs

Ingo Schmitt is at marketing-factory.de
Mon Apr 12 10:36:38 CEST 2010


Hi Dimitri,

Patch is fine by reading. Other solution would be to set AOEs extension as conflicts, but this is no solution.

Ingo

> Hello folks
> 
> If you use aoe medias linkhandler you have some other tabs in you add-links-window. The CategoryTree will be displayed even in the news tab. Solution is a check if the current tab is really commerce.
> 
> Patch attached. Any other solutions or ideas?
> 
> Cheers
> Dimitri
> Index: hooks/class.tx_commerce_browselinkshooks.php
> ===================================================================
> --- hooks/class.tx_commerce_browselinkshooks.php	(Revision 31931)
> +++ hooks/class.tx_commerce_browselinkshooks.php	(Arbeitskopie)
> @@ -92,69 +92,71 @@
>     // Contenu du nouvel onglet
>     function getTab($act) {
>     	global $TCA,$BE_USER, $BACK_PATH;
> -    	
> -    	//strip http://commerce: in front of url
> -    	$url = $this->pObj->curUrlInfo['value'];
> -    	$url = substr($url, stripos($url, 'commerce:') + strlen('commerce:'));
> -		
> -		$product_uid 	= 0;
> -		$cat_uid 		= 0;
> -		
> -    	$linkHandlerData = t3lib_div::trimExplode('|',$url);
> 
> -		foreach ($linkHandlerData as $linkData) {
> -			$params = t3lib_div::trimExplode(':',$linkData);
> -		if (isset($params[0])){
> -			if ($params[0] == 'tx_commerce_products') {
> -				$product_uid = (int)$params[1];
> -			} elseif ($params[0] == 'tx_commerce_categories') {
> -				$cat_uid = (int)$params[1];
> +		if($act == 'commerce_tab') {
> +			//strip http://commerce: in front of url
> +			$url = $this->pObj->curUrlInfo['value'];
> +			$url = substr($url, stripos($url, 'commerce:') + strlen('commerce:'));
> +			
> +			$product_uid 	= 0;
> +			$cat_uid 		= 0;
> +			
> +			$linkHandlerData = t3lib_div::trimExplode('|',$url);
> +	
> +			foreach ($linkHandlerData as $linkData) {
> +				$params = t3lib_div::trimExplode(':',$linkData);
> +			if (isset($params[0])){
> +				if ($params[0] == 'tx_commerce_products') {
> +					$product_uid = (int)$params[1];
> +				} elseif ($params[0] == 'tx_commerce_categories') {
> +					$cat_uid = (int)$params[1];
> +				}
> 			}
> -		}
> -		if (isset($params[2])){
> -			if ($params[2] == 'tx_commerce_products') {
> -				$product_uid = (int)$params[3];
> -			} elseif ($params[2] == 'tx_commerce_categories') {
> -				$cat_uid = (int)$params[3];
> +			if (isset($params[2])){
> +				if ($params[2] == 'tx_commerce_products') {
> +					$product_uid = (int)$params[3];
> +				} elseif ($params[2] == 'tx_commerce_categories') {
> +					$cat_uid = (int)$params[3];
> +				}
> +			}			
> +			}		
> +			if ($product_uid > 0 && $cat_uid > 0){
> +				//$this->pObj->expandPage = $cat_uid;
> 			}
> -		}			
> -		}		
> -		if ($product_uid > 0 && $cat_uid > 0){
> -			//$this->pObj->expandPage = $cat_uid;
> +			
> +			if ($this->isRTE()) {
> +					if (isset($this->pObj->classesAnchorJSOptions)) {
> +					$this->pObj->classesAnchorJSOptions[$act]=@$this->pObj->classesAnchorJSOptions['page']; //works for 4.1.x patch, in 4.2 they make this property protected! -> to enable classselector in 4.2 easoiest is to path rte. 
> +				}    
> +			}
> +			
> +			// set product/category of current link for the tree to expand it there
> +			if($product_uid > 0) {
> +				$this->treeObj->setOpenProduct($product_uid);
> +			}
> +			
> +			if($cat_uid > 0) {
> +				$this->treeObj->setOpenCategory($cat_uid);
> +			}
> +			
> +			// get the tree
> +			$tree = $this->treeObj->getBrowseableTree();
> +			
> +			$cattable = '<h3 class="bgColor5">Category Tree:</h3><div id="PageTreeDiv">'.$tree.'</div>';
> +			
> +			$content = $this->script;
> +			$content .= $cattable;
> +			
> +			
> +			
> +			
> +			
> +			if ($this->isRTE()) {
> +				$content .= $this->pObj->addAttributesForm();	
> +				
> +			}
> +			return $content;
> 		}
> -    	
> -    	if ($this->isRTE()) {
> -    			if (isset($this->pObj->classesAnchorJSOptions)) {
> -				$this->pObj->classesAnchorJSOptions[$act]=@$this->pObj->classesAnchorJSOptions['page']; //works for 4.1.x patch, in 4.2 they make this property protected! -> to enable classselector in 4.2 easoiest is to path rte. 
> -			}    
> -    	}
> -    	
> -    	// set product/category of current link for the tree to expand it there
> -    	if($product_uid > 0) {
> -    		$this->treeObj->setOpenProduct($product_uid);
> -    	}
> -    	
> -    	if($cat_uid > 0) {
> -    		$this->treeObj->setOpenCategory($cat_uid);
> -    	}
> -    	
> -    	// get the tree
> -    	$tree = $this->treeObj->getBrowseableTree();
> -    	
> -    	$cattable = '<h3 class="bgColor5">Category Tree:</h3><div id="PageTreeDiv">'.$tree.'</div>';
> -    	
> -    	$content = $this->script;
> -    	$content .= $cattable;
> -    	
> -    	
> -    	
> -    	
> -    	
> -        if ($this->isRTE()) {
> -        	$content .= $this->pObj->addAttributesForm();	
> -        	
> -    	}
> -    	return $content;     
>     }
> 
> 	
> _______________________________________________
> TYPO3-team-commerce mailing list
> TYPO3-team-commerce at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-team-commerce


Mit freundlichen Gruessen
Ingo Schmitt

-- 
Marketing Factory Consulting GmbH  *   mailto:is at marketing-factory.de
Stephanienstrasse 36               *          Tel.: +49 211-361176-63
D-40211 Duesseldorf, Germany       *          Fax:  +49 211-361176-99
Amtsgericht Duesseldorf HRB 53971  * http://www.marketing-factory.de/

Geschaeftsfuehrer:    Peter Faisst   |   Katja Faisst
Karoline Steinfatt   |   Christoph Allefeld   |   Markus M. Kimmel



More information about the TYPO3-team-commerce mailing list