我正在寻找一种在站点地图页面上显示更多类别的方法(默认情况下为 3)。
我尝试sitemap.twig
使用以下代码修改模板:
<li><a href="{{ category_3.href }}">{{ category_3.name }}</a>
{% if category_3.children %}
<ul>
{% for category_4 in category_3.children %}
<li><a href="{{ category_4.href }}">{{ category_4.name }}</a></li>
{% endfor %}
</ul>
{% endif %}
</li>
但它没有用。
然后我也尝试再换/catalog/controller/information/sitemap.php
一个foreach
周期:
foreach ($categories_3 as $category_3) {
$level_4_data = array();
$categories_4 = $this->model_catalog_category->getCategories($category_3['category_id']);
foreach ($categories_4 as $category_4) {
$level_4_data[] = array(
'name' => $category_4['name'],
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'] . '_' . $category_4['category_id'])
);
}
$level_3_data[] = array(
'name' => $category_3['name'],
'children' => $level_4_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
);
}
什么也没发生。所以我问是否有任何方法可以解决我的问题?