在类别页面中的价格下添加产品重量

问题描述 投票:-2回答:2

我想在OpenCart3的类别页面中添加产品默认重量,我该怎么做?

谢谢

php opencart
2个回答
0
投票

我为weight under price in product page here做了类似的答案

对于类别页面,它非常相似:

  1. 在文件catalog/controller/product/category.phpline 203添加
'weight'      => $result['weight'] + 0,
  1. 在文件catalog/view/theme/default/template/product/category.twigline 142添加
{{product.weight}}

这将显示重量

enter image description here


2
投票

我在这里的分类页面中显​​示产品重量下的产品重量有很好的答案

在类别部分中,您可以执行以下步骤:

步骤:1首先你打开文件:catalog / controller / product / category.php

找到下面的行

'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,

添加或写入以下代码后

'weight'      => $result['weight'],

步骤:2打开文件:catalog / view / theme / default / template / product / category.twig

找到下面的行

{% if product.rating %}

在添加或编写以下代码之前

<span class="text-weight" style="font-size: 12px;font-weight: 600;color: #e82a17;">weight : {{product.weight}} </span>

我希望我的代码100%正常工作。如有任何问题,您可以通过评论框向我询问。

谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.