PDA

View Full Version : Showing random subcat links in main category


PeekHoles
09-05-2007, 10:36 PM
I got a question I'm not sure if it can be done so here it goes. Is there away to show some random sub category links in the main category. Like say I'm doing a bakery type directory.

Layout like this I'm breaking them down into cities.
domain.com/usa/florida/miami
domain.com/usa/florida/orlando and so on..

When you browse to the Florida directory, you wont see any links. Due to my links being in the sub cats. Is there away to show some of the links from the two sub cats and list them in the Florida directory as well.

Just thought I would ask :)

I'm running Version 2.1.03

John Turner
09-06-2007, 07:14 AM
Hi PeekHole,
This functionality will be added in our new V2.2.
But if you want to have this modification implemented in your current version it will cost extra $50.
If you agree please contact me over PM.

PeekHoles
09-06-2007, 01:30 PM
How much longer until v2.2?

PeekHoles
09-06-2007, 07:43 PM
Never mind I see it should not be too much longer.

PeekHoles
10-08-2007, 10:01 PM
Has this feature been added in v2.2?

John Turner
10-09-2007, 04:50 AM
Hi,
I've answered on your PM.

John Turner
10-10-2007, 08:38 AM
Hi there,
Here solution on how to show all subcategories listings in the parent category
This changes will be added into final release of V2.2

Please make sure that you've backed up files before making changes.

1. open ../includes/classes/esynCategory.php
find function getListings
find following code

$sql = 'SELECT '.$a.' `t1`.*, `t1`.`comments_active` `comments`, ';
$sql .= $aAccount ? 'IF((`t1`.`account_id` = \'0\'), \'0\', \'1\') `account_id_edit`' : '\'0\' `account_id_edit` ';
$sql .= ', IF((`t2`.`category_id` = \''.$aCategory.'\'), \'1\', \'0\') `crossed`, ';
$sql .= ($aAccount) ? "IF (`fav_accounts_set` LIKE '%{$aAccount},%', '1', '0') `favorite` " : "'0' `favorite` ";
$sql .= 'FROM `'.$this->mPrefix.'listings` `t1` ';
$sql .= 'LEFT JOIN `'.$this->mPrefix.'listing_categories` `t2` ON `t1`.`id`= `t2`.`listing_id` ';
$sql .= 'LEFT JOIN `'.$this->mPrefix.'accounts` `t4` ON `t1`.`account_id` = `t4`.`id` ';
$sql .= 'WHERE (`t2`.`category_id` = \''.$aCategory.'\' OR `t1`.`category_id` = \''.$aCategory.'\') ';


replace with following code

$sql = 'SELECT '.$a.' `t1`.*, `t1`.`comments_active` `comments`, ';
$sql .= (0 == $aCategory) ? '' : 'CONCAT(`t11`.`path`,\'/\') `path`, `t11`.`title` `category_title`, ';
$sql .= $aAccount ? 'IF((`t1`.`account_id` = \'0\'), \'0\', \'1\') `account_id_edit`' : '\'0\' `account_id_edit` ';
$sql .= ', IF((`t2`.`category_id` = \''.$aCategory.'\'), \'1\', \'0\') `crossed`, ';
$sql .= ($aAccount) ? "IF (`fav_accounts_set` LIKE '%{$aAccount},%', '1', '0') `favorite` " : "'0' `favorite` ";

if(0 == $aCategory)
{
$sql .= 'FROM `'.$this->mPrefix.'listings` `t1` ';
}
else
{
$sql .= 'FROM `'.$this->mPrefix.'flat_structure` `t10` ';
$sql .= 'LEFT JOIN `'.$this->mPrefix.'listings` `t1` ON `t10`.`category_id`=`t1`.`category_id` ';
$sql .= 'LEFT JOIN `'.$this->mPrefix.'categories` `t11` ON `t11`.`id`=`t1`.`category_id` ';
}
$sql .= 'LEFT JOIN `'.$this->mPrefix.'listing_categories` `t2` ON `t1`.`id`= `t2`.`listing_id` ';
$sql .= 'WHERE (`t2`.`category_id` = \''.$aCategory.'\' ';
$sql .= (0 == $aCategory) ? '' : 'OR `t10`.`parent_id` = \''.$aCategory.'\' ';
$sql .= 'OR `t1`.`category_id` = \''.$aCategory.'\') ';


*** save and close it.

2. open ../index.php
find following code

$total_listings = isset($esynAccountInfo['id']) ? $esynCategory->foundRows() : $category['num_listings'];


replace it with following code

$total_listings = $esynCategory->foundRows();


find and remove following code

$p = '';
if ($category['id'] != '0')
{
$p = $category['path'].'/';
}
$c = count($listings);
for($i=0; $i < $c; $i++)
{
$p2 = $p;
if($listings[$i]['crossed'])
{
if($listings[$i]['category_id'] == 0)
{
$p2 = '';
}
else
{
$p2 = $esynCategory->one("path", "`id`='".$listings[$i]['category_id']."'")."/";
}
}
$listings[$i]['path'] = $p2;
$listings[$i]['category_title'] = $esynCategory->one("title", "`id`='{$listings[$i]['category_id']}'");
}


*** save and close it.

HTH