Prestashop 在具有2个包含文件的foreach中,仅在第一次迭代中有效,从第二次迭代开始,仅在1个包含文件中有效
嗨 我在一家Prestashop(Symfony[PHP]代表背面;Smarty代表正面)工作,当我们有foreach代表列表产品时:Prestashop 在具有2个包含文件的foreach中,仅在第一次迭代中有效,从第二次迭代开始,仅在1个包含文件中有效,prestashop,smarty,prestashop-1.7,smarty3,smarty2,Prestashop,Smarty,Prestashop 1.7,Smarty3,Smarty2,嗨 我在一家Prestashop(Symfony[PHP]代表背面;Smarty代表正面)工作,当我们有foreach代表列表产品时: {foreach from=$products item="product"} {include file="catalog/_partials/miniatures/product.tpl" product=$product} {/foreach} {block name='product_thumbnail'
{foreach from=$products item="product"}
{include file="catalog/_partials/miniatures/product.tpl" product=$product}
{/foreach}
{block name='product_thumbnail'}
<p style="color:white;font-size:8px;opacity:0">pre thumbnail</p>
{include file='catalog/_partials/miniatures/_partials/product-miniature-thumb.tpl'}
<p style="color:white;font-size:8px;opacity:0">post thumbnail</p>
{/block}
<div class="product-description">
<div class="product-condition">
...
这个foreach调用产品的缩影(列表产品的缩影),然后,我们有其他用于产品缩略图的模板:
{foreach from=$products item="product"}
{include file="catalog/_partials/miniatures/product.tpl" product=$product}
{/foreach}
{block name='product_thumbnail'}
<p style="color:white;font-size:8px;opacity:0">pre thumbnail</p>
{include file='catalog/_partials/miniatures/_partials/product-miniature-thumb.tpl'}
<p style="color:white;font-size:8px;opacity:0">post thumbnail</p>
{/block}
<div class="product-description">
<div class="product-condition">
...
{block name='product\u缩略图'}
预览缩略图
{include file='catalog/_partials/minimatures/_partials/product minimal thumb.tpl'}
张贴缩略图
{/block}
...
如果您看到最后一张照片,您可以看到一对文本,我将它们用于检测模板停止的位置,问题是:
出于某种原因,第一次迭代效果很好,但是在下一次迭代中,foreach“跳转”了微型产品,只使用了缩略图,结果:我们只在左边的第一次看到产品描述,其余的只有照片。
我认为问题可能在于我们包括的方式,或者。。。也许我们可以做一个里面有两个包的foreach
谢谢你的介绍