I have a data array with for example
Something like
[bestellijst] => Array
(
[0] => Array
(
[aantal] => 0
[artikel] => Pan y aioli (Brood met Spaanse knoflookmayonaise)
[prijs] => € 2,60
)
[1] => Array
(
[aantal] => 1
[artikel] => Pan y aioli, tapenade y mantequilla con hierbas (Brood met Spaanse knoflookmayonaise, tapenade en kruidenboter)
[prijs] => € 4,65
)I can loop through the data but is it possible to get only the results back where 'aantal' is bigger then zero?
Something like
if ({var:loop6.row.aantal} >= 1) {
{var:loop6.row.aantal}
{var:loop6.row.artikel}
{var:loop6.row.prijs}
}
Hi marcelwolf,
The easiest way is probably to use a PHP action. You can loop through the array and unset all the entries where the count is 0. After that you can continue to work with the remaining entries.
Bob
The easiest way is probably to use a PHP action. You can loop through the array and unset all the entries where the count is 0. After that you can continue to work with the remaining entries.
Bob
In a php block: Use $this->get in place of {var: and $this->data in place of {data:
ALTHOUGH where are you getting this data? If you're getting it from a database why not just restrict the query?
return array_filter($this->data('data_name'), function($entry) {
return $entry['aantal'] > 0;
}ALTHOUGH where are you getting this data? If you're getting it from a database why not just restrict the query?
This topic is locked and no more replies can be posted.
