M
M
Msim2015-09-09 21:49:57
PHP
Msim, 2015-09-09 21:49:57

How does he get the result in ( prestashop ) through a double foreach?

foreach ($products as $kp => $p)
        foreach ($grades_comments as $gc)
          if ($gc['id_product'] == $p['id_product'])
          {
            $products[$kp]['mymodcomments']['grade_avg'] = round($gc['grade_avg']);
            $products[$kp]['mymodcomments']['nb_comments'] = $gc['nb_comments'];
          }
      $find['result'] = $products;

I understood earlier that (in this example)
foreach ($products as $kp => $p)
foreach ($p['subarray'] as $gc)
and thus pull out the data....

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question