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

Franz Holzinger franz at fholzinger.com
Thu May 5 19:26:11 CEST 2005


I have just thought there is an easier solution

> 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');
> }
> 

Create only a macro table_postfix:

if (!defined ('TABLE_postfix')) {
      define('TABLE_postfix', 'a'); // replace 'a' by any character or 
number sequence
  }

e.g. in class.tx_ttproducts.php:

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 
'tt_products'.TABLE_postfix, 'uid='.intval($this->tt_product_single).' 
AND pid IN 
('.$this->pid_list.')'.$this->cObj->enableFields('tt_products'.TABLE_postfix));

So this must only be done where tt_products corresponds to the name of 
the table name. The postfix has the advantage to the prefix that in 
phpmyadmin all the shop tables will be listed one after the other by 
there names.

Then use this TABLE_postfix everywhere where a table name is used.
The ext_tables.sql has to be renamed manually.


Franz



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