在Prestashop中向product-list.tpl添加数量

时间:2015-11-05 21:04:13

标签: prestashop

我在prestashop中使用默认主题

我在products-list.tpl(〜第191行)找到了这个地方,我想添加代码并想要显示库存水平,如果它小于10

我添加了

  

  {l s ='警告:剩余库存:'} {$ product->数量量}

但此代码没有显示任何数字 - 我假设$ product->数量为空。 它是一个缺少SQL查询。它没有从DB中获取属性?

2 个答案:

答案 0 :(得分:1)

$product是数组,而不是对象,在Smarty模板中,您可以访问数组元素:

{l s='Warning: remaining stock : '}{$product.quantity}

答案 1 :(得分:0)

感谢 继承人我想做什么 (约191行)

 {if $product.quantity <= 10}
 <span class="label-warning">{l s=' in stock : '}&nbsp{$product.quantity}</span> {else} 
<span> class="label-warning">{l s='in stock  : >10'}</span> {/if}
相关问题