本文整理汇总了PHP中Bitrix\Sale\Order::getSiteId方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getSiteId方法的具体用法?PHP Order::getSiteId怎么用?PHP Order::getSiteId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Order
的用法示例。
在下文中一共展示了Order::getSiteId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onOrderSave
/**
* @param Order $order
* @return Result
* @throws NotImplementedException
* @throws SystemException
*/
public static function onOrderSave(Order $order)
{
$result = new Result();
static::resetTrustData($order->getSiteId());
/** @var Result $r */
$r = static::applyPoolReservation($order);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
return $result;
}
/** @var Result $r */
$r = static::applyShipment($order);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
return $result;
}
示例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: setProviderTrustData
protected static function setProviderTrustData(BasketItem $item, Order $order, array $data)
{
if (empty($data)) {
return false;
}
Provider::setTrustData($order->getSiteId(), 'sale', $item->getProductId(), $data);
if ($item->isBundleParent()) {
if ($bundle = $item->getBundleCollection()) {
/** @var \Bitrix\Sale\BasketItem $bundleItem */
foreach ($bundle as $bundleItem) {
$bundleItemData = $bundleItem->getFields()->getValues();
Provider::setTrustData($order->getSiteId(), 'sale', $bundleItem->getProductId(), $bundleItemData);
}
}
}
return true;
}
示例5: 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;
}
}
示例6: 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);
}