我正在使用opencart 3.x中的内置google base扩展,我需要一个特殊的标签来显示类别中所有子元素的格式为(Home> category1> category1_1)
这是我尝试调整的内置代码,该代码在下单后显示每个类别
$categories = $this->model_catalog_product->getCategories($product['product_id']);
foreach ($categories as $category) {
$path = $this->getPath($category['category_id']);
if ($path) {
$string = '';
foreach (explode('_', $path) as $path_id) {
$category_info = $this->model_catalog_category->getCategory($path_id);
if ($category_info) {
if (!$string) {
$string = $category_info['name'];
} else {
$string .= ' > ' . $category_info['name'];
}
}
}
$output .= '<g:product_type><![CDATA[' . $string . ']]></g:product_type>';
}
}