Commit 774b8ecd57d34f5912dfa6db7a54fc7a24026ad0

Authored by Administrator
2 parents 66169da6 a1efda19

Merge branch 'event_fix' into 'master'

Event fix

See merge request !10
src/app/frontend/controllers/DealerController.php
@@ -674,13 +674,13 @@ class DealerController extends \controllers\ControllerBase @@ -674,13 +674,13 @@ class DealerController extends \controllers\ControllerBase
674 } 674 }
675 675
676 $this->view->setVar('orders', $orders); 676 $this->view->setVar('orders', $orders);
  677 + $this->view->setVar('type', 'shipment_history');
677 } 678 }
678 679
679 $this->view->pick('dealer/onlineOrderHistory'); 680 $this->view->pick('dealer/onlineOrderHistory');
680 } 681 }
681 682
682 public function onlineOrderHistoryAction() { 683 public function onlineOrderHistoryAction() {
683 -  
684 if($this->session->has('id')) { 684 if($this->session->has('id')) {
685 $customer = $this->models->getCustomers()->getOneData($this->session->get('id'))['0']; 685 $customer = $this->models->getCustomers()->getOneData($this->session->get('id'))['0'];
686 $this->view->setVar('customer', $customer); 686 $this->view->setVar('customer', $customer);
@@ -700,18 +700,19 @@ class DealerController extends \controllers\ControllerBase @@ -700,18 +700,19 @@ class DealerController extends \controllers\ControllerBase
700 } 700 }
701 701
702 $this->view->setVar('orders', $orders); 702 $this->view->setVar('orders', $orders);
  703 + $this->view->setVar('type', 'online_order_history');
703 } 704 }
704 705
705 $this->view->pick('dealer/onlineOrderHistory'); 706 $this->view->pick('dealer/onlineOrderHistory');
706 } 707 }
707 708
708 - public function singleOrderAction($order_id) {  
709 - $this->getOrder($order_id); 709 + public function singleOrderAction($order_id,$type) {
  710 + $this->getOrder($order_id,$type);
710 } 711 }
711 712
712 - public function printOrderAction($order_id) { 713 + public function printOrderAction($order_id,$type) {
713 $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); 714 $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
714 - $this->getOrder($order_id); 715 + $this->getOrder($order_id,$type);
715 } 716 }
716 717
717 public function wholesalePricesAction() { 718 public function wholesalePricesAction() {
@@ -1649,8 +1650,13 @@ class DealerController extends \controllers\ControllerBase @@ -1649,8 +1650,13 @@ class DealerController extends \controllers\ControllerBase
1649 $this->view->setVar('sum_paid', $sum_paid); 1650 $this->view->setVar('sum_paid', $sum_paid);
1650 } 1651 }
1651 1652
1652 - private function getOrder( $order_id ) {  
1653 - $items = $this->models->getOrders()->getOrdersByOrderId( $order_id, $this->lang_id ); 1653 + private function getOrder( $order_id, $type ) {
  1654 + if($type == 'online_order_history'){
  1655 +
  1656 + $items = $this->models->getOrders1C()->getOrdersByOrderId( $order_id, $this->lang_id );
  1657 + } else if($type == 'shipment_history'){
  1658 + $items = $this->models->getShipments()->getOrdersByOrderId( $order_id, $this->lang_id );
  1659 + }
1654 1660
1655 $order['groups'] = $this->getGroups($items); 1661 $order['groups'] = $this->getGroups($items);
1656 $order['total_price'] = 0; 1662 $order['total_price'] = 0;
@@ -1668,7 +1674,9 @@ class DealerController extends \controllers\ControllerBase @@ -1668,7 +1674,9 @@ class DealerController extends \controllers\ControllerBase
1668 1674
1669 private function getGroups($items) { 1675 private function getGroups($items) {
1670 $groups = []; 1676 $groups = [];
  1677 +
1671 foreach($items as $i) { 1678 foreach($items as $i) {
  1679 +
1672 $title = $this->models->getItems()->getTitleByAlias($this->lang_id, $i['subtype_alias'])[0]; 1680 $title = $this->models->getItems()->getTitleByAlias($this->lang_id, $i['subtype_alias'])[0];
1673 $hasMatch = false; 1681 $hasMatch = false;
1674 foreach($groups as $k => $g) { 1682 foreach($groups as $k => $g) {
src/app/frontend/views/dealer/onlineOrderHistory.php
@@ -13,14 +13,14 @@ @@ -13,14 +13,14 @@
13 </tr> 13 </tr>
14 <?php foreach($orders as $o): ?> 14 <?php foreach($orders as $o): ?>
15 <tr> 15 <tr>
16 - <td><a href="<?= $this->seoUrl->setUrl($this->router->getRewriteUri().'/'.$o['id']) ?>"><?= $t->_('orders') ?> №<?= $o['id'] ?></a></td> 16 + <td><a href="<?= $this->seoUrl->setUrl($this->router->getRewriteUri().'/'.$o['id'].'/'.$type) ?>"><?= $t->_('orders') ?> №<?= $o['id'] ?></a></td>
17 <td id="greytd" align="center"> 17 <td id="greytd" align="center">
18 <li class="order_status <?= $o['status'][1] ?>"><?= $o['status'][0] ?></li> 18 <li class="order_status <?= $o['status'][1] ?>"><?= $o['status'][0] ?></li>
19 </td> 19 </td>
20 <td align="center" id="right_border"><?= $o['created_date'] ?></td> 20 <td align="center" id="right_border"><?= $o['created_date'] ?></td>
21 <td align="center" class="status_price"><span id="price_sum"><?= $o['price'] ?></span> грн.</td> 21 <td align="center" class="status_price"><span id="price_sum"><?= $o['price'] ?></span> грн.</td>
22 <td id="greytd" align="center"> 22 <td id="greytd" align="center">
23 - <iframe style="border: 0" width="20px" height="20px" src="<?= $this->seoUrl->setUrl($this->url->get([ 'for' => 'print_order' ]).$o['id']) ?>"></iframe> 23 + <iframe style="border: 0" width="20px" height="20px" src="<?= $this->seoUrl->setUrl($this->url->get([ 'for' => 'print_order' ]).$o['id'].'/'.$type) ?>"></iframe>
24 </td> 24 </td>
25 </tr> 25 </tr>
26 <?php endforeach; ?> 26 <?php endforeach; ?>
src/lib/models/orders.php
@@ -374,31 +374,20 @@ class orders extends \db @@ -374,31 +374,20 @@ class orders extends \db
374 lang_id = :lang_id 374 lang_id = :lang_id
375 LIMIT 1 375 LIMIT 1
376 ) AS type_alias, 376 ) AS type_alias,
377 - ( 377 + (
378 SELECT 378 SELECT
379 alias 379 alias
380 FROM 380 FROM
381 - public.subtypes_i18n 381 + public.catalog_i18n
382 WHERE 382 WHERE
383 - subtype = 383 + catalog =
384 ( 384 (
385 SELECT 385 SELECT
386 - subtype 386 + catalog
387 FROM 387 FROM
388 public.items 388 public.items
389 WHERE 389 WHERE
390 - id = public.orders2items.item_id  
391 - LIMIT 1  
392 - )  
393 - AND  
394 - type =  
395 - (  
396 - SELECT  
397 - type  
398 - FROM  
399 - public.items  
400 - WHERE  
401 - id = public.orders2items.item_id 390 + id = public.orders2items_1c.item_id
402 LIMIT 1 391 LIMIT 1
403 ) 392 )
404 AND 393 AND
src/lib/models/orders_1c.php
@@ -378,23 +378,12 @@ class orders_1c extends \db @@ -378,23 +378,12 @@ class orders_1c extends \db
378 SELECT 378 SELECT
379 alias 379 alias
380 FROM 380 FROM
381 - public.subtypes_i18n 381 + public.catalog_i18n
382 WHERE 382 WHERE
383 - subtype = 383 + catalog =
384 ( 384 (
385 SELECT 385 SELECT
386 - subtype  
387 - FROM  
388 - public.items  
389 - WHERE  
390 - id = public.orders2items_1c.item_id  
391 - LIMIT 1  
392 - )  
393 - AND  
394 - type =  
395 - (  
396 - SELECT  
397 - type 386 + catalog
398 FROM 387 FROM
399 public.items 388 public.items
400 WHERE 389 WHERE
src/lib/models/shipments.php
@@ -378,23 +378,12 @@ class shipments extends \db @@ -378,23 +378,12 @@ class shipments extends \db
378 SELECT 378 SELECT
379 alias 379 alias
380 FROM 380 FROM
381 - public.subtypes_i18n 381 + public.catalog_i18n
382 WHERE 382 WHERE
383 - subtype = 383 + catalog =
384 ( 384 (
385 SELECT 385 SELECT
386 - subtype  
387 - FROM  
388 - public.items  
389 - WHERE  
390 - id = public.shipments2items.item_id  
391 - LIMIT 1  
392 - )  
393 - AND  
394 - type =  
395 - (  
396 - SELECT  
397 - type 386 + catalog
398 FROM 387 FROM
399 public.items 388 public.items
400 WHERE 389 WHERE
@@ -1386,7 +1386,7 @@ try @@ -1386,7 +1386,7 @@ try
1386 1386
1387 $router->add 1387 $router->add
1388 ( 1388 (
1389 - '/dealer/online_order_history/{order:[0-9]+}{language:([/][a-z]{2})?}', 1389 + '/dealer/online_order_history/{order:[0-9]+}/{type}{language:([/][a-z]{2})?}',
1390 [ 1390 [
1391 'controller' => 'dealer', 1391 'controller' => 'dealer',
1392 'action' => 'singleOrder' 1392 'action' => 'singleOrder'
@@ -1396,7 +1396,7 @@ try @@ -1396,7 +1396,7 @@ try
1396 1396
1397 $router->add 1397 $router->add
1398 ( 1398 (
1399 - '/dealer/print_order/{order:[0-9]+}{language:([/][a-z]{2})?}', 1399 + '/dealer/print_order/{order:[0-9]+}/{type}{language:([/][a-z]{2})?}',
1400 [ 1400 [
1401 'controller' => 'dealer', 1401 'controller' => 'dealer',
1402 'action' => 'printOrder' 1402 'action' => 'printOrder'
@@ -1415,7 +1415,7 @@ try @@ -1415,7 +1415,7 @@ try
1415 ->setName('shipment_history'); 1415 ->setName('shipment_history');
1416 $router->add 1416 $router->add
1417 ( 1417 (
1418 - '/dealer/shipment_history/{order:[0-9]+}{language:([/][a-z]{2})?}', 1418 + '/dealer/shipment_history/{order:[0-9]+}/{type}{language:([/][a-z]{2})?}',
1419 [ 1419 [
1420 'controller' => 'dealer', 1420 'controller' => 'dealer',
1421 'action' => 'singleOrder' 1421 'action' => 'singleOrder'