我想根据FOR EACH循环中计数器的值给变量赋值。如果为counter=1,则赋值为'a',但如果计数器不为1,则赋值为'b‘。
这就是我所取得的进展,但一旦我添加了条件和计数器更改,我的代码就会崩溃……
[{foreach from=$orderArticles item="currOrderArticle"}]
[{if $counter == 1}]
products_info.push(["transaction_id='a'"]);
[{assign var="counter" value=2}]
[{else}]
products_info.push(["transaction_id='b'"]);
[{/if}]
[{/foreach}]https://stackoverflow.com/questions/38224846
复制相似问题