在默认的 OpenCart 代码中尝试类似的东西。
步骤1
打开文件:catalog\language\english\product\category.php
寻找:
$_['text_price'] = 'Price:';
之后添加:
$_['text_reward'] = 'Reward Points:';
第2步
打开文件:catalog\controller\product\category.php
寻找:
'price' => $price,
之后添加:
'points' => $result['points'],
第 3 步
在同一个文件中:catalog\controller\product\category.php
寻找:
$data['text_price'] = $this->language->get('text_price');
之后添加:
$data['text_reward'] = $this->language->get('text_reward');
第4步
打开文件:catalog\view\theme\default\template\product\category.tpl
寻找:
<?php if ($product['price']) { ?>
<p class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
<?php } ?>
</p>
<?php } ?>
之后添加:
<p><?php echo $text_reward; ?> <?php echo $product['points']; ?></p>
然后检查它。