currentstyle
22-08-09, 01:00
To show the complete category listing, use this code, with a check to make sure that if there is a third level it displays and if there isn't it doesn't.
define('API', 'PS');
require_once('constants.inc.php');
require_once('classes/class.ClientFactory.php');
$oClient = ClientFactory::getClient();
$categorytree= array("iCategoryId" => 0, "bExpandAllBranches" => true);
$oResponse= $oClient->call('getCategoryTree', $categorytree);
echo '<ul>';
foreach($oResponse->oCategoryTree->oCategory as $details){
$id = $details->iId;
$name = $details->sName;
echo '<li><a href="'.$id.'">'.$name.'</a><ul>';
foreach($details->oCategoryTree->oCategory as $details2){
$id = $details2->iId;
$name = $details2->sName;
$arraycheck1 = $details2->oCategoryTree->oCategory;
if(!empty($arraycheck1)){
echo '<li><a href="category.php?catid='.$id.'">'.$name.'</a>';
}
else
{
echo '<li><a href="category.php?catid='.$id.'">'.$name.'</a>';
}
$arraycheck = $details2->oCategoryTree->oCategory;
if(!empty($arraycheck)){
echo '<ul>';
foreach($details2->oCategoryTree->oCategory as $details3){
$id = $details3->iId;
$name = $details3->sName;
echo '<li><a href="category.php?catid='.$id.'">'.$name.'</a></li>';
}
echo '</ul>';
}
else
{
}
}
echo '</ul>';
}
echo '</ul>';
I have no idea why the sportswear & swimwear category is such a pig, but, there we are.
define('API', 'PS');
require_once('constants.inc.php');
require_once('classes/class.ClientFactory.php');
$oClient = ClientFactory::getClient();
$categorytree= array("iCategoryId" => 0, "bExpandAllBranches" => true);
$oResponse= $oClient->call('getCategoryTree', $categorytree);
echo '<ul>';
foreach($oResponse->oCategoryTree->oCategory as $details){
$id = $details->iId;
$name = $details->sName;
echo '<li><a href="'.$id.'">'.$name.'</a><ul>';
foreach($details->oCategoryTree->oCategory as $details2){
$id = $details2->iId;
$name = $details2->sName;
$arraycheck1 = $details2->oCategoryTree->oCategory;
if(!empty($arraycheck1)){
echo '<li><a href="category.php?catid='.$id.'">'.$name.'</a>';
}
else
{
echo '<li><a href="category.php?catid='.$id.'">'.$name.'</a>';
}
$arraycheck = $details2->oCategoryTree->oCategory;
if(!empty($arraycheck)){
echo '<ul>';
foreach($details2->oCategoryTree->oCategory as $details3){
$id = $details3->iId;
$name = $details3->sName;
echo '<li><a href="category.php?catid='.$id.'">'.$name.'</a></li>';
}
echo '</ul>';
}
else
{
}
}
echo '</ul>';
}
echo '</ul>';
I have no idea why the sportswear & swimwear category is such a pig, but, there we are.