[TYPO3-commerce] How to change the <title> tags in detail view ?

Torben Hansen - Skyfillers T.Hansen at skyfillers.com
Sat Jul 30 14:50:38 CEST 2011


Hello Michael360,

you can just extend ods_commerce_seo to output a page title.

1. Include the following to you TS (for the category/products subpages)

config.noPageTitle = 2

2. Replace the postInit function of ods_commerce_seo with this:

	function postInit($obj) {
		$pagerender = $GLOBALS['TSFE']->getPageRenderer();
		If ($obj->product) {
			if ($obj->product->tx_odscommerceseo_title != '') {
			    $title = $obj->product->tx_odscommerceseo_title;
			    $pagerender->setTitle($title);
			}
			$pagerender->addMetaTag('<meta name="title" content="'.$obj->product->tx_odscommerceseo_title.'" /> ');
			$pagerender->addMetaTag('<meta name="keywords" content="'.$obj->product->tx_odscommerceseo_keywords.'" /> ');
			$pagerender->addMetaTag('<meta name="description" content="'.$obj->product->tx_odscommerceseo_description.'" /> ');
		} elseif ($obj->category) {
			if ($obj->category->tx_odscommerceseo_title != '') {
			    $title = $obj->category->tx_odscommerceseo_title;
			    $pagerender->setTitle($title);
			}
			$pagerender->addMetaTag('<meta name="title" content="'.$obj->category->tx_odscommerceseo_title.'" /> ');
			$pagerender->addMetaTag('<meta name="keywords" content="'.$obj->category->tx_odscommerceseo_keywords.'" /> ');
			$pagerender->addMetaTag('<meta name="description" content="'.$obj->category->tx_odscommerceseo_description.'" /> ');
		}
	}

Best regards
Torben




> -----Ursprüngliche Nachricht-----
> Von: typo3-project-commerce-bounces at lists.typo3.org [mailto:typo3-project-
> commerce-bounces at lists.typo3.org] Im Auftrag von Michael360
> Gesendet: Samstag, 30. Juli 2011 10:52
> An: typo3-project-commerce at lists.typo3.org
> Betreff: [TYPO3-commerce] How to change the <title> tags in detail view ?
> 
> Hello
> Its me again ;-)
> 
> how do i change the <title> tags in detail view /overview  ?
> 
> At the moment it is in this form:
> Sitename : Productname : "Detail"
> 
> 
> I want to change it to:
> Productname : "Shop" (or "Kaufen")
> 
> 
> 
> I tried it with ods_commerce_seo, but this extension does only metatags. Too
> bad it cant do <title>
> 
> 
> 
> 
> thx
> 
> Michael360
> _______________________________________________
> TYPO3-project-commerce mailing list
> TYPO3-project-commerce at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-commerce


More information about the TYPO3-project-commerce mailing list