PDA

View Full Version : something wrong when changing categories PLEASE HELP


tadisaus2
11-23-2006, 01:48 AM
Hello,
I 've been running the directory for a few months, and when I changed category name to different name, something wrong happened.
Ex: url.com/dir/business-services/

When I changed it to dir/business/ then, added a few sub-categories on this category, it doesnot view correctly when viewing on browser.

On the main dir, it says dir/business/ but when I clicked on sub-categories, it points to the old category like dir/business-services/sub-cat/ even I already changed it to dir/business/ ???
Why is that? how do I fix this?

Thanks.

Dave Baker
11-23-2006, 04:59 PM
Hello tadisaus2,
Please try it:
http://www.esyndicat.com/forum/about7521.html

tadisaus2
11-23-2006, 05:02 PM
I can't go to that page because the error said that I don't have enough priviledge to access that page.
Anyway, thanks.

Dave Baker
11-23-2006, 05:10 PM
Try the following:
Make backup copy of your database.
***Open edit-category.php and find code around line # 76:***


if (!$error)
{
$gAdminDb->editCategory($temp);
$msg = 'Changes saved.';
}


***Replace with following***


if (!$error)
{
$pathCat=$gAdminDb->getCategories();
foreach ($pathCat as $value)
{
$value['path']=str_replace ($_POST['old_path'],$temp['path'],$value['path']);
$gAdminDb->editCategory($value);
}


$gAdminDb->editCategory($temp);
$msg = $gDirLang['changes_saved'];
}

***Save file***

tadisaus2
11-23-2006, 06:22 PM
I can't find that.
My version is a free version.
thanks.

Dave Baker
11-23-2006, 06:57 PM
It's for Free

***Open classes/DirAdmin.php and find function (bottom)

function deleteContact($aId)
{
$sql = "DELETE FROM `{$this->mPrefix}contacts` ";
$sql .= "WHERE `id` = '{$aId}'";

return $this->mDb->query($sql);
}

***Below this function add***

/**
* Returns a list of all categories
*
* @return arr
*/
function getCategories()
{
$sql = "SELECT `id`, `title`, `path` ";
$sql .= "FROM `{$this->mPrefix}categories` ";
$sql .= "WHERE `id` > 0 ";
$sql .= "ORDER BY `title` ";

return $this->mDb->getAll($sql);
}

***Save file***

***Open admin/edit-category.php and find code***

if (!$error)
{
$gAdminDb->editCategory($temp);
$msg = 'Changes saved';
$type = 'notif';
}

***Replace with following***

if (!$error)
{
$pathCat=$gAdminDb->getCategories();
foreach ($pathCat as $value)
{
$value['path']=str_replace ($_POST['old_path'],$temp['path'],$value['path']);
$gAdminDb->editCategory($value);
}


$gAdminDb->editCategory($temp);
$msg = 'Changes saved';
$type = 'notif';
}

***Save file***