Skip to content

Commit

Permalink
Fix for breadcrumb in SEO URL mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
abantecart committed Apr 9, 2014
1 parent 293fff5 commit d3a415c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion public_html/storefront/controller/pages/product/category.php
Expand Up @@ -48,7 +48,10 @@ public function main() {
$path = '';

$parts = explode('_', $this->request->get['path']);

if ( count($parts) == 1 ) {
//see if this is a category ID to sub category, need to build full path
$parts = explode('_', $this->model_catalog_category->buildPath($this->request->get['path']));
}
foreach ($parts as $path_id) {
$category_info = $this->model_catalog_category->getCategory($path_id);

Expand Down
17 changes: 17 additions & 0 deletions public_html/storefront/model/catalog/category.php
Expand Up @@ -199,4 +199,21 @@ public function getCategoriesBrands($categories=array()){
return $query->rows;
}

/**
* @param int $category_id
* @return string\
*/
public function buildPath($category_id) {
$query = $this->db->query("SELECT c.category_id, c.parent_id
FROM " . DB_PREFIX . "categories c
WHERE c.category_id = '" . (int)$category_id . "'
ORDER BY c.sort_order");

$category_info = $query->row;
if ($category_info['parent_id']) {
return $this->buildPath($category_info['parent_id']) . "_" . $category_info['category_id'];
} else {
return $category_info['category_id'];
}
}
}

0 comments on commit d3a415c

Please sign in to comment.