BxBaseModPaymentOrders.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 BasePayment Base classes for Payment like modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModPaymentOrders extends BxDol
  12. {
  13. protected $MODULE;
  14. protected $_oModule;
  15. function __construct()
  16. {
  17. parent::__construct();
  18. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  19. }
  20. public function serviceGetOrdersUrl()
  21. {
  22. if(!$this->_oModule->isLogged())
  23. return '';
  24. return $this->_oModule->_oConfig->getUrl('URL_ORDERS');
  25. }
  26. public function serviceGetOrdersCount($sType, $iProfileId = 0)
  27. {
  28. if(!in_array($sType, array('new')))
  29. return 0;
  30. $iProfileId = !empty($iProfileId) ? $iProfileId : $this->_oModule->getProfileId();
  31. if(empty($iProfileId))
  32. return 0;
  33. $aOrders = $this->_oModule->_oDb->getOrderProcessed(array('type' => $sType, 'seller_id' => $iProfileId));
  34. if(empty($aOrders) || !is_array($aOrders))
  35. return 0;
  36. return count($aOrders);
  37. }
  38. }
  39. /** @} */