Пример #1
0
 protected function getDefaultDeliveryPriceAction()
 {
     $formData = isset($this->request["formData"]) ? $this->request["formData"] : array();
     $formData['ID'] = $formData['order_id'];
     $order = $this->getOrder($formData);
     $result = Admin\Blocks\OrderShipment::updateData($order, $formData['SHIPMENT']);
     $data = $result->getData();
     /** @var \Bitrix\Sale\Shipment $shipment */
     $shipment = array_shift($data['SHIPMENT']);
     $deliveryPrice = Admin\Blocks\OrderShipment::getDeliveryPrice($shipment);
     $this->addResultData("RESULT", array("CUSTOM_PRICE" => $deliveryPrice));
 }
Пример #2
0
        } else {
            $result = $saleOrder->save();
            if ($result->isSuccess()) {
                if ($backUrl) {
                    LocalRedirect($backUrl);
                } else {
                    LocalRedirect('/bitrix/admin/sale_order_shipment.php?lang=' . $lang . GetFilterParams('filter_', false));
                }
            } else {
                $errors = $result->getErrorMessages();
            }
        }
    }
}
if ($request->isPost() && ($save || $refresh) && check_bitrix_sessid()) {
    $result = \Bitrix\Sale\Helpers\Admin\Blocks\OrderShipment::updateData($saleOrder, $request->get('SHIPMENT'));
    $data = $result->getData();
    $shipment = array_shift($data['SHIPMENT']);
    if ($result->isSuccess() && $save) {
        $saveResult = $saleOrder->save();
        if ($saveResult->isSuccess()) {
            $shipmentId = $shipment->getId();
            if (strlen($request->getPost("apply")) == 0) {
                if ($backUrl) {
                    LocalRedirect($backUrl);
                } else {
                    LocalRedirect("/bitrix/admin/sale_order_shipment.php?lang=" . $lang . GetFilterParams("filter_", false));
                }
            } else {
                LocalRedirect("/bitrix/admin/sale_order_shipment_edit.php?lang=" . $lang . "&order_id=" . $orderId . "&shipment_id=" . $shipmentId . "&backurl=" . urlencode($backUrl) . GetFilterParams("filter_", false));
            }
Пример #3
0
    $APPLICATION->AuthForm(Loc::getMessage("SALE_OK_ACCESS_DENIED"));
}
$moduleId = "sale";
Bitrix\Main\Loader::includeModule('sale');
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/lib/helpers/admin/orderedit.php";
$siteId = isset($_REQUEST["SITE_ID"]) ? htmlspecialcharsbx($_REQUEST["SITE_ID"]) : "";
$siteName = OrderEdit::getSiteName($siteId);
$order = null;
$result = new \Bitrix\Sale\Result();
DiscountCouponsManager::init(DiscountCouponsManager::MODE_MANAGER, array('userId' => isset($_POST["USER_ID"]) ? $_POST["USER_ID"] : 0));
// try to create order from form data & save it
if ($isSavingOperation || $needFieldsRestore) {
    $order = OrderEdit::createOrderFromForm($_POST, $USER->GetID(), true, $_FILES, $result);
    if ($order) {
        if (isset($_POST["SHIPMENT"]) && $_POST["SHIPMENT"]) {
            $dlvRes = Blocks\OrderShipment::updateData($order, $_POST['SHIPMENT']);
            if (!$dlvRes->isSuccess()) {
                $result->addErrors($dlvRes->getErrors());
            }
        }
        if (isset($_POST["PAYMENT"]) && $_POST["PAYMENT"]) {
            $payRes = Blocks\OrderPayment::updateData($order, $_POST['PAYMENT'], !$result->isSuccess());
            if (!$payRes->isSuccess()) {
                $result->addErrors($payRes->getErrors());
            }
        }
        if ($isSavingOperation && $result->isSuccess()) {
            $res = OrderEdit::saveCoupons($order->getUserId(), $_POST);
            if (!$res) {
                $result->addError(new \Bitrix\Main\Entity\EntityError("Can't save coupons!"));
            }