Схема
protected mixed
getCategories (
$parent_id, $current_path = '' )
Аргументы
| Аргумент |
Возможный тип |
Описание |
| $parent_id |
— |
— |
| $current_path = '' |
— |
— |
Описание
Метод пока еще не документирован.
Исходный код
$output = '';
$results = $this->model_catalog_category->getCategories($parent_id);
foreach ($results as $result) {
if (!$current_path) {
$new_path = $result['category_id'];
} else {
$new_path = $current_path . '_' . $result['category_id'];
}
$output .= '<url>';
$output .= '<loc>' . $this->url->link('product/category', 'path=' . $new_path) . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>0.7</priority>';
$output .= '</url>';
$products = $this->model_catalog_product->getProducts(array('filter_category_id' => $result['category_id']));
foreach ($products as $product) {
$output .= '<url>';
$output .= '<loc>' . $this->url->link('product/product', 'path=' . $new_path . '&product_id=' . $product['product_id']) . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>1.0</priority>';
$output .= '</url>';
}
$output .= $this->getCategories($result['category_id'], $new_path);
}
return $output;