[Typo3-shop] Problem extending tt_products

Simon Tuck e-mailNO at SPAMeyejet.com
Thu Jan 26 16:18:12 CET 2006


Franz Holzinger wrote:
Franz Holzinger wrote:
> Hello Simon,
>>>
>> I think I have found the problem. By default the entire TCA is not
>> loaded in the frontend:
>> "Normally in the frontend only a part of the global $TCA array is
>> loaded, for instance the "ctrl" part. Thus it doesn't take up too much
>> memory."
>> see: http://typo3.org/fileadmin/typo3api-3.8.0/d2/df2/classtslib__fe.html
>>
>> So I've added the line
>> tslib_fe::includeTCA();
>> to main in class.tx_ttproducts_pi1.php
>>
>> Now my additional fields are included in the front end!
> 
> thanks for this information.
> However this has the drawback that all TCA will be loaded in frontend
> and not only that of the tt_products tables.
> 
> The error comes from
> 
> 
> /**
> 	* Loads the $TCA (Table Configuration Array) for the $table
> 	*
> 	* Requirements:
> 	* 1) must be configured table (the ctrl-section configured),
> 	* 2) columns must not be an array (which it is always if whole table
> loaded), and
> 	* 3) there is a value for dynamicConfigFile (filename in typo3conf)
> 	* Usage: 84
> 	*
> 	* @param	string		Table name for which to load the full TCA array part
> into the global $TCA
> 	* @return	void
> 	*/
> function loadTCA($table)	{
> 	global $TCA,$LANG_GENERAL_LABELS;
> 	if (isset($TCA[$table]) && !is_array($TCA[$table]['columns']) &&
> $TCA[$table]['ctrl']['dynamicConfigFile'])	{
> 		if
> (!strcmp(substr($TCA[$table]['ctrl']['dynamicConfigFile'],0,6),'T3LIB:'))	{
> 		
> include(PATH_t3lib.'stddb/'.substr($TCA[$table]['ctrl']['dynamicConfigFile'],6));
> 		} elseif
> (t3lib_div::isAbsPath($TCA[$table]['ctrl']['dynamicConfigFile']) &&
> @is_file($TCA[$table]['ctrl']['dynamicConfigFile']))	{	// Absolute path...
> 			include($TCA[$table]['ctrl']['dynamicConfigFile']);
> 		} else include(PATH_typo3conf.$TCA[$table]['ctrl']['dynamicConfigFile']);
> 	}
> }
> 
> 
> So probably the
> $TCA['tt_products'] = Array (
> ...
> 'dynamicConfigFile' => PATH_BE_ttproducts.'tca.php',
> 
> causes that only the tca.php from EXT:tt_products will be loaded only.
> 
> 
> 
> There should be a better solution to this where still only the TCA for
> the tt_products table will get loaded.
> 
> 
> 
> Franz
> 
> 
> 
> 

> Hello Simon,
>>>
>> I think I have found the problem. By default the entire TCA is not
>> loaded in the frontend:
>> "Normally in the frontend only a part of the global $TCA array is
>> loaded, for instance the "ctrl" part. Thus it doesn't take up too much
>> memory."
>> see: http://typo3.org/fileadmin/typo3api-3.8.0/d2/df2/classtslib__fe.html
>>
>> So I've added the line
>> tslib_fe::includeTCA();
>> to main in class.tx_ttproducts_pi1.php
>>
>> Now my additional fields are included in the front end!
> 
> thanks for this information.
> However this has the drawback that all TCA will be loaded in frontend
> and not only that of the tt_products tables.
Yes, I know. Not the ideal solution, but it's all I've got at the moment.
> 
> The error comes from
> 
> 
> /**
> 	* Loads the $TCA (Table Configuration Array) for the $table
> 	*
> 	* Requirements:
> 	* 1) must be configured table (the ctrl-section configured),
> 	* 2) columns must not be an array (which it is always if whole table
> loaded), and
> 	* 3) there is a value for dynamicConfigFile (filename in typo3conf)
> 	* Usage: 84
> 	*
> 	* @param	string		Table name for which to load the full TCA array part
> into the global $TCA
> 	* @return	void
> 	*/
> function loadTCA($table)	{
> 	global $TCA,$LANG_GENERAL_LABELS;
> 	if (isset($TCA[$table]) && !is_array($TCA[$table]['columns']) &&
> $TCA[$table]['ctrl']['dynamicConfigFile'])	{
> 		if
> (!strcmp(substr($TCA[$table]['ctrl']['dynamicConfigFile'],0,6),'T3LIB:'))	{
> 		
> include(PATH_t3lib.'stddb/'.substr($TCA[$table]['ctrl']['dynamicConfigFile'],6));
> 		} elseif
> (t3lib_div::isAbsPath($TCA[$table]['ctrl']['dynamicConfigFile']) &&
> @is_file($TCA[$table]['ctrl']['dynamicConfigFile']))	{	// Absolute path...
> 			include($TCA[$table]['ctrl']['dynamicConfigFile']);
> 		} else include(PATH_typo3conf.$TCA[$table]['ctrl']['dynamicConfigFile']);
> 	}
> }
> 
> 
> So probably the
> $TCA['tt_products'] = Array (
> ...
> 'dynamicConfigFile' => PATH_BE_ttproducts.'tca.php',
So loadTCA just loads the original tca file and ignores any extensions...
> 
> causes that only the tca.php from EXT:tt_products will be loaded only.
> 
> 
> 
> There should be a better solution to this where still only the TCA for
> the tt_products table will get loaded.
> 

Agreed. Is that a bug or something for the wishlist? Will you add this to bugs.typo3.org or should I?
Thanks again for support & kind regards,
Simon



More information about the TYPO3-project-tt-products mailing list