[Typo3-shop] more than 1 shop in a site

Franz Holzinger franz at fholzinger.com
Thu May 5 18:48:26 CEST 2005


Hello Vladimir,

>>A better solution however would be to replace the name 'tt_products' with 
>>$_EXT in all php-files. Tell me, if you want to do this.
>>
Ooops, $_EXTKEY must be used.

> 
> Thanks for the answer.
> Since this is the better solution I will gladly use it. What I have to do 
> after renaming the files?

Before renaming the files, you should rename in the php-files where 
'tt_products' has been used to $_EXTKEY. This is usefull because you 
will need it with your newly created extension and it will make it easy 
in the future to upgrade to a newer version. This means that there will 
not be found the name tt_products anymore.

After that you email me these files (as a ZIP-file) so I can bring them 
in into the next version higher 2.0.1. Wait until the next version 2.0.1 
of tt_products has been published. It is planned for this Saturday.

Then decide whether you want to use also separate database tables.
ext_tables.sql ext_tables.php give the names of them.

So rename
tt_products --> yourextension
tt_products_cat --> yourextension_cat
sys_products_orders --> sys_yourextension_orders
sys_products_orders_mm_tt_products --> 
sys_yourextension_orders_mm_yourextension

Create macros for the table names in ext_localconf.php!

if (!defined ('TABLE_products')) {
	define('TABLE_products', $_EXTKEY);
}

if (!defined ('TABLE_products_cat')) {
	define('TABLE_products_cat', $_EXTKEY.'_cat');
}

.
.
.

if (!defined ('TABLE_sys_products_orders_mm_tt_products')) {
	define('TABLE_sys_products_orders_mm_tt_products', 
'TABLE_sys_'.$_EXTKEY.'_orders_mm_'.$_EXTKEY);
}

But tt_products naming is a bit not adaptable for this.
So include an if around this.

if ($_EXTKEY == 'tt_products) {
if (!defined ('TABLE_products')) {
	define('TABLE_products', 'tt_products');
}
.
.
.
if (!defined ('TABLE_sys_products_orders_mm_tt_products')) {
	define('TABLE_sys_products_orders_mm_tt_products', 
'sys_products_orders_mm_tt_products');
}
}


Then the real table names must be replaced in all php-files (esp. 
tca.php) by the defined macros from above.
But the improvement would be great. Everyone would have to adapt only 
this file, rename class.tx_ttproducts.php and maybe it is necessary to 
rename also the 'class tx_ttproducts'. But then the shops would use 
different database tables and be really independant from each other.

The table field names should remain the same.

Greetings,

Franz










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