Commit 4ddd0bf8a1129d333347f142bf477c04d8551d46

Authored by Alex Savenko
1 parent 1bcc6065

remarketing

frontend/controllers/OrderController.php
... ... @@ -168,7 +168,12 @@
168 168  
169 169 public function actionSuccess()
170 170 {
171   - return $this->render('success');
  171 + $basket = \Yii::$app->basket;
  172 + $data = $basket->getData();
  173 + $models = $basket->findModels(array_keys($data));
  174 + return $this->render('success', [
  175 + 'models' => $models
  176 + ]);
172 177 }
173 178  
174 179  
... ...
frontend/views/order/success.php
... ... @@ -10,19 +10,18 @@
10 10 $order = $order_data[ 'order' ];
11 11 $variants = $order_data[ 'variants' ];
12 12  
13   - $products = $order->getBasketMods();
14 13 $this->params['remarketing']['type'] = 'conversion';
15 14 $this->params['remarketing']['id'] = '';
16 15 $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;
  16 + if (count($models) > 1) {
  17 + foreach ($models as $model) {
  18 + $this->params['remarketing']['id'][] = $model->product_id;
  19 + $this->params['remarketing']['price'][] = $model->price;
21 20 }
22 21 }
23 22 else {
24   - $this->params['remarketing']['id'] = $products[0]->product_id;
25   - $this->params['remarketing']['price'] = $products[0]->price;
  23 + $this->params['remarketing']['id'] = $models[0]->product_id;
  24 + $this->params['remarketing']['price'] = $models[0]->price;
26 25 }
27 26  
28 27  
... ...