【发布时间】:2017-01-19 07:23:38
【问题描述】:
我需要在页眉中显示购物车中的商品数量。
我尝试将header.php 文件编辑为:
$products = $this->cart->getProducts();
$data['total'] = count($products);
然后在模板header.tpl中显示这个:
<?php echo $total?>
【问题讨论】:
-
你的代码是正确的并且对我有用。
-
请在更改后从管理员刷新修改缓存,然后检查它。请转到 admin > Extensions > Modifications 并单击蓝色的 Refresh 按钮(右上角)以更新系统并检查它。
标签: opencart opencart-module opencart2.3