Commit 774b8ecd57d34f5912dfa6db7a54fc7a24026ad0
Merge branch 'event_fix' into 'master'
Event fix See merge request !10
Showing
6 changed files
with
31 additions
and
56 deletions
Show diff stats
src/app/frontend/controllers/DealerController.php
... | ... | @@ -674,13 +674,13 @@ class DealerController extends \controllers\ControllerBase |
674 | 674 | } |
675 | 675 | |
676 | 676 | $this->view->setVar('orders', $orders); |
677 | + $this->view->setVar('type', 'shipment_history'); | |
677 | 678 | } |
678 | 679 | |
679 | 680 | $this->view->pick('dealer/onlineOrderHistory'); |
680 | 681 | } |
681 | 682 | |
682 | 683 | public function onlineOrderHistoryAction() { |
683 | - | |
684 | 684 | if($this->session->has('id')) { |
685 | 685 | $customer = $this->models->getCustomers()->getOneData($this->session->get('id'))['0']; |
686 | 686 | $this->view->setVar('customer', $customer); |
... | ... | @@ -700,18 +700,19 @@ class DealerController extends \controllers\ControllerBase |
700 | 700 | } |
701 | 701 | |
702 | 702 | $this->view->setVar('orders', $orders); |
703 | + $this->view->setVar('type', 'online_order_history'); | |
703 | 704 | } |
704 | 705 | |
705 | 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 | 714 | $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
714 | - $this->getOrder($order_id); | |
715 | + $this->getOrder($order_id,$type); | |
715 | 716 | } |
716 | 717 | |
717 | 718 | public function wholesalePricesAction() { |
... | ... | @@ -1649,8 +1650,13 @@ class DealerController extends \controllers\ControllerBase |
1649 | 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 | 1661 | $order['groups'] = $this->getGroups($items); |
1656 | 1662 | $order['total_price'] = 0; |
... | ... | @@ -1668,7 +1674,9 @@ class DealerController extends \controllers\ControllerBase |
1668 | 1674 | |
1669 | 1675 | private function getGroups($items) { |
1670 | 1676 | $groups = []; |
1677 | + | |
1671 | 1678 | foreach($items as $i) { |
1679 | + | |
1672 | 1680 | $title = $this->models->getItems()->getTitleByAlias($this->lang_id, $i['subtype_alias'])[0]; |
1673 | 1681 | $hasMatch = false; |
1674 | 1682 | foreach($groups as $k => $g) { | ... | ... |
src/app/frontend/views/dealer/onlineOrderHistory.php
... | ... | @@ -13,14 +13,14 @@ |
13 | 13 | </tr> |
14 | 14 | <?php foreach($orders as $o): ?> |
15 | 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 | 17 | <td id="greytd" align="center"> |
18 | 18 | <li class="order_status <?= $o['status'][1] ?>"><?= $o['status'][0] ?></li> |
19 | 19 | </td> |
20 | 20 | <td align="center" id="right_border"><?= $o['created_date'] ?></td> |
21 | 21 | <td align="center" class="status_price"><span id="price_sum"><?= $o['price'] ?></span> ะณัะฝ.</td> |
22 | 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 | 24 | </td> |
25 | 25 | </tr> |
26 | 26 | <?php endforeach; ?> | ... | ... |
src/lib/models/orders.php
... | ... | @@ -374,31 +374,20 @@ class orders extends \db |
374 | 374 | lang_id = :lang_id |
375 | 375 | LIMIT 1 |
376 | 376 | ) AS type_alias, |
377 | - ( | |
377 | + ( | |
378 | 378 | SELECT |
379 | 379 | alias |
380 | 380 | FROM |
381 | - public.subtypes_i18n | |
381 | + public.catalog_i18n | |
382 | 382 | WHERE |
383 | - subtype = | |
383 | + catalog = | |
384 | 384 | ( |
385 | 385 | SELECT |
386 | - subtype | |
386 | + catalog | |
387 | 387 | FROM |
388 | 388 | public.items |
389 | 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 | 391 | LIMIT 1 |
403 | 392 | ) |
404 | 393 | AND | ... | ... |
src/lib/models/orders_1c.php
... | ... | @@ -378,23 +378,12 @@ class orders_1c extends \db |
378 | 378 | SELECT |
379 | 379 | alias |
380 | 380 | FROM |
381 | - public.subtypes_i18n | |
381 | + public.catalog_i18n | |
382 | 382 | WHERE |
383 | - subtype = | |
383 | + catalog = | |
384 | 384 | ( |
385 | 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 | 387 | FROM |
399 | 388 | public.items |
400 | 389 | WHERE | ... | ... |
src/lib/models/shipments.php
... | ... | @@ -378,23 +378,12 @@ class shipments extends \db |
378 | 378 | SELECT |
379 | 379 | alias |
380 | 380 | FROM |
381 | - public.subtypes_i18n | |
381 | + public.catalog_i18n | |
382 | 382 | WHERE |
383 | - subtype = | |
383 | + catalog = | |
384 | 384 | ( |
385 | 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 | 387 | FROM |
399 | 388 | public.items |
400 | 389 | WHERE | ... | ... |
www/index.php
... | ... | @@ -1386,7 +1386,7 @@ try |
1386 | 1386 | |
1387 | 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 | 1391 | 'controller' => 'dealer', |
1392 | 1392 | 'action' => 'singleOrder' |
... | ... | @@ -1396,7 +1396,7 @@ try |
1396 | 1396 | |
1397 | 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 | 1401 | 'controller' => 'dealer', |
1402 | 1402 | 'action' => 'printOrder' |
... | ... | @@ -1415,7 +1415,7 @@ try |
1415 | 1415 | ->setName('shipment_history'); |
1416 | 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 | 1420 | 'controller' => 'dealer', |
1421 | 1421 | 'action' => 'singleOrder' | ... | ... |