[TYPO3-dev] do I need reverse relation?

Bartosz Aninowski bart at REMITsonik.pl
Fri Oct 13 12:15:42 CEST 2006


Hi list
This is my scenario.
I have table with products and mm relations to shops tables where user can 
buy these products.
If BE user adds new product he select also shops where products is on 
stock..
I want to show all shops where particular product is available.
I've tried this code but I think this is wrong. This query duplicates items 
on page.


//$this->piVars['prodUid'] is uid of clicked product

  if($this->piVars['prodUid']) $mm_cat = 
array('table'=>'tx_bapogromcy_products','mmtable'=>'tx_bapogromcy_products_shops_mm');
  $res = 
$this->pi_exec_query('tx_bapogromcy_shop',0,$where,$mm_cat,'','','');
  $count = 
$this->pi_exec_query('tx_bapogromcy_shop',1,$where,$mm_cat,'','','');

I think I  need select like this  uid_foreign = tx_bapogromcy_shop.uid and 
tx_bapogromcy_products.uid = prodUid but I could be wrong :)

Thanks in advance 






More information about the TYPO3-dev mailing list