- ';
} else {
$this->count+2;
$result .= '
- ';
}
break;
case 2:
$result .= $this->parent_start_string . "\n";
break;
}
$result .= $sLink;
if ($level == 0) {
$result .= '';
}
switch ($category['menu_type'] ) {
case 'NEW':
$result .= 'NEW';
break;
case 'PROMO':
$result .= 'PROMO';
break;
}
if ($this->follow_cpath === TRUE) {
if (in_array($category_id, $this->cpath_array)) {
$result .= $this->cpath_start_string . $category['name'] . $this->cpath_end_string;
} else {
$result .= $category['name'];
}
} else {
$result .= $category['name'];
}
$result .= '';
if ($level == 1) {
$result .= '
';
}
if ($level == 2) {
if ($this->count > 8) {
$this->count = 0;
$this->count_col++;
$result .= '
' . "\n";
}
}
if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
if ($this->follow_cpath === TRUE) {
if (in_array($category_id, $this->cpath_array)) {
$result .= $this->buildBranch($category_id, $level+1);
}
} else {
$result .= $this->buildBranch($category_id, $level+1, $submenu);
}
}
switch ($level) {
case 0:
if ($this->submenu > 0) {
if (($this->banner_image != '') && ($this->count_col <= 3)) {
if ($this->count_col == 1) {
$result .= '
';
} elseif ($this->count_col == 2) {
$result .= '
';
} elseif ($this->count_col == 1) {
$result .= '
';
}
$result .= '
';
}
$result .= '
' . "\n";
}
$this->submenu = 0;
$result .= $this->root_end_string;
break;
case 1:
if ($this->count > 0) {
$result .= '';
}
break;
case 2:
if ($this->count > 0) {
$result .= $this->parent_end_string;
}
break;
}
}
}
return $result;
}
public function buildBreadcrumb($category_id, $level = 0) {
$breadcrumb = '';
foreach ($this->data as $parent => $categories) {
foreach ($categories as $id => $info) {
if ($id == $category_id) {
if ($level < 1) {
$breadcrumb = $id;
} else {
$breadcrumb = $id . $this->breadcrumb_separator . $breadcrumb;
}
if ($parent != $this->root_category_id) {
$breadcrumb = $this->buildBreadcrumb($parent, $level+1) . $breadcrumb;
}
}
}
}
return $breadcrumb;
}
public function build() {
return $this->buildBranch($this->root_category_id);
}
public function setRootCategoryID($root_category_id) {
$this->root_category_id = $root_category_id;
}
public function setMaximumLevel($max_level) {
$this->max_level = $max_level;
}
public function setRootString($root_start_string, $root_end_string) {
$this->root_start_string = $root_start_string;
$this->root_end_string = $root_end_string;
}
public function setBreadcrumbSeparator($breadcrumb_separator) {
$this->breadcrumb_separator = $breadcrumb_separator;
}
public function setBreadcrumbUsage($breadcrumb_usage) {
if ($breadcrumb_usage === TRUE) {
$this->breadcrumb_usage = TRUE;
} else {
$this->breadcrumb_usage = FALSE;
}
}
public function setCategoryPath($cpath, $cpath_start_string = '', $cpath_end_string = '') {
$this->follow_cpath = TRUE;
$this->cpath_array = explode($this->breadcrumb_separator, $cpath);
$this->cpath_start_string = $cpath_start_string;
$this->cpath_end_string = $cpath_end_string;
}
public function setFollowCategoryPath($follow_cpath) {
if ($follow_cpath === TRUE) {
$this->follow_cpath = TRUE;
} else {
$this->follow_cpath = FALSE;
}
}
public function setCategoryPathString($cpath_start_string, $cpath_end_string) {
$this->cpath_start_string = $cpath_start_string;
$this->cpath_end_string = $cpath_end_string;
}
public function setCategoryProductCountString($category_product_count_start_string, $category_product_count_end_string) {
$this->category_product_count_start_string = $category_product_count_start_string;
$this->category_product_count_end_string = $category_product_count_end_string;
}
}