Skip to content

Commit f36aacc

Browse files
Guisardomatks
authored andcommitted
Prevent array to string error.
1 parent 5debadb commit f36aacc

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

classes/Hook/HookDisplayFooter.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
use PrestaShop\Module\Ps_Googleanalytics\Wrapper\ProductWrapper;
2929
use Ps_Googleanalytics;
3030
use Tools;
31+
use RecursiveIteratorIterator;
32+
use RecursiveArrayIterator;
3133

3234
class HookDisplayFooter implements HookInterface
3335
{
@@ -70,6 +72,11 @@ public function run()
7072
$gacart['quantity'] = abs($gacart['quantity']);
7173
$gaScripts .= 'MBG.removeFromCart(' . json_encode($gacart) . ');';
7274
}
75+
} elseif (is_array($gacart)) {
76+
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($gacart));
77+
foreach($it as $v) {
78+
$gaScripts .= $v;
79+
}
7380
} else {
7481
$gaScripts .= $gacart;
7582
}

0 commit comments

Comments
 (0)