![](/img/trans.png)
[英]What is difference between reward points and price in reward points in opencart
[英]Opencart 3.x - Display price in reward points - featured home
我想在Opencart 3.x的擴展/模塊/功能模塊的獎勵點中顯示價格,所以我編寫了以下代碼:
{% if points %}
<p class="price-pkt">Price in points is:
<span>
{{ text_points }} {{ points }} POINTS
</span>
</p>
{% endif %}
並將此代碼添加到精選控制器中:
$data['points'] = $product_info['points'];
但是我主頁上的Featured循環顯示所有產品的最新產品獎勵價格,並且不知道如何解決。 始終顯示所有產品的最后添加的產品獎勵價格。
您需要像這樣從控制器傳遞到模板的現有產品數組$ data ['products']中傳遞每個產品的積分
'price' => $price,
'points' => $product_info['points'],
'special' => $special,
然后在模板中將代碼更新為
{% if product.points %}
<p class="price-pkt">Price in points is:
<span>{{ text_points }} {{ product.points }} POINTS</span>
</p>
{% endif %}
並確保它在產品循環中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.