Index: trunk/kernel/include/parseditem.php =================================================================== diff -u -r773 -r787 --- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 773) +++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 787) @@ -2199,7 +2199,7 @@ return $ret; } - function GetJoinedSQL($PermName, $CatId=NULL, $AdditionalWhere="") + function GetJoinedSQL($PermName, $CatId=NULL, $AdditionalWhere="", $LoadOnlyPrimary = true) { global $objSession, $objPermissions; @@ -2212,8 +2212,15 @@ $sql ="INNER JOIN $cattable ON ($cattable.ItemResourceId=$ltable.ResourceId) "; $sql .="INNER JOIN $CategoryTable ON ($CategoryTable.CategoryId=$cattable.CategoryId) "; $sql .= "INNER JOIN $ptable ON ($cattable.CategoryId=$ptable.CategoryId) "; - $sql .="WHERE ($acl AND PermId=$VIEW AND PrimaryCat=1 AND $CategoryTable.Status=1) "; + // here will come checking for PrimaryCat on search + if ($LoadOnlyPrimary) { + $sql .="WHERE ($acl AND PermId=$VIEW AND PrimaryCat=1 AND $CategoryTable.Status=1) "; + } + else { + $sql .="WHERE ($acl AND PermId=$VIEW AND $CategoryTable.Status=1) "; + } + if(is_numeric($CatId)) { $sql .= " AND ($CategoryTable.CategoryId=$CatId) "; @@ -2748,7 +2755,14 @@ $where = "ItemType=".$this->ItemType." AND $ltable.Status=1"; - $sql .= $this->GetJoinedSQL($p,NULL,$where); + $load_multiple = $objConfig->Get("Search_ShowMultiple_".$attribs['multiple']); + $LoadOnlyPrimary = true; + + if ($load_multiple == 1) { + $LoadOnlyPrimary = false; + } + + $sql .= $this->GetJoinedSQL($p,NULL,$where, $LoadOnlyPrimary); $sql .= " ORDER BY EdPick DESC,Relevance DESC "; $tmp = $this->QueryOrderByClause(FALSE,TRUE,TRUE); @@ -2757,6 +2771,7 @@ { $sql .= ", ".$tmp." "; } + //echo "SQL Search Items: $sql

"; return $sql; }