本文整理汇总了PHP中CSaleUserAccount::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleUserAccount::getList方法的具体用法?PHP CSaleUserAccount::getList怎么用?PHP CSaleUserAccount::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleUserAccount
的用法示例。
在下文中一共展示了CSaleUserAccount::getList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareData
public static function prepareData(Order $order)
{
$currencyBudget = 0;
if ($order->getUserId() > 0) {
$res = \CSaleUserAccount::getList(array(), array('USER_ID' => $order->getUserId(), 'CURRENCY' => $order->getCurrency(), 'LOCKED' => 'N'), false, false, array('CURRENT_BUDGET'));
$userAccount = $res->Fetch();
$currencyBudget = $userAccount['CURRENT_BUDGET'];
}
$payable = $order->getPrice() - $order->getSumPaid();
$price = $order->getPrice();
$sumPaid = $order->getSumPaid();
$data = array('PRICE' => $price ? $price : 0, 'SUM_PAID' => $sumPaid ? $sumPaid : 0, 'PAYABLE' => $payable >= 0 ? $payable : 0, 'CURRENCY' => $order->getCurrency(), 'BUYER_BUDGET' => $currencyBudget, 'STATUS_ID' => $order->getField('STATUS_ID'));
return $data;
}
示例2: getPaySystemList
/**
* @param null $order
* @return array
*/
public static function getPaySystemList($order = null)
{
$result = array();
$result[] = array('ID' => '0', 'NAME' => Loc::getMessage('SALE_ORDER_PAYMENT_NO_PAYSYSTEM'));
if ($order) {
self::$order = $order;
} else {
if (!self::$order) {
return $result;
}
}
$res = \CSaleUserAccount::getList(array(), array('USER_ID' => self::$order->getUserId(), 'CURRENCY' => self::$order->getCurrency(), 'LOCKED' => 'N'), false, false, array('CURRENT_BUDGET'));
$userAccount = $res->Fetch();
$dbRes = PaySystemServiceTable::getListWithInner(array('select' => array('ID', 'NAME'), 'filter' => array('=ACTION.PERSON_TYPE_ID' => self::$order->getPersonTypeId(), '=ACTION.HAVE_PAYMENT' => 'Y', '=ACTIVE' => 'Y'), 'order' => array('SORT' => 'ASC')));
while ($paySystem = $dbRes->fetch()) {
if ($userAccount['CURRENT_BUDGET'] <= 0 && $paySystem["ID"] == PaySystemInner::getId()) {
continue;
}
$result[] = array('ID' => $paySystem['ID'], 'NAME' => $paySystem["NAME"] . " [" . $paySystem["ID"] . "]");
}
return $result;
}
示例3: getDemandedFields
protected function getDemandedFields(array $demandedFields, array $incomingFields, \Bitrix\Sale\Order $order = null)
{
$result = array();
$userId = isset($incomingFields["USER_ID"]) && intval($incomingFields["USER_ID"]) > 0 ? intval($incomingFields["USER_ID"]) : 0;
$currency = isset($incomingFields["CURRENCY"]) ? trim($incomingFields["CURRENCY"]) : "";
$personTypeId = isset($incomingFields['PERSON_TYPE_ID']) ? intval($incomingFields['PERSON_TYPE_ID']) : 0;
$orderId = isset($incomingFields["ID"]) ? intval($incomingFields["ID"]) : 0;
if ($order === null && intval($orderId) > 0) {
$order = \Bitrix\Sale\Order::load($orderId);
}
foreach ($demandedFields as $demandedField) {
switch ($demandedField) {
case "BUYER_USER_NAME":
$result["BUYER_USER_NAME"] = intval($userId) > 0 ? \Bitrix\Sale\Helpers\Admin\OrderEdit::getUserName(intval($userId)) : "";
break;
case "PROPERTIES":
$profileId = isset($incomingFields["BUYER_PROFILE_ID"]) ? intval($incomingFields["BUYER_PROFILE_ID"]) : 0;
$result["PROPERTIES"] = \Bitrix\Sale\Helpers\Admin\Blocks\OrderBuyer::getProfileParams($userId, $profileId);
break;
case "BUYER_PROFILES_LIST":
if (intval($personTypeId) <= 0) {
throw new \Bitrix\Main\ArgumentNullException("personTypeId");
}
$result["BUYER_PROFILES_LIST"] = \Bitrix\Sale\Helpers\Admin\Blocks\OrderBuyer::getBuyerProfilesList($userId, $personTypeId);
break;
case "BUYER_PROFILES_DATA":
$result["BUYER_PROFILES_DATA"] = \Bitrix\Sale\Helpers\Admin\Blocks\OrderBuyer::getUserProfiles($userId);
break;
case "BUYER_BUDGET":
$res = \CSaleUserAccount::getList(array(), array('USER_ID' => $userId, 'CURRENCY' => $currency, 'LOCKED' => 'N'), false, false, array('CURRENT_BUDGET'));
if ($userAccount = $res->Fetch()) {
$result["BUYER_BUDGET"] = $userAccount['CURRENT_BUDGET'];
} else {
$result["BUYER_BUDGET"] = 0;
}
break;
case "PROPERTIES_ARRAY":
if (!$order) {
throw new \Bitrix\Main\SystemException("Can't init order");
}
if (intval($personTypeId) <= 0) {
throw new \Bitrix\Main\ArgumentNullException("personTypeId");
}
$order->setPersonTypeId($personTypeId);
$result["PROPERTIES_ARRAY"] = $order->getPropertyCollection()->getArray();
break;
case "PRODUCT":
$result["PRODUCT"] = array();
break;
case "COUPONS":
if (!$userId) {
throw new \Bitrix\Main\ArgumentNullException("userId");
}
$result["COUPONS"] = Admin\OrderEdit::getCouponsData();
break;
case "COUPONS_LIST":
$result["COUPONS_LIST"] = Admin\OrderEdit::getCouponList($order);
break;
default:
throw new \Bitrix\Main\SystemException("Field: \"" . $demandedField . "\" is unknown!");
}
}
return $result;
}