success.php
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
use yii\helpers\Url;
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\Breadcrumbs;
use yii\widgets\ActiveForm;
$this->title = 'Корзина';
$this->registerMetaTag(['name' => 'description', 'content' => 'Корзина']);
$this->registerMetaTag(['name' => 'keywords', 'content' => 'Корзина']);
if(isset($variants) && isset($order)){
    $orderData = "
    ga('require', 'ecommerce');
    ga('ecommerce:addTransaction', {
    'id': $order->id,                     //  где ID - транзакции, обязательно
    });";
    foreach($variants as $index=>$row){
        $orderData .= "
    ga('ecommerce:addItem', {
    'id': {$order->id},                     // ID - транзакции, обязательно
    'name': \"{$row['name']}\",    //  Имя товара
    'price': {$row['price']},                 // Цена товара
    'quantity': {$row['count']}                   // Количество
    });";
    }
    $orderData .= "ga('ecommerce:send');";
    $this->registerJs ($orderData, View::POS_END);
}
?>
            <nav class="bread-crumbs">
            <?= Breadcrumbs::widget([
                'links' => [
                            'Корзина'
                            ],
            ]) ?>
                            <div class="both"></div>
            </nav>
<div class="layout">
    
    <h1>Корзина</h1>
Ваш заказ принят! Большое Спасибо! Менеджер с Вами свяжется в ближайшее время.
</div>
