I'm using the View rendering library with Smarty .
In my view, I have an output with the array of product information inside a foreach:
{assign var='remove_products' [712, 716, 717, 718, 719, 720, 745, 755, 758]}
{foreach from=$products item=product name=products}
{if !in_array($product.id_product, $remove_products)}
{$product.id_product|escape:'htmlall':'UTF-8'}
{$product.name|escape:'htmlall':'UTF-8'}
{$product.legend|escape:'htmlall':'UTF-8'}
<!-- OBS: gostaria de salvar todos os dados acima
em um novo array e usar a coleção novamente abaixo
-->
{/if}
{/foreach]}
<!-- usando a coleção (nova) só que com os itens removidos -->
{$products}
How could I do this. Anybody know? I tried to do this but it did not roll:
{assign var='remove_products' [712, 716, 717, 718, 719, 720, 745, 755, 758]}
{assign var='n_products' []}
{foreach $products as $key => $value}
{if !in_array($value.id_product, $remove_products)}
{$n_products[$key] = $value}
{/if}
{/foreach}
{$products = $n_products}