BxBasePaymentsServices.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * System services related to Payments.
  11. */
  12. class BxBasePaymentsServices extends BxDol
  13. {
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. }
  18. public function serviceGetPayments()
  19. {
  20. return BxDolPayments::getInstance()->getPayments();
  21. }
  22. public function serviceGetCartItemsCount()
  23. {
  24. return BxDolPayments::getInstance()->getCartItemsCount();
  25. }
  26. public function serviceGetOrdersCount($sType)
  27. {
  28. return BxDolPayments::getInstance()->getOrdersCount($sType);
  29. }
  30. public function serviceGetLiveUpdatesCart($aMenuItemParent, $aMenuItemChild, $iCount = 0)
  31. {
  32. $iCountNew = BxDolPayments::getInstance()->getCartItemsCount();
  33. if($iCountNew == $iCount)
  34. return false;
  35. return array(
  36. 'count' => $iCountNew, // required
  37. 'method' => 'bx_menu_show_live_update(oData)', // required
  38. 'data' => array(
  39. 'code' => BxDolTemplate::getInstance()->parseHtmlByTemplateName('menu_item_addon', array(
  40. 'content' => '{count}'
  41. )),
  42. 'mi_parent' => $aMenuItemParent,
  43. 'mi_child' => $aMenuItemChild
  44. ), // optional, may have some additional data to be passed in JS method provided using 'method' param above.
  45. );
  46. }
  47. public function serviceGetLiveUpdatesOrders($aMenuItemParent, $aMenuItemChild, $iCount = 0)
  48. {
  49. $iCountNew = BxDolPayments::getInstance()->getOrdersCount('new');
  50. if($iCountNew == $iCount)
  51. return false;
  52. return array(
  53. 'count' => $iCountNew, // required
  54. 'method' => 'bx_menu_show_live_update(oData)', // required
  55. 'data' => array(
  56. 'code' => BxDolTemplate::getInstance()->parseHtmlByTemplateName('menu_item_addon', array(
  57. 'content' => '{count}'
  58. )),
  59. 'mi_parent' => $aMenuItemParent,
  60. 'mi_child' => $aMenuItemChild
  61. ), // optional, may have some additional data to be passed in JS method provided using 'method' param above.
  62. );
  63. }
  64. }
  65. /** @} */