Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted December 29, 20222 yr I am using this code in several feed block templates to show a random entry from a selection of entries: {{shuffle($records);}} {{$records = array_slice($records, 0, 1);}} But it doesn’t work for Commerce feed blocks, as $packages is not an array. Anyone knows how to adopt the above code to work with these ActiveRecordIterators?
December 29, 20222 yr Solution You could use https://www.php.net/manual/en/function.iterator-to-array.php to get an array from the iterator