1
我的英語不好,請原諒我。如何添加<span></span>目錄計數(Opencart目錄模塊)
我希望我的目錄名稱,這樣
Productname <span> product count </span>
這裏product.tpl
<ul class="box-category">
<?php foreach ($categories as $category) { ?>
<li>
<?php if ($category['category_id'] == $category_id) { ?>
<a href="<?php echo $category['href']; ?>" class="active"><?php echo $category['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
<?php } ?>
<?php if ($category['children']) { ?>
<ul>
<?php foreach ($category['children'] as $child) { ?>
<li>
<?php if ($child['category_id'] == $child_id) { ?>
<a href="<?php echo $child['href']; ?>" class="active"> - <?php echo $child['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $child['href']; ?>"> - <?php echo $child['name']; ?></a>
<?php } ?>
</li>
<?php } ?>
</ul>
<?php } ?>
</li>
<?php } ?>
</ul>
的代碼,我想這一些地方在模塊/ product.php
$children_data[] = array(
'category_id' => $child['category_id'],
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
$this->data['categories'][] = array(
'category_id' => $category['category_id'],
'name' => $category['name'] . ($this->config->get('config_product_count') ? ' (' . $total . ')' : ''),
'children' => $children_data,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
}
但我不知道如何插入它,請幫助我! Plz !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
對不起,它從模塊/ catalog.tpl和模塊/ catalog.php請幫助我,請 –
$ product_total = $這個 - > model_catalog_product-> getTotalProducts($數據); \t \t \t \t $ total + = $ product_total; 我認爲它在這裏,對不起,因爲我不想這個問題變得太長,所以我不發佈完整的模塊/ catalog.php,它是我的錯誤 –
你的問題是什麼?您想做什麼? – hkulekci