[Typo3-shop] Multicritaeria search in shop module

Franz Holzinger franz at fholzinger.com
Wed May 4 18:42:32 CEST 2005


Hello Cyril,

> 
> That's i've finally done, but it's not perfect, i can't select many 
> values in each input field.
> And impossible to find were "swords" is declarated in 
> class_tx_tt_products and how the search is done ...

if ($theCode=="SEARCH")	{
		// Get search subpart
	$t["search"] = 
$this->cObj->getSubpart($this->templateCode,$this->spMarker("###ITEM_SEARCH###"));
		// Substitute a few markers
	$out=$t["search"];
	if (!$this->conf["displayBasketColumns"])
	{
		$out=$this->cObj->substituteMarker($out, "###FORM_URL###", 
$this->getLinkUrl($this->conf["PIDsearch"]));
	}
	$out=$this->cObj->substituteMarker($out, "###SWORDS###", 
htmlspecialchars(t3lib_div::_GP("swords")));
		// Add to content
	$content.=$out;
	if (t3lib_div::_GP("swords"))	{
		$where = $this->searchWhere(trim(t3lib_div::_GP("swords")));
	}

	// if parameter "newitemdays" is specified, only new items from the 
last X days are displayed
	if (t3lib_div::_GP("newitemdays")) {
		$temptime = time() - 86400*intval(trim(t3lib_div::_GP("newitemdays")));
		$where = 'AND tstamp >= '.$temptime;
	}

}

.
.
.
} elseif ($where)	{
	$content.=$this->cObj->getSubpart($this->templateCode,$this->spMarker("###ITEM_SEARCH_EMPTY###"));
}



/**
  * Generates a search where clause.
  */
function searchWhere($sw)	{
	$where=$this->cObj->searchWhere($sw, $this->searchFieldList, 
'tt_products');
	return $where;
}


That is nearly all the code.
What exactly do you need?

Franz



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