本文整理汇总了PHP中Bitrix\Sale\Order::getUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getUserId方法的具体用法?PHP Order::getUserId怎么用?PHP Order::getUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Order
的用法示例。
在下文中一共展示了Order::getUserId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getOrderFields
/**
* @param Sale\Order $order
*
* @return array
*/
public static function getOrderFields(Sale\Order $order)
{
$result = new Sale\Result();
$paymentSystemId = false;
$deliveryId = false;
/** @var Sale\PaymentCollection $paymentCollection */
if ($paymentCollection = $order->getPaymentCollection()) {
/** @var Sale\Payment $payment */
if ($payment = $paymentCollection->rewind()) {
$paymentSystemId = $payment->getPaymentSystemId();
}
}
/** @var Sale\ShipmentCollection $shipe */
if ($shipmentCollection = $order->getShipmentCollection()) {
/** @var Sale\Shipment $shipment */
foreach ($shipmentCollection as $shipment) {
if ($shipment->getDeliveryId() > 0) {
$deliveryId = $shipment->getDeliveryId();
break;
}
}
}
$fields = array("SITE_ID" => $order->getSiteId(), "LID" => $order->getSiteId(), "PERSON_TYPE_ID" => $order->getPersonTypeId(), "PRICE" => $order->getPrice(), "CURRENCY" => $order->getCurrency(), "USER_ID" => $order->getUserId(), "PAY_SYSTEM_ID" => $paymentSystemId, "PRICE_DELIVERY" => $order->getDeliveryPrice(), "DELIVERY_ID" => $deliveryId, "DISCOUNT_VALUE" => $order->getDiscountPrice(), "TAX_VALUE" => $order->getTaxValue(), "TRACKING_NUMBER" => $order->getField('TRACKING_NUMBER'), "PAYED" => $order->getField('PAYED'), "CANCELED" => $order->getField('CANCELED'), "STATUS_ID" => $order->getField('STATUS_ID'), "RESERVED" => $order->getField('RESERVED'));
$orderFields = static::convertOrderToArray($order);
if (is_array($orderFields)) {
$orderFields = $fields + $orderFields;
$orderFields = static::convertDateFieldsToOldFormat($orderFields);
}
$result->setData(array('FIELDS' => $fields, 'ORDER_FIELDS' => $orderFields));
return $result;
}
示例3: prepareData
/**
* @param array $discounts
* @return array|null
* @throws Main\LoaderException
*/
public function prepareData(array $inParams = array())
{
if ($this->data === null) {
$result = array("ITEMS" => array(), "WEIGHT" => 0);
$basket = $this->order->getBasket();
if (empty($inParams["DISCOUNTS"])) {
$inParams["DISCOUNTS"] = OrderEdit::getDiscountsApplyResult($this->order, true);
}
$basketDiscount = 0;
$basketPrice = 0;
$basketPriceBase = 0;
if (!$basket) {
$result["WEIGHT_FOR_HUMAN"] = roundEx(floatval(0), SALE_WEIGHT_PRECISION);
$this->data = $result;
return $result;
}
$result["WEIGHT"] = $basket->getWeight();
$result["WEIGHT_FOR_HUMAN"] = roundEx(floatval($result["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION);
$items = $basket->getBasketItems();
/** @var \Bitrix\Sale\BasketItem $item */
if (self::$catalogIncluded === null) {
self::$catalogIncluded = Main\Loader::includeModule('catalog');
}
foreach ($items as $item) {
$productId = $item->getProductId();
$params = array();
if ($item->getField("MODULE") == "catalog") {
$params = static::getProductDetails($productId, $item->getQuantity(), $this->order->getUserId(), $this->order->getSiteId(), $this->visibleColumns);
} elseif (strval($item->getField("MEASURE_CODE")) != '' && self::$catalogIncluded) {
$measures = OrderBasket::getCatalogMeasures();
if (isset($measures[$item->getField("MEASURE_CODE")]) && strlen($measures[$item->getField("MEASURE_CODE")]) > 0) {
$params["MEASURE_TEXT"] = $measures[$item->getField("MEASURE_CODE")];
}
if (strval($params["MEASURE_TEXT"]) == '') {
$defaultMeasure = static::getDefaultMeasures();
$params["MEASURE_TEXT"] = $defaultMeasure["SYMBOL_RUS"] != '' ? $defaultMeasure["SYMBOL_RUS"] : $defaultMeasure["SYMBOL_INTL"];
}
}
if (!isset($params["OFFER_ID"])) {
$params["OFFER_ID"] = $productId;
}
$params["BASKET_CODE"] = $basketCode = $item->getBasketCode();
$params["PRODUCT_PROVIDER_CLASS"] = $item->getProvider();
$id = $params["PRODUCT_ID"];
$params = array_merge($params, $item->getFieldValues(), array("PRODUCT_ID" => $id));
$params["PROPS"] = array();
/** @var \Bitrix\Sale\BasketPropertyItem $property */
foreach ($item->getPropertyCollection() as $property) {
$params["PROPS"][] = array("VALUE" => $property->getField("VALUE"), "NAME" => $property->getField("NAME"), "CODE" => $property->getField("CODE"), "SORT" => $property->getField("SORT"));
}
if (isset($inParams["DISCOUNTS"]["RESULT"]["BASKET"][$basketCode]) && is_array($inParams["DISCOUNTS"]["RESULT"]["BASKET"][$basketCode])) {
foreach ($inParams["DISCOUNTS"]["RESULT"]["BASKET"][$basketCode] as $discount) {
$params["DISCOUNTS"][$discount["DISCOUNT_ID"]] = $discount;
}
}
if (isset($inParams["DISCOUNTS"]["PRICES"]["BASKET"][$basketCode])) {
$params["PRICE_BASE"] = roundEx($inParams["DISCOUNTS"]["PRICES"]["BASKET"][$basketCode]["BASE_PRICE"], SALE_VALUE_PRECISION);
$params["PRICE"] = roundEx($inParams["DISCOUNTS"]["PRICES"]["BASKET"][$basketCode]["PRICE"], SALE_VALUE_PRECISION);
$basketPriceBase += $params["PRICE_BASE"] * $params["QUANTITY"];
$basketPrice += $params["PRICE"] * $params["QUANTITY"];
if (!$item->isCustomPrice()) {
$basketDiscount += $inParams["DISCOUNTS"]["PRICES"]["BASKET"][$basketCode]["DISCOUNT"] * $params["QUANTITY"];
}
} else {
// TODO: for old orders
}
$params["CUSTOM_PRICE"] = $item->isCustomPrice() ? "Y" : "N";
//Let's cache provider product data into form field
if (Provider::isExistsTrustData($this->order->getSiteId(), 'sale', $item->getProductId())) {
$providerData = Provider::getTrustData($this->order->getSiteId(), 'sale', $item->getProductId());
if (is_array($providerData) && !empty($providerData)) {
$params["PROVIDER_DATA"] = serialize($providerData);
}
}
if (is_array($params["SET_ITEMS"]) && !empty($params["SET_ITEMS"])) {
$params["SET_ITEMS_DATA"] = serialize($params["SET_ITEMS"]);
}
$result["ITEMS"][$basketCode] = $params;
}
$result["BASKET_PRICE_BASE"] = roundEx($basketPriceBase, SALE_VALUE_PRECISION);
$result["BASKET_PRICE"] = roundEx($basketPrice, SALE_VALUE_PRECISION);
$result["DISCOUNT_VALUE"] = roundEx($basketDiscount, SALE_VALUE_PRECISION);
$result["ITEMS_ORDER"] = array_keys($result["ITEMS"]);
if (!isset($inParams["SKIP_SKU_INFO"]) || $inParams["SKIP_SKU_INFO"] != true) {
$result = static::getOffersSkuParams($result);
}
$this->data = $result;
}
return $this->data;
}
示例4: getUserBudgetByOrder
/**
* @param Sale\Order $order
* @return int
*/
public static function getUserBudgetByOrder(Sale\Order $order)
{
$budget = static::getUserBudget($order->getUserId(), $order->getCurrency());
if ($userBudgetPool = static::getUserBudgetPool($order->getUserId())) {
foreach ($userBudgetPool->get() as $userBudgetDat) {
$budget += $userBudgetDat['SUM'];
}
}
return $budget;
}
示例5: prepareData
public static function prepareData(Order $order)
{
$result = array("USER_ID" => $order->getUserId(), "PERSON_TYPE_ID" => $order->getPersonTypeId(), "BUYER_USER_NAME" => OrderEdit::getUserName($order->getUserId()), "USER_DESCRIPTION" => $order->getField("USER_DESCRIPTION"));
return $result;
}
示例6: saveProfileData
public static function saveProfileData($profileId, Order $order, array $formData)
{
$result = new Result();
$errors = array();
if (!($profileName = $order->getPropertyCollection()->getProfileName())) {
$result->addError(new EntityError(Loc::getMessage("SALE_ORDEREDIT_PROFILE_ERROR_NAME")));
return $result;
}
$res = \CSaleOrderUserProps::DoSaveUserProfile($order->getUserId(), $profileId, $profileName->getValue(), $order->getPersonTypeId(), $propCollection = $formData["PROPERTIES"], $errors);
if ($res === false) {
if (!empty($errors)) {
foreach ($errors as $error) {
$result->addError(new EntityError($error . "<br>\n"));
}
} else {
$result->addError(new EntityError(Loc::getMessage("SALE_ORDEREDIT_PROFILE_ERROR_SAVE")));
}
}
return $result;
}
示例7: prepareData
public static function prepareData(Order $order)
{
if (\CBXFeatures::IsFeatureEnabled('SaleAccounts')) {
$strBuyerProfileUrl = '/bitrix/admin/sale_buyers_profile.php?USER_ID=' . $order->getUserId() . '&lang=' . LANGUAGE_ID;
} else {
$strBuyerProfileUrl = '/bitrix/admin/user_edit.php?ID=' . $order->getUserId() . '&lang=' . LANGUAGE_ID;
}
$result = array("USER_ID" => $order->getUserId(), "PERSON_TYPE_ID" => $order->getPersonTypeId(), "BUYER_USER_NAME" => OrderEdit::getUserName($order->getUserId()), "USER_DESCRIPTION" => $order->getField("USER_DESCRIPTION"), "BUYER_URL" => $strBuyerProfileUrl);
return $result;
}
示例8: fillEmptyOrderData
/**
* Fill empty order data.
*
* @param Order $order Order object.
* @return void
*/
protected function fillEmptyOrderData(Order $order)
{
$this->orderData = array('ID' => $order->getId(), 'USER_ID' => $order->getUserId(), 'SITE_ID' => $order->getSiteId(), 'ORDER_PRICE' => $order->getPrice(), 'ORDER_WEIGHT' => 0, 'CURRENCY' => $order->getCurrency(), 'PERSON_TYPE_ID' => $order->getPersonTypeId(), 'BASKET_ITEMS' => array(), 'PRICE_DELIVERY' => 0, 'PRICE_DELIVERY_DIFF' => 0, 'DELIVERY_ID' => 0, 'CUSTOM_PRICE_DELIVERY' => 'N', 'SHIPMENT_CODE' => 0, 'SHIPMENT_ID' => 0);
$paymentCollection = $order->getPaymentCollection();
/** @var Payment $payment */
foreach ($paymentCollection as $payment) {
if ($payment->isInner()) {
continue;
}
if (!isset($this->orderData['PAY_SYSTEM_ID'])) {
$this->orderData['PAY_SYSTEM_ID'] = $payment->getPaymentSystemId();
break;
}
}
unset($payment, $paymentCollection);
if (!isset($this->orderData['PAY_SYSTEM_ID'])) {
$this->orderData['PAY_SYSTEM_ID'] = 0;
}
}
示例9: fillEmptyOrderData
/**
* Fill empty order data.
*
* @param Order $order Order object.
* @return void
*/
protected function fillEmptyOrderData(Order $order)
{
$this->orderData = array('ID' => $order->getId(), 'USER_ID' => $order->getUserId(), 'SITE_ID' => $order->getSiteId(), 'ORDER_PRICE' => $order->getPrice(), 'ORDER_WEIGHT' => 0, 'CURRENCY' => $order->getCurrency(), 'BASKET_ITEMS' => array(), 'PRICE_DELIVERY' => 0, 'PRICE_DELIVERY_DIFF' => 0, 'DELIVERY_ID' => 0, 'CUSTOM_PRICE_DELIVERY' => 'N', 'SHIPMENT_CODE' => 0, 'SHIPMENT_ID' => 0);
}