Blame view

frontend/views/order/success.php 4.53 KB
8072159c   Alex Savenko   create proj
1
2
3
  <?php
      /**
       * @var Orders $order
8072159c   Alex Savenko   create proj
4
5
6
       * @var array  $variants
       */
      use common\models\Orders;
8072159c   Alex Savenko   create proj
7
8
9
10
11
      
      $order_data = \Yii::$app->session[ 'order_data' ];
      \Yii::$app->session->remove('order_data');
      $order = $order_data[ 'order' ];
      $variants = $order_data[ 'variants' ];
8467c8d3   Yarik   Google ecommerce
12
13
      
      $this->params[ 'remarketing' ][ 'type' ] = 'conversion';
468bbe6e   Alex Savenko   remarketing
14
15
      if (count($variants) > 1) {
          foreach ($variants as $variant) {
8467c8d3   Yarik   Google ecommerce
16
17
              $this->params[ 'remarketing' ][ 'id' ][] = $variant[ 'mod_id' ];
              $this->params[ 'remarketing' ][ 'price' ][] = $variant[ 'price' ];
468bbe6e   Alex Savenko   remarketing
18
          }
8467c8d3   Yarik   Google ecommerce
19
20
21
      } elseif (!empty( $variants ) && isset( $variants[ 0 ] )) {
          $this->params[ 'remarketing' ][ 'id' ] = $variants[ 0 ][ 'mod_id' ];
          $this->params[ 'remarketing' ][ 'price' ] = $variants[ 0 ][ 'price' ];
468bbe6e   Alex Savenko   remarketing
22
      } else {
8467c8d3   Yarik   Google ecommerce
23
24
          $this->params[ 'remarketing' ][ 'id' ] = '';
          $this->params[ 'remarketing' ][ 'price' ] = '';
468bbe6e   Alex Savenko   remarketing
25
      }
8072159c   Alex Savenko   create proj
26
  ?>
8072159c   Alex Savenko   create proj
27
28
29
30
31
32
33
34
  <div class="block-100">
      <div class="container">
          <div class="col-xs-12">
              <div class="ordering_tbl">
                  <form action="ordering.htm?step4" method="post" name="orderForm" id="orderForm" enctype="multipart/form-data">
                      <div class="orderBox">
                          <table width="725px" border="0" cellspacing="0" cellpadding="5" style="margin:auto;">
                              <tbody>
8467c8d3   Yarik   Google ecommerce
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
                                  <tr valign="middle">
                                      <td height="10" nowrap=""></td>
                                  </tr>
                                  <tr valign="top">
                                      <td>
                                          Заказ успешно осуществлён! Во время обработки вашего заказа менеджер свяжется с Вами.
                                          <br><br>
                                          <div align="center">
                                              <b>Уникальный номер заказа</b>: <?= $order->id; ?>
                                          </div>
                                          <br><br>
                                          <div align="center">
                                              <font size="+1">Спасибо за заказ!!</font><br><br>
                                              <a href="/" style="display:inline">« На главную</a>
                                          </div>
                                          <!-- Google ECommerce Code -->
8dde2442   Yarik   Google ecommerce
51
52
53
54
55
56
57
58
                                          <script>
                                              ga('require', 'ecommerce');
                                              <?php
                                              $sum = 0;
                                              foreach ($variants as $product) {
                                              ?>
                                              ga(
                                                  'ecommerce:addItem', {
453db918   Yarik   Google ecommerce
59
60
61
62
63
                                                      'id': '<?= $order->id ?>',
                                                      'name': '<?= $product['product_name'] ?>',
                                                      'price': '<?= $product['price'] ?>',
                                                      'sku': '<?= $product['sku'] ?>',
                                                      'quantity': '<?= $product['count'] ?>'
8dde2442   Yarik   Google ecommerce
64
65
66
67
68
69
70
71
                                                  }
                                              );
                                              <?php
                                              $sum += $product['sum_cost'];
                                              }
                                              ?>
                                              ga(
                                                  'ecommerce:addTransaction', {
453db918   Yarik   Google ecommerce
72
                                                      'id': '<?= $order->id ?>',
8dde2442   Yarik   Google ecommerce
73
                                                      'affiliation': 'www.linija-svitla.ua',
453db918   Yarik   Google ecommerce
74
                                                      'revenue': '<?= $sum ?>',
8dde2442   Yarik   Google ecommerce
75
76
77
78
                                                  }
                                              );
                                              ga('ecommerce:send');
                                          </script>
8467c8d3   Yarik   Google ecommerce
79
80
                                      </td>
                                  </tr>
8072159c   Alex Savenko   create proj
81
82
83
84
85
86
87
88
89
                              </tbody>
                          </table>
                          <br>
                      </div>
                  </form>
              </div>
          </div>
      </div>
  </div>