Quote Originally Posted by Loter View Post
The addon does not generate full cPath for categories, for example.. if the product is in subcategory
index.php?main_page=index&cPath=35_37_43

search script only generates
index.php?main_page=index&cPath=43

How can I make the script to generate full cpath?

I've added a function in searches.php that generates full cpaths

function getcPath($catid)
{
global $db;
$retstr=0;
if($catid!=0)
{
$sqlcPath = "SELECT parent_id from ".TABLE_CATEGORIES." where categories_id=".mysql_real_escape_string($catid);
//echo "<br>".$sqlcPath."<br>";
$dbcPath = $db->Execute($sqlcPath);
if ($dbcPath->RecordCount() > 0) {
$retstr = $dbcPath->fields['parent_id'];
}
}else
{
$retstr = 0;
}
return $retstr;
}
function calccPath($catid)
{
$sep = "_";
$retstr = $catid;
do
{
$currpath = getcPath($catid);
$catid=$currpath;
if($catid!=0)
{
$retstr = $catid.$sep.$retstr;
}
}while($currpath!=0);
return $retstr;
}

then below:
$prodResult = strip_tags($dbCategories->fields['categories_name']);

added:
$dbCategories->fields['categories_id'] = calccPath($dbCategories->fields['categories_id']);