[TYPO3-shop] how to list related products in list view - LIST code

contact at ingabs.com contact at ingabs.com
Mon Dec 18 17:19:54 CET 2006


Hello ...

In single view, I list related products of current product, this is OK

But how can I list related products in the list view ( LIST code): I would
to list products and their related products.

File : tt_products/view/class.tx_ttproducts_list_view.php

Near Line 647 ... just before this comments : 

// cuts note in list view


I tried ...


// --> add by ingabs		
// get related products 

// query to get related prdouct of $row['uid'] product

$relatedIds = '';

$TYPO3_DB->exec_SELECTquery('tt_products_related_products_products_mm.uid_foreign',
'tt_products_related_products_products_mm,tt_products',
'tt_products.deleted=0 AND tt_products.hidden=0 AND
tt_products_related_products_products_mm.uid_local
='.intval($row['uid']).'');

while($row_related = $TYPO3_DB->sql_fetch_assoc($res_related)) { 					
if(false===strpos($relatedIds,$row_related['uid_foreign'])) $relatedIds .=
$row_related['uid_foreign'].',';
}

debug($relatedIds);

// ok, here I get the correct id of the related products


// try to list them 

if ($relatedIds != '')	{
// List all products:

include_once (PATH_BE_ttproducts.'view/class.tx_ttproducts_list_view.php');

$listView = t3lib_div::makeInstance('tx_ttproducts_list_view');

$listView->init(
  $this->pibase,
  $this->cnf,
  $this->basket,
  $this->page,
  $this->tt_content,
  $this->tt_products,
  $this->tt_products_articles,
  $this->tt_products_cat,
  $this->fe_users,
  $this->pid,
  $this->LLkey,
  $this->useArticles
);

//debug($listView);

// get markers

$templateArea = '###ITEM_LIST_RELATED_TEMPLATE###';
$tmpContent = $listView->printView(
 $templateCode,
 'LIST',
 explode(',', $relatedIds),
 $error_code,
 $templateArea2,
 $this->pibase->pageAsCategory
);

$markerArray['###PRODUCT_RELATED_UID###'] = $tmpContent;

debug($tmpContent);

// gives nothing, only "debug" !!!


} else {
$markerArray['###PRODUCT_RELATED_UID###'] = '';
}

// --> end ingabs


Thank you.

Ingabs




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