Вывести N-рандомных товаров из списка

    {$p_count = 2}
    {$products_menu = $wa->shop->productSet("promo")}

    {foreach $products_menu as $a => $k}
        {$products_item[] = $k.id}
    {/foreach}

    {foreach $products_item as $a => $k}
        {assign var=random value=1|rand:1000}
        {$products_items[$random] = $a}
        {$products_items[$random] = $k}
    {/foreach}

    {for $i=1 to 1000}
       {foreach $products_items as $s => $k}
            {if $i == $s}
                {$products_out[] = $k}
            {/if}
        {/foreach}
    {/for}

    {$products_sidebar = $wa->shop->products("id/"|cat:implode($products_out|array_slice:0:$p_count, ","))}
    {include file="`$wa_active_theme_path`/list-thumbs.html" products=$products_sidebar}

Смотрите также