本文整理汇总了PHP中Bitrix\Sale\Location\LocationTable::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP LocationTable::getById方法的具体用法?PHP LocationTable::getById怎么用?PHP LocationTable::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Location\LocationTable
的用法示例。
在下文中一共展示了LocationTable::getById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckLocationExists
public static function CheckLocationExists($locID)
{
if (intval($locID) <= 0) {
return false;
}
$res = Location\LocationTable::getById($locID)->fetch();
return !!$res['ID'];
}
示例2: checkLocationIdExists
public static function checkLocationIdExists($id)
{
$res = Location\LocationTable::getById($id)->fetch();
return intval($res['ID']);
}
示例3: checkConnectionExists
public static function checkConnectionExists($entityPrimary, $locationPrimary)
{
$entityPrimary = Assert::expectStringNotNull($entityPrimary, Loc::getMessage('SALE_LOCATION_CONNECTOR_ENTITY_PRIMARY_FLD_NAME'));
$locationPrimary = Assert::expectIntegerPositive($locationPrimary, Loc::getMessage('SALE_LOCATION_CONNECTOR_ENTITY_LOCATION_PRIMARY_FLD_NAME'));
if (!static::checkLinkUsageAny($entityPrimary)) {
// if there are no links at all, connection virtually exists
return true;
}
// todo: here we can rewrite this to make it to do just one query
$node = LocationTable::getById($locationPrimary)->fetch();
$result = static::getLinkStatusForMultipleNodes(array($node), $entityPrimary);
return $result[$locationPrimary] == self::LSTAT_IS_CONNECTOR || $result[$locationPrimary] == self::LSTAT_BELOW_CONNECTOR;
}
示例4: getTarifNumFromCsv
public static function getTarifNumFromCsv(array $arShopLocation)
{
if (empty($arShopLocation) || !isset($arShopLocation["REGION_ID"]) || !isset($arShopLocation['REGION_NAME_LANG'])) {
return false;
}
$regionCodeFromCode = $regionCodeFromName = "";
$dbRes = \Bitrix\Sale\Location\LocationTable::getById($arShopLocation["REGION_ID"]);
if ($locReg = $dbRes->fetch()) {
$regionCodeFromCode = $locReg["CODE"];
}
$regionCodeFromName = self::getRegionCodeByOldName($arShopLocation['REGION_NAME_LANG']);
$csvFile = CSaleHelper::getCsvObject(DELIVERY_RP_CSV_PATH . '/tarif_regions.csv');
$tarifNumber = false;
$COL_TARIF_NUM = 0;
while ($arRes = $csvFile->Fetch()) {
if (strlen($regionCodeFromCode) > 0 && in_array($regionCodeFromCode, $arRes) || strlen($regionCodeFromName) > 0 && in_array($regionCodeFromName, $arRes)) {
$tarifNumber = $arRes[$COL_TARIF_NUM];
break;
}
}
return $tarifNumber;
}
示例5: performAction
/**
* Function makes some actions based on what is in $this->request
* @return void
*/
protected function performAction()
{
$requestMethod = \Bitrix\Main\Context::getCurrent()->getServer()->getRequestMethod();
$this->componentData['FORM_ROWS'] = Helper::getDetailPageRows();
$this->dbResult['CALCULATED_BACK_URL'] = false;
if (strlen($this->dbResult['REQUEST']['GET']['return_url'])) {
$this->dbResult['SPECIFIED_BACK_URL'] = $this->dbResult['REQUEST']['GET']['return_url'];
$this->dbResult['CALCULATED_BACK_URL'] = $this->dbResult['REQUEST']['GET']['return_url'];
}
if (check_bitrix_sessid()) {
$actionSave = $requestMethod == 'POST' && isset($this->dbResult['REQUEST']['POST']['save']);
$actionApply = $requestMethod == 'POST' && isset($this->dbResult['REQUEST']['POST']['apply']);
$actionDelete = $requestMethod == 'GET' && isset($this->dbResult['REQUEST']['GET']['delete']);
$id = isset($this->dbResult['REQUEST']['POST']['loc_id']) ? intval($this->dbResult['REQUEST']['POST']['loc_id']) : 0;
if ($id <= 0 && isset($this->dbResult['REQUEST']['POST']['ID'])) {
$id = intval($this->dbResult['REQUEST']['POST']['ID']) > 0 ? intval($this->dbResult['REQUEST']['POST']['ID']) : 0;
}
$res = false;
if ($actionSave || $actionApply) {
if ($id) {
$res = Helper::update($id, $this->dbResult['REQUEST']['POST']);
} else {
$res = Helper::add($this->dbResult['REQUEST']['POST']);
$id = $res['id'];
}
} elseif ($actionDelete) {
$locID = isset($this->arParams['LOC_ID']) ? intval($this->arParams['LOC_ID']) : 0;
if ($locID) {
$res = Location\LocationTable::getById($locID)->fetch();
$parentOfDeleted = intval($res['PARENT_ID']);
$res = Helper::delete($locID);
}
}
if ($res !== false) {
if (!$res['success']) {
$this->errors['NONFATAL'] = array_merge($this->errors['NONFATAL'], $res['errors']);
$this->componentData['ACTION_FAILURE'] = true;
} else {
$url = $this->dbResult['CALCULATED_BACK_URL'];
if ($actionApply) {
$url = false;
} else {
if ($actionSave) {
// get parent (only for locations)
$res = Location\LocationTable::getById($id)->fetch();
if (!$url) {
$url = CComponentEngine::MakePathFromTemplate($this->arParams['PATH_TO_LOCATIONS_LIST']) . '?PARENT_ID=' . intval($res['PARENT_ID']);
}
} elseif ($actionDelete) {
if (!$url) {
$url = CComponentEngine::MakePathFromTemplate($this->arParams['PATH_TO_LOCATIONS_LIST']) . '?PARENT_ID=' . intval($parentOfDeleted);
}
}
}
if ($url) {
LocalRedirect($url);
}
}
}
}
}