\Bitrix\Main\Localization\Loc::loadMessages(__FILE__); $count = 0; $extCount = 0; $hndlCount = 0; $con = \Bitrix\Main\Application::getConnection(); $res = \Bitrix\Sale\Location\LocationTable::getList(array( 'runtime' => array(new \Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(1)')), 'select' => array('CNT') )); if($loc = $res->fetch()) $count = $loc['CNT']; $res = $con->query("SELECT COUNT(1) AS CNT FROM b_sale_hdale"); if($loc = $res->fetch()) $hndlCount = $loc['CNT']; $res = \Bitrix\Sale\Location\ExternalTable::getList(array( 'filter' => array('=SERVICE_ID' => \Sale\Handlers\Delivery\Additional\Location::getExternalServiceId()), 'runtime' => array(new \Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(1)')), 'select' => array('CNT') )); if($loc = $res->fetch()) $extCount = $loc['CNT']; ?>