Commit efaa1df4b96e381cfd3f6d98f2635e71c9354e93

Authored by Alex Savenko
1 parent 88f9dbc0

remarketing

frontend/controllers/OrderController.php
@@ -168,12 +168,7 @@ @@ -168,12 +168,7 @@
168 168
169 public function actionSuccess() 169 public function actionSuccess()
170 { 170 {
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 - ]); 171 + return $this->render('success');
177 } 172 }
178 173
179 174
frontend/views/order/success.php
1 <?php 1 <?php
2 /** 2 /**
3 * @var Orders $order 3 * @var Orders $order
4 - * @var ProductVariant[] $models  
5 * @var array $variants 4 * @var array $variants
6 */ 5 */
7 use common\models\Orders; 6 use common\models\Orders;
8 - use common\modules\product\models\ProductVariant;  
9 7
10 $order_data = \Yii::$app->session[ 'order_data' ]; 8 $order_data = \Yii::$app->session[ 'order_data' ];
11 \Yii::$app->session->remove('order_data'); 9 \Yii::$app->session->remove('order_data');
@@ -15,15 +13,15 @@ @@ -15,15 +13,15 @@
15 $this->params['remarketing']['type'] = 'conversion'; 13 $this->params['remarketing']['type'] = 'conversion';
16 $this->params['remarketing']['id'] = ''; 14 $this->params['remarketing']['id'] = '';
17 $this->params['remarketing']['price'] = ''; 15 $this->params['remarketing']['price'] = '';
18 - if (count($models) > 1) {  
19 - foreach ($models as $model) {  
20 - $this->params['remarketing']['id'][] = $model->product_id;  
21 - $this->params['remarketing']['price'][] = $model->price; 16 + if (count($variants) > 1) {
  17 + foreach ($variants as $variant) {
  18 + $this->params['remarketing']['id'][] = $variant->product_id;
  19 + $this->params['remarketing']['price'][] = $variant->price;
22 } 20 }
23 } 21 }
24 else { 22 else {
25 - $this->params['remarketing']['id'] = $models[0]->product_id;  
26 - $this->params['remarketing']['price'] = $models[0]->price; 23 + $this->params['remarketing']['id'] = $variants[0]->product_id;
  24 + $this->params['remarketing']['price'] = $variants[0]->price;
27 } 25 }
28 26
29 27