本文整理匯總了PHP中Bitrix\Sale\Location\LocationTable::getDeepestCommonParent方法的典型用法代碼示例。如果您正苦於以下問題:PHP LocationTable::getDeepestCommonParent方法的具體用法?PHP LocationTable::getDeepestCommonParent怎麽用?PHP LocationTable::getDeepestCommonParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bitrix\Sale\Location\LocationTable
的用法示例。
在下文中一共展示了LocationTable::getDeepestCommonParent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: obtainDataTreeTrunk
protected function obtainDataTreeTrunk(&$cachedData)
{
// check for static tree
$forkItemFilter = false;
$res = Location\LocationTable::getList(array(
'group' => array('DEPTH_LEVEL'),
'select' => array('DEPTH_LEVEL', 'CNT'),
'order' => array('DEPTH_LEVEL' => 'asc')
));
$forkAtLevel = 0;
while($item = $res->fetch())
{
if($item['CNT'] < 2)
$forkAtLevel = $item['DEPTH_LEVEL'];
else
break;
}
if($forkAtLevel > 0)
$forkItemFilter = array('DEPTH_LEVEL' => $forkAtLevel);
// check for tree filtered by site
if($this->filterBySite && is_array($cachedData['TEMP']['CONNECTORS']) && !empty($cachedData['TEMP']['CONNECTORS']))
{
$dcp = Location\LocationTable::getDeepestCommonParent($cachedData['TEMP']['CONNECTORS'], array('select' => array('ID')))->fetch();
if(is_array($dcp) && intval($dcp['ID']))
$forkItemFilter = array('ID' => intval($dcp['ID']));
}
$cachedData['TREE_TRUNK'] = array();
if(is_array($forkItemFilter) && !empty($forkItemFilter)) // get fork item id
{
$res = Location\LocationTable::getPathToNodeByCondition($forkItemFilter, array(
'select' => array_merge($this->getNodeSelectFields(), array('LNAME' => 'NAME.NAME')),
'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)
));
$res->addReplacedAliases(array('LNAME' => 'NAME'));
while($item = $res->fetch())
{
$cachedData['TREE_TRUNK'][] = $item;
}
}
}