Commit 9ffc1f1cb9c1d9a8d5ce3be9262a7ae080d5aaa9

Authored by Alex Savenko
1 parent 993186ae

remarketing

frontend/views/layouts/main.php
... ... @@ -565,7 +565,8 @@
565 565 ';
566 566 }
567 567 elseif (isset($this->params['remarketing'])) {
568   - echo '
  568 + echo /** @lang javascript */
  569 + '
569 570 <script type="text/javascript">
570 571 var google_tag_params = {
571 572 dynx_pagetype: "'.$this->params['remarketing']['type'].'",
... ...
frontend/views/order/index.php
... ... @@ -18,10 +18,17 @@ $this-&gt;params[ &#39;seo&#39; ][ Seo::TITLE] = $this-&gt;title;
18 18 $this->params['remarketing']['type'] = 'conversionintent';
19 19 $this->params['remarketing']['id'] = '';
20 20 $this->params['remarketing']['price'] = '';
21   -foreach ($models as $model) {
22   - $this->params['remarketing']['id'][] = $model->product_id;
23   - $this->params['remarketing']['price'][] = $model->price;
  21 +if (count($models) > 1) {
  22 + foreach ($models as $model) {
  23 + $this->params['remarketing']['id'][] = $model->product_id;
  24 + $this->params['remarketing']['price'][] = $model->price;
  25 + }
24 26 }
  27 +else {
  28 + $this->params['remarketing']['id'] = $models->product_id;
  29 + $this->params['remarketing']['price'] = $models->price;
  30 +}
  31 +
25 32 ?>
26 33 <?php if ($flash = Yii::$app->session->getFlash ('success')): ?>
27 34 <div class="alert-success"><?= $flash ?></div>
... ...
frontend/views/order/success.php
... ... @@ -9,6 +9,23 @@
9 9 \Yii::$app->session->remove('order_data');
10 10 $order = $order_data[ 'order' ];
11 11 $variants = $order_data[ 'variants' ];
  12 +
  13 + $products = $order->getProducts();
  14 + $this->params['remarketing']['type'] = 'conversionintent';
  15 + $this->params['remarketing']['id'] = '';
  16 + $this->params['remarketing']['price'] = '';
  17 + if (count($products) > 1) {
  18 + foreach ($products as $product) {
  19 + $this->params['remarketing']['id'][] = $product->product_id;
  20 + $this->params['remarketing']['price'][] = $product->price;
  21 + }
  22 + }
  23 + else {
  24 + $this->params['remarketing']['id'] = $products->product_id;
  25 + $this->params['remarketing']['price'] = $products->price;
  26 + }
  27 +
  28 +
12 29 ?>
13 30 <div class="block-100">
14 31 <div class="container">
... ...