本文整理汇总了PHP中Bitrix\Sale\Order::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getId方法的具体用法?PHP Order::getId怎么用?PHP Order::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Order
的用法示例。
在下文中一共展示了Order::getId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOrder
/**
* @param $formData
* @return Sale\Order
* @throws ArgumentNullException
* @throws UserMessageException
*/
protected function getOrder(array $formData, Result &$result = null)
{
if (!isset($formData["ID"])) {
$formData["ID"] = 0;
} else {
$formData["ID"] = intval($formData["ID"]);
}
if ($this->order !== null && !$this->formDataChanged && $this->order->getId() == $formData["ID"]) {
return $this->order;
}
if (!$result) {
$result = new Result();
}
Admin\OrderEdit::initCouponsData(intval($formData["USER_ID"]) > 0 ? intval($formData["USER_ID"]) : 0, intval($formData["ID"]) > 0 ? intval($formData["ID"]) : 0, intval($formData["OLD_USER_ID"]) > 0 ? intval($formData["OLD_USER_ID"]) : null);
if ($formData["ID"] > 0) {
$this->order = Sale\Order::load($formData["ID"]);
if (!$this->order) {
throw new UserMessageException("Can't load order with id:\"" . $formData["ID"] . "\"!");
}
} else {
$this->order = Admin\OrderEdit::createOrderFromForm($formData, $this->userId, false, array(), $result);
if (!$this->order) {
throw new UserMessageException("Can't create order!");
}
}
$this->formDataChanged = false;
return $this->order;
}
示例2: getCancelBlockHtml
protected static function getCancelBlockHtml(Order $order, array $data)
{
$isCanceled = $order->getField('CANCELED') == "Y" ? true : false;
if ($isCanceled) {
$text = '
<div class="adm-s-select-popup-element-selected" id="sale-adm-status-cancel-blocktext">
<div class="adm-s-select-popup-element-selected-bad">
<span>' . Loc::getMessage("SALE_ORDER_STATUS_CANCELED") . '</span>
' . $order->getField('DATE_CANCELED') . '
<a href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $order->getField("EMP_CANCELED_ID") . '">' . htmlspecialcharsbx($data["EMP_CANCELED_NAME"]) . '</a>
</div>
</div>';
} else {
$text = '
<div class="adm-s-select-popup-element-selected" style="text-align:center;" id="sale-adm-status-cancel-blocktext">
<a href="javascript:void(0);" onclick="BX.Sale.Admin.OrderEditPage.toggleCancelDialog();">
' . Loc::getMessage("SALE_ORDER_STATUS_CANCELING") . '
</a>
</div>';
}
$reasonCanceled = htmlspecialcharsbx(trim($order->getField("REASON_CANCELED")));
if (!\CSaleYMHandler::isOrderFromYandex($order->getId())) {
$reasonHtml = '
<div class="adm-s-select-popup-modal-title">' . Loc::getMessage("SALE_ORDER_STATUS_COMMENT") . '</div>
<textarea style="width:400px;min-height:100px;" name="FORM_REASON_CANCELED" id="FORM_REASON_CANCELED"' . ($isCanceled ? ' disabled' : '') . '>' . (strlen($reasonCanceled) > 0 ? $reasonCanceled : '') . '</textarea>
';
} else {
$reasonHtml = '
<div class="adm-s-select-popup-modal-title">' . Loc::getMessage("SALE_ORDER_STATUS_CANCELING_REASON") . '</div>
<select name="FORM_REASON_CANCELED" id="FORM_REASON_CANCELED" class="adm-bus-select"' . ($isCanceled ? ' disabled' : '') . '>';
foreach (\CSaleYMHandler::getOrderSubstatuses() as $statusId => $statusName) {
$reasonHtml .= '<option value="' . $statusId . '"' . ($statusId == $reasonCanceled ? " selected" : "") . '>' . $statusName . '</option>';
}
$reasonHtml .= '</select>';
}
return '
<tr id="sale-adm-status-cancel-row">
<td class="adm-detail-content-cell-l"> </td>
<td class="adm-detail-content-cell-r">
<div class="adm-s-select-popup-box">
<div class="adm-s-select-popup-container">
<div class="adm-s-select-popup-element-selected-control" onclick="BX.Sale.Admin.OrderEditPage.toggleCancelDialog();"></div>
' . $text . '
</div>
<div class="adm-s-select-popup-modal /*active*/" id="sale-adm-status-cancel-dialog">
<div class="adm-s-select-popup-modal-content">
' . $reasonHtml . '
<div class="adm-s-select-popup-modal-desc">' . Loc::getMessage("SALE_ORDER_STATUS_USER_CAN_VIEW") . '</div>
<span class="adm-btn" id="sale-adm-status-cancel-dialog-btn" onclick="BX.Sale.Admin.OrderEditPage.onCancelStatusButton(\'' . $order->getId() . '\',\'' . $data["CANCELED"] . '\');">
' . ($data["CANCELED"] == "N" ? Loc::getMessage("SALE_ORDER_STATUS_CANCEL") : Loc::getMessage("SALE_ORDER_STATUS_CANCEL_CANCEL")) . '
</span>
<span class="adm-s-select-popup-modal-close" onclick="BX.Sale.Admin.OrderEditPage.toggleCancelDialog();">' . Loc::getMessage("SALE_ORDER_STATUS_TOGGLE") . '</span>
</div>
</div>
</div>
</td>
</tr>';
}
示例3: getView
public static function getView(Order $order, OrderBasket $orderBasket, $selectPayment = null, $selectId = null)
{
// prepare data
$orderId = $order->getId();
$data = $orderBasket->prepareData();
$items = $data['ITEMS'];
$documents = array();
$itemNo = 0;
/** @var \Bitrix\Sale\Payment $payment */
foreach ($order->getPaymentCollection() as $payment) {
$documents[] = $payment;
}
/** @var \Bitrix\Sale\Shipment $shipment */
foreach ($order->getShipmentCollection() as $shipment) {
if (!$shipment->isSystem()) {
if (!$shipment->isCanceled() && $shipment->isShipped()) {
/** @var \Bitrix\Sale\ShipmentItem $shipmentItem */
foreach ($shipment->getShipmentItemCollection() as $shipmentItem) {
$basketItem = $shipmentItem->getBasketItem();
if (isset($items[$basketItem->getBasketCode()])) {
$item =& $items[$basketItem->getBasketCode()];
if ($shippedQuantity =& $item['SHIPPED_QUANTITY']) {
$shippedQuantity += (double) $shipmentItem->getField('QUANTITY');
} else {
$shippedQuantity = (double) $shipmentItem->getField('QUANTITY');
}
}
}
}
$documents[] = $shipment;
}
}
unset($item, $shippedQuantity);
usort($documents, array(__CLASS__, 'sortDocumentsByDate'));
// render view
ob_start();
?>
<div class="adm-s-order-table-ddi">
<table class="adm-s-order-table-ddi-table adm-s-bus-ordertable-option" style="width: 100%;">
<thead>
<tr>
<td class="tac"><?php
echo Loc::getMessage('SALE_OANALYSIS_ITEM_NUMBER');
?>
</td>
<td><?php
echo Loc::getMessage('SALE_OANALYSIS_ITEM_NAME');
?>
</td>
<td class="tac"><?php
echo Loc::getMessage('SALE_OANALYSIS_ITEM_PROPERTIES');
?>
</td>
<td class="tac"><?php
echo Loc::getMessage('SALE_OANALYSIS_ITEM_PLANNED');
?>
</td>
<td class="tac"><?php
echo Loc::getMessage('SALE_OANALYSIS_ITEM_SHIPPED');
?>
</td>
<td class="tac"><?php
echo Loc::getMessage('SALE_OANALYSIS_ITEM_TO_SHIP');
?>
</td>
</tr>
</thead>
<tbody>
<?php
foreach ($items as $item) {
$properties = '<table style="margin: auto; width: 50%;">';
if (is_array($item['SKU_PROPS'])) {
foreach ($item['SKU_PROPS'] as $skuProp) {
$properties .= '<tr>';
$properties .= '<td style="text-align: left;">' . htmlspecialcharsbx($skuProp['NAME']) . ' : ' . '</td>';
if (isset($skuProp['VALUE']['PICT']) && $skuProp['VALUE']['PICT']) {
$properties .= '<td><span class="color"><img src="' . $skuProp['VALUE']['PICT'] . '" alt=""></span></td>';
} else {
$properties .= '<td><span>' . htmlspecialcharsbx($skuProp['VALUE']['NAME']) . '</span></td>';
}
$properties .= '</tr>';
}
}
$properties .= '</table>';
if (!($quantity = (double) $item['QUANTITY'])) {
$quantity = 0;
}
if (!($shippedQuantity = $item['SHIPPED_QUANTITY'])) {
$shippedQuantity = 0;
}
?>
<tr class="bdb-line">
<td class="tac"><?php
echo ++$itemNo;
?>
</td>
<td style="text-align: left;"><a class="fwb" href="<?php
echo $item['EDIT_PAGE_URL'];
?>
"><?php
//.........这里部分代码省略.........
示例4: fillOrderFromRequest
/**
* Filling the order data from request
*
* @internal
*
* @param Sale\Order $order Entity order.
* @param array $fields An array of request data.
*
* @return Sale\Result
*/
public static function fillOrderFromRequest(Sale\Order $order, array $fields)
{
global $USER;
$result = new Sale\Result();
if (isset($fields['CANCELED'])) {
if ($order->getId() > 0 && $order->getField('CANCELED') != $fields['CANCELED']) {
if (!\CSaleOrder::CanUserCancelOrder($order->getId(), $USER->GetUserGroupArray(), $USER->GetID())) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'), 'SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'));
return $result;
}
/** @var Sale\Result $r */
$r = $order->setField('CANCELED', $fields['CANCELED']);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
}
}
if (isset($fields['MARKED'])) {
if ($order->getId() > 0 && $order->getField('MARKED') != $fields['MARKED']) {
/** @var Sale\Result $r */
$r = $order->setField('MARKED', $fields['MARKED']);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
}
}
if ($order->getId() > 0 && !empty($fields['ACCOUNT_NUMBER']) && !empty($fields['SITE_ID'])) {
$filter = array('filter' => array('ACCOUNT_NUMBER' => $fields['ACCOUNT_NUMBER'], '!ID' => $order->getId()), 'select' => array('ID'));
if (($res = OrderTable::getList($filter)) && $res->fetch()) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_ACCOUNT_NUMBER_ALREADY_EXISTS'), 'SALE_COMPATIBLE_ORDER_ACCOUNT_NUMBER_ALREADY_EXISTS'));
}
}
return $result;
}
示例5: prepareData
protected static function prepareData(Order $order)
{
static $result = null;
if ($result === null) {
$creator = static::getUserInfo($order->getField("CREATED_BY"));
$creatorName = $creator["LOGIN"];
if (strlen($creator["NAME"]) > 0) {
$creatorName = $creator["NAME"] . " (" . $creatorName . ")";
}
$canceler = static::getUserInfo($order->getField("EMP_CANCELED_ID"));
$cancelerName = $canceler["LOGIN"];
if (strlen($canceler["NAME"]) > 0) {
$cancelerName = $canceler["NAME"] . " (" . $cancelerName . ")";
}
$sourceName = "";
if (strlen($order->getField('XML_ID')) > 0) {
$dbRes = OrderTable::getList(array('filter' => array('ORDER_ID' => $order->getId()), 'select' => array('SOURCE_NAME' => 'TRADING_PLATFORM.NAME')));
if ($tpOrder = $dbRes->fetch()) {
$sourceName = $tpOrder['SOURCE_NAME'];
}
}
$result = array("DATE_INSERT" => $order->getDateInsert()->toString(), "DATE_UPDATE" => $order->getField('DATE_UPDATE')->toString(), "CREATOR_USER_NAME" => $creatorName, "CREATOR_USER_ID" => $creator["ID"], "STATUS_ID" => $order->getField('STATUS_ID'), "CANCELED" => $order->getField("CANCELED"), "EMP_CANCELED_NAME" => $cancelerName, "SOURCE_NAME" => $sourceName);
}
return $result;
}
示例6: getScripts
/**
* @return string
*/
public function getScripts()
{
if (!static::$jsInited) {
\Bitrix\Main\Page\Asset::getInstance()->addJs("/bitrix/js/sale/admin/order_basket.js");
static::$jsInited = true;
}
$data = static::prepareData();
$totalPrices = OrderEdit::getTotalPrices($this->order, $this, false);
$langPhrases = array("SALE_ORDER_BASKET_TURN", "SALE_ORDER_BASKET_EXPAND", "SALE_ORDER_BASKET_UP_RATIO", "SALE_ORDER_BASKET_PROD_EDIT", "SALE_ORDER_BASKET_DOWN_RATIO", "SALE_ORDER_BASKET_PROD_COUNT", "SALE_ORDER_BASKET_NO_PICTURE", "SALE_ORDER_BASKET_PROD_CREATE", "SALE_ORDER_BASKET_ROW_SETTINGS", "SALE_ORDER_BASKET_PROD_MENU_EDIT", "SALE_ORDER_BASKET_PROD_MENU_DELETE", "SALE_ORDER_BASKET_BASE_CATALOG_PRICE", "SALE_ORDER_BASKET_PROD_EDIT_ITEM_SAVE", "SALE_ORDER_BASKET_KG", "SALE_ORDER_BASKET_COUPON", "SALE_ORDER_BASKET_COUPON_STATUS", "SALE_ORDER_BASKET_COUPON_APPLY", "SALE_ORDER_BASKET_COUPON_DELETE", "SALE_ORDER_BASKET_POSITION_EXISTS");
$result = '<script type="text/javascript">';
foreach ($langPhrases as $phrase) {
$result .= ' BX.message({' . $phrase . ': "' . \CUtil::jsEscape(Loc::getMessage($phrase)) . '"});';
}
if ($this->mode == self::EDIT_MODE) {
$result .= '
BX.ready(function(){
' . $this->jsObjName . '= new BX.Sale.Admin.OrderBasketEdit({
tableId: "' . $this->idPrefix . 'sale_order_edit_product_table",
idPrefix: "' . $this->idPrefix . '",
productsOrder: ' . \CUtil::phpToJSObject($data["ITEMS_ORDER"]) . ',
products: ' . \CUtil::phpToJSObject($data["ITEMS"]) . ',
visibleColumns: ' . \CUtil::phpToJSObject($this->visibleColumns) . ',
objName: "' . $this->jsObjName . '",
createProductBasement: ' . ($this->createProductBasement ? 'true' : 'false') . ',
columnsCount: ' . count($this->visibleColumns) . ',
createBasketBottom: true,
iblocksSkuParams: ' . \CUtil::phpToJSObject($data["IBLOCKS_SKU_PARAMS"]) . ',
productsOffersSkuParams: ' . \CUtil::phpToJSObject($data["PRODUCTS_OFFERS_SKU"]) . ',
isShowXmlId: ' . ($this->isShowXmlId ? 'true' : 'false') . ',
discounts: ' . \CUtil::phpToJSObject(OrderEdit::getOrderedDiscounts($this->order, false)) . ',
mode: "edit",
unRemovableFields: ["PRICE", "QUANTITY"],
' . $this->getTotalBlockFieldsJs($totalPrices, $data) . '
});
BX.Sale.Admin.OrderEditPage.registerFieldsUpdaters( ' . $this->jsObjName . '.getFieldsUpdaters() );
BX.Sale.Admin.OrderBasketCoupons.statusCouponApplyed = ' . DiscountCouponsManager::STATUS_APPLYED . ';
BX.Sale.Admin.OrderBasketCoupons.mode = BX.Sale.Admin.OrderBasketCoupons.MODES_LIST.' . ($this->order->getId() > 0 ? 'EDIT' : 'CREATE') . ';
BX.Sale.Admin.OrderBasketCoupons.setCoupons(' . \CUtil::phpToJSObject(OrderEdit::getCouponList($this->order, false)) . ');
});';
$result .= $this->settingsDialog->getScripts();
} else {
$result .= '
BX.ready(function(){
' . $this->jsObjName . '= new BX.Sale.Admin.OrderBasket({
tableId: "' . $this->idPrefix . 'sale_order_view_product_table",
idPrefix: "' . $this->idPrefix . '",
productsOrder: ' . \CUtil::phpToJSObject($data["ITEMS_ORDER"]) . ',
products: ' . \CUtil::phpToJSObject($data["ITEMS"]) . ',
visibleColumns: ' . \CUtil::phpToJSObject($this->visibleColumns) . ',
objName: "' . $this->jsObjName . '",
createProductBasement: ' . ($this->createProductBasement ? 'true' : 'false') . ',
iblocksSkuParams: ' . \CUtil::phpToJSObject($data["IBLOCKS_SKU_PARAMS"]) . ',
columnsCount: ' . count($this->visibleColumns) . ',
isShowXmlId: ' . ($this->isShowXmlId ? 'true' : 'false') . ',
discounts: ' . \CUtil::phpToJSObject(OrderEdit::getOrderedDiscounts($this->order, false)) . ',
createBasketBottom: true,
mode: "view",
' . $this->getTotalBlockFieldsJs($totalPrices, $data) . '
});
BX.Sale.Admin.OrderEditPage.registerFieldsUpdaters( ' . $this->jsObjName . '.getFieldsUpdaters() );
BX.Sale.Admin.OrderBasketCoupons.mode = BX.Sale.Admin.OrderBasketCoupons.MODES_LIST.VIEW;
BX.Sale.Admin.OrderBasketCoupons.setCoupons(' . \CUtil::phpToJSObject(OrderEdit::getCouponList($this->order, false)) . ');
});';
$result .= $this->settingsDialog->getScripts();
}
$result .= '</script>';
return $result;
}
示例7: fillOrderFromRequest
/**
* Filling the order data from request
*
* @internal
*
* @param Sale\Order $order Entity order.
* @param array $fields An array of request data.
*
* @return Sale\Result
*/
public static function fillOrderFromRequest(Sale\Order $order, array $fields)
{
global $USER;
$result = new Sale\Result();
if (isset($fields['CANCELED'])) {
if ($order->getId() > 0 && $order->getField('CANCELED') != $fields['CANCELED']) {
if (!\CSaleOrder::CanUserCancelOrder($order->getId(), $USER->GetUserGroupArray(), $USER->GetID())) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'), 'SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'));
return $result;
}
/** @var Sale\Result $r */
$r = $order->setField('CANCELED', $fields['CANCELED']);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
}
}
if (isset($fields['MARKED'])) {
if ($order->getId() > 0 && $order->getField('MARKED') != $fields['MARKED']) {
if (!\CSaleOrder::CanUserMarkOrder($order->getId(), $USER->GetUserGroupArray(), $USER->GetID())) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_MARKED_NO_PERMISSION'), 'SALE_COMPATIBLE_ORDER_MARKED_NO_PERMISSION'));
return $result;
}
/** @var Sale\Result $r */
$r = $order->setField('MARKED', $fields['MARKED']);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
}
}
return $result;
}
示例8: getUserBudgetTransForOrder
/**
* @param Sale\Order $order
* @return int
*/
public static function getUserBudgetTransForOrder(Sale\Order $order)
{
$ignoreTypes = array(static::BUDGET_TYPE_ORDER_PAY);
$sumTrans = 0;
if ($order->getId() > 0) {
$resTrans = \CSaleUserTransact::GetList(array("TRANSACT_DATE" => "DESC"), array("ORDER_ID" => $order->getId()), false, false, array("AMOUNT", "CURRENCY", "DEBIT"));
while ($transactDat = $resTrans->Fetch()) {
if ($transactDat['DEBIT'] == "Y") {
$sumTrans += $transactDat['AMOUNT'];
} else {
$sumTrans -= $transactDat['AMOUNT'];
}
}
}
if ($userBudgetPool = static::getUserBudgetPool($order->getUserId())) {
foreach ($userBudgetPool->get() as $userBudgetDat) {
if (in_array($userBudgetDat['TYPE'], $ignoreTypes)) {
continue;
}
$sumTrans += $userBudgetDat['SUM'];
}
}
return $sumTrans;
}
示例9: loadForOrder
public static function loadForOrder(Order $order)
{
$objects = array();
$propertyValues = array();
$propertyValuesMap = array();
$properties = array();
if ($order->getId() > 0) {
$result = OrderPropsValueTable::getList(array('select' => array('ID', 'NAME', 'VALUE', 'CODE', 'ORDER_PROPS_ID'), 'filter' => array('ORDER_ID' => $order->getId())));
while ($row = $result->fetch()) {
$propertyValues[$row['ID']] = $row;
$propertyValuesMap[$row['ORDER_PROPS_ID']] = $row['ID'];
}
}
$filter = array();
if ($order->getPersonTypeId() > 0) {
$filter[] = array('=PERSON_TYPE_ID' => $order->getPersonTypeId());
}
$result = OrderPropsTable::getList(array('select' => array('ID', 'PERSON_TYPE_ID', 'NAME', 'TYPE', 'REQUIRED', 'DEFAULT_VALUE', 'SORT', 'USER_PROPS', 'IS_LOCATION', 'PROPS_GROUP_ID', 'DESCRIPTION', 'IS_EMAIL', 'IS_PROFILE_NAME', 'IS_PAYER', 'IS_LOCATION4TAX', 'IS_FILTERED', 'CODE', 'IS_ZIP', 'IS_PHONE', 'IS_ADDRESS', 'ACTIVE', 'UTIL', 'INPUT_FIELD_LOCATION', 'MULTIPLE', 'SETTINGS'), 'filter' => $filter, 'order' => array('SORT' => 'ASC')));
while ($row = $result->fetch()) {
$properties[$row['ID']] = $row;
}
$result = OrderPropsRelationTable::getList(array('select' => array('PROPERTY_ID', 'ENTITY_ID', 'ENTITY_TYPE'), 'filter' => array('PROPERTY_ID' => array_keys($properties))));
$propRelation = array();
while ($row = $result->fetch()) {
if (empty($row)) {
continue;
}
if (!isset($propRelation[$row['PROPERTY_ID']])) {
$propRelation[$row['PROPERTY_ID']] = array();
}
$propRelation[$row['PROPERTY_ID']][] = $row;
}
foreach ($properties as $property) {
$id = $property['ID'];
if (isset($propertyValuesMap[$id])) {
$fields = $propertyValues[$propertyValuesMap[$id]];
unset($propertyValues[$propertyValuesMap[$id]]);
unset($propertyValuesMap[$id]);
} else {
if ($property['ACTIVE'] == 'N' || $property['UTIL'] == 'Y') {
continue;
}
$fields = null;
}
if (isset($propRelation[$id])) {
$objects[] = new static($property, $fields, $propRelation[$id]);
} else {
$objects[] = new static($property, $fields);
}
}
foreach ($propertyValues as $propertyValue) {
$objects[] = new static(null, $propertyValue);
}
return $objects;
}
示例10: getOrderPropertiesByJS
public static function getOrderPropertiesByJS(Order $order)
{
if ($order->getId() > 0) {
$result = $order->getPropertyCollection()->getArray();
} else {
$result = self::getNotRelPropData($order);
}
return '
<script type="text/javascript">
BX.ready(function(){
BX.Sale.Admin.OrderBuyer.setOrderPropsArray(' . \CUtil::PhpToJSObject($result) . ');
});
</script>
';
}
示例11: getScripts
/**
* @param Order $order
* @param $formId
* @return string
*/
public static function getScripts(Order $order, $formId)
{
Asset::getInstance()->addJs("/bitrix/js/sale/admin/order_edit.js");
Asset::getInstance()->addJs("/bitrix/js/sale/admin/order_ajaxer.js");
$currencyId = $order->getCurrency();
$currencies = array();
if (Loader::includeModule('currency')) {
\CJSCore::Init(array('currency'));
$currencyFormat = \CCurrencyLang::getFormatDescription($currencyId);
$currencies = array(array('CURRENCY' => $currencyId, 'FORMAT' => array('FORMAT_STRING' => $currencyFormat['FORMAT_STRING'], 'DEC_POINT' => $currencyFormat['DEC_POINT'], 'THOUSANDS_SEP' => $currencyFormat['THOUSANDS_SEP'], 'DECIMALS' => $currencyFormat['DECIMALS'], 'THOUSANDS_VARIANT' => $currencyFormat['THOUSANDS_VARIANT'], 'HIDE_ZERO' => "N")));
}
$curFormat = \CCurrencyLang::getCurrencyFormat($currencyId);
$currencyLang = trim(str_replace("#", '', $curFormat["FORMAT_STRING"]));
$langPhrases = array("SALE_ORDEREDIT_DISCOUNT_UNKNOWN", "SALE_ORDEREDIT_REFRESHING_DATA", "SALE_ORDEREDIT_FIX", "SALE_ORDEREDIT_UNFIX");
$result = '
<script type="text/javascript">
BX.ready(function(){
BX.Sale.Admin.OrderEditPage.orderId = "' . $order->getId() . '";
BX.Sale.Admin.OrderEditPage.siteId = "' . $order->getSiteId() . '";
BX.Sale.Admin.OrderEditPage.languageId = "' . LANGUAGE_ID . '";
BX.Sale.Admin.OrderEditPage.formId = "' . $formId . '_form";
BX.Sale.Admin.OrderEditPage.adminTabControlId = "' . $formId . '";
' . (!empty($currencies) ? 'BX.Currency.setCurrencies(' . \CUtil::PhpToJSObject($currencies, false, true, true) . ');' : '') . 'BX.Sale.Admin.OrderEditPage.currency = "' . $currencyId . '";
BX.Sale.Admin.OrderEditPage.currencyLang = "' . \CUtil::JSEscape($currencyLang) . '";';
if ($formId == "sale_order_create") {
$result .= '
BX.Sale.Admin.OrderEditPage.registerFieldsUpdaters(BX.Sale.Admin.OrderPayment.prototype.getCreateOrderFieldsUpdaters());';
}
foreach ($langPhrases as $phrase) {
$result .= ' BX.message({' . $phrase . ': "' . \CUtil::JSEscape(Loc::getMessage($phrase)) . '"});';
}
$result .= '});
</script>
';
return $result;
}
示例12: 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;
}
}
示例13: 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);
}