Skip to content

Commit fc0730f

Browse files
authored
Fix hook and cookie logic
Echo cannot be used in migrated pages. Write needs to be called on cookie to be properly saved. It didn't work and even @PierreRambaud didn't know why.
1 parent c6e71f9 commit fc0730f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ps_googleanalytics.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,15 @@ public function hookDisplayAdminOrder()
139139
{
140140
$gaTagHandler = new PrestaShop\Module\Ps_Googleanalytics\Handler\GanalyticsJsHandler($this, $this->context);
141141

142-
echo $gaTagHandler->generate(
142+
$output = '';
143+
$output = $gaTagHandler->generate(
143144
$this->context->cookie->__get('ga_admin_refund'),
144145
true
145146
);
146147
$this->context->cookie->__unset('ga_admin_refund');
148+
$this->context->cookie->write();
149+
150+
return $output;
147151
}
148152

149153
/**

0 commit comments

Comments
 (0)