本博客基于Opencart2.1.0.1源码,架设在阿里云香港机房!  技术交流QQ群:103164069
vim catalog/controller/product/product.php
$data['product_id'] = (int)$this->request->get['product_id'];
$data['manufacturer'] = $product_info['manufacturer'];
$data['manufacturers'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $product_info['manufacturer_id']);
$data['model'] = $product_info['model'];
$data['weight'] = sprintf("%.2f", $product_info['weight']);//这里保留小数点两位
$data['reward'] = $product_info['reward'];
$data['points'] = $product_info['points'];
$data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');


vim catalog/view/theme/default/template/product/product.tpl
 <ul class="list-unstyled">
  <?php if ($manufacturer) { ?>
   <li><?php echo $text_manufacturer; ?> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a></li>
  <?php } ?>
  <li><?php echo $text_model; ?> <?php echo $model; ?></li>
  <?php if ($reward) { ?>
  <li><?php echo $text_reward; ?> <?php echo $reward; ?></li>
  <?php } ?>
  <li><?php echo $text_stock; ?> <?php echo $stock; ?></li>
  <li>重量<?php echo $weight; ?></li>
 </ul>

Write a review

Please login or register to review
浏览次数:322

OpenCart前台产品信息页显示重量

  • Product Code: OpenCart前台产品信息页显示重量
  • Availability: In Stock
  • ¥0.00