Битрикс оформление заказа: замена sale.order.ajax на свой компонент
В данной статье рассматривается решение задачи, когда необходимо кастомизировать оформление заказа sale.order.ajax. Но ввиду того, что верстка сильно отличается, было принято решение использовать custom компонент оформления заказа.
Компонент идет ввиде модуля, поэтому его необходимо установить в папку /local/modules/.
Использоваться будет компонент opensource.order. Можно его найти на Гитхабе.
После установки создаем страницу оформления заказа, например /order/index.php
<? require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php"); $APPLICATION->SetTitle("Оформление заказа"); ?> <?/* <div class="title_box"> <h1><?=$APPLICATION->ShowTitle(false);?></h1> </div> */ global $USER; $rsUser = CUser::GetByID($USER->GetID()); $arUser = $rsUser->Fetch(); $user_type = 1; if($arUser['UF_USER_TYPE'] == 'ur' || $_GET['type'] == 'ur'){ $user_type = 2; } ?> <?$APPLICATION->IncludeComponent("opensource:order", "custom", Array( "DEFAULT_DELIVERY_ID" => "0", // Служба доставки по умолчанию "DEFAULT_PAY_SYSTEM_ID" => "0", // Платежная система по умолчанию "DEFAULT_PERSON_TYPE_ID" => $user_type, // Тип плательщика по умолчанию "PATH_TO_BASKET" => "/personal/cart/", // Путь до раздела с корзиной "COMPONENT_TEMPLATE" => ".default" ), false );?> <?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
После добавляем в папку с шаблоном /local/templates/НАЗВАНИЕ ШАБЛОНА/components/ кастомный компонент opensource.
То есть создаем путь такой /local/templates/НАЗВАНИЕ ШАБЛОНА/components/opensource/order/custom.
В этой папке уже будем проводить кастомизацию. Начнем с файла result_modifier.php
<?php /** * MAKING $arResult FROM SCRATCHES * * @var OpenSourceOrderComponent $component */ use Bitrix\Sale\BasketItem; use Bitrix\Sale\BasketPropertyItem; use Bitrix\Sale\Delivery; use Bitrix\Sale\Order; use Bitrix\Sale\PropertyValue; use OpenSource\Order\LocationHelper; use OpenSource\Order\OrderHelper; $component = &$this->__component; $order = $component->order; if (!$order instanceof Order) { return; } /** * ORDER FIELDS */ $arResult = $order->getFieldValues(); /** * ORDER PROPERTIES */ global $USER; if($USER->IsAuthorized()){ $rsUser = CUser::GetByID($USER->GetID()); $arUser = $rsUser->Fetch(); $arResult["USER"] = $arUser; } $arResult['PROPERTIES'] = []; foreach ($order->getPropertyCollection() as $prop) { /** * @var PropertyValue $prop */ if ($prop->isUtil()) { continue; } $arProp['FORM_NAME'] = 'properties[' . $prop->getField('CODE') . ']'; $arProp['FORM_LABEL'] = 'property_' . $prop->getField('CODE'); $arProp['TYPE'] = $prop->getType(); $arProp['NAME'] = $prop->getName(); $arProp['VALUE'] = $prop->getValue(); $arProp['IS_REQUIRED'] = $prop->isRequired(); $arProp['ERRORS'] = $component->errorCollection->getAllErrorsByCode('PROPERTIES[' . $prop->getField('CODE') . ']'); switch ($prop->getType()) { case 'LOCATION': if (!empty($arProp['VALUE'])) { $arProp['LOCATION_DATA'] = LocationHelper::getDisplayByCode($arProp['VALUE']); } break; case 'ENUM': $arProp['OPTIONS'] = $prop->getPropertyObject() ->getOptions(); break; } $arResult['PROPERTIES'][$prop->getField('CODE')] = $arProp; } foreach ($arResult['PROPERTIES'] as $key => $arProp) { if($USER->IsAuthorized()){ if($arProp['FORM_LABEL']==="property_FIO") $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["NAME"]. " " . $arResult["USER"]["LAST_NAME"]; if($arProp['FORM_LABEL']==="property_EMAIL") $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["EMAIL"]; if($arProp['FORM_LABEL']==="property_PHONE") $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["PERSONAL_PHONE"]; if($arProp['FORM_LABEL']==="property_ADDRESS") $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["PERSONAL_NOTES"]; if($arResult["USER"]['UF_USER_TYPE'] == 'ur' || $_GET['type'] == 'ur') { if ($arProp['FORM_LABEL'] === "property_NAME_COMPANY") { $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["WORK_COMPANY"]; } if ($arProp['FORM_LABEL'] === "property_CONTACT_PERSON") { $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["NAME"]. " " . $arResult["USER"]["LAST_NAME"]; } if ($arProp['FORM_LABEL'] === "property_PHONE") { $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["WORK_PHONE"]; } if ($arProp['FORM_LABEL'] === "property_ADDRESS") { $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["WORK_NOTES"]; } if ($arProp['FORM_LABEL'] === "property_INN") { $arResult['PROPERTIES'][$key]['VALUE'] = $arResult["USER"]["UF_COMPANY_INN"]; } } } } use Bitrix\Main\Loader; Loader::includeModule('sale'); $locationCode = $arProp['LOCATION_DATA']["code"]; // именно CODE! не ID. $result = []; $deliveries = Bitrix\Sale\Delivery\Services\Table::getList( [ 'select' => ['ID', 'NAME'] ] )->fetchAll(); foreach($deliveries as $delivery) { if(Bitrix\Sale\Delivery\Restrictions\ByLocation::check($locationCode,[],$delivery['ID'])) { $result[] = $delivery; } } /** * DELIVERY */ $arResult['DELIVERY_ERRORS'] = []; foreach ($component->errorCollection->getAllErrorsByCode('delivery') as $error) { $arResult['DELIVERY_ERRORS'][] = $error; } $arResult['DELIVERY_LIST'] = []; $shipment = OrderHelper::getFirstNonSystemShipment($order); if ($shipment !== null) { $availableDeliveries = Delivery\Services\Manager::getRestrictedObjectsList($shipment); $allDeliveryIDs = $order->getDeliveryIdList(); $checkedDeliveryId = end($allDeliveryIDs); $checkedDeliveryId = "".$checkedDeliveryId.""; if($checkedDeliveryId === '1') $arResult["WARN_DELIVERY"] = '1'; foreach (OrderHelper::calcDeliveries($shipment, $availableDeliveries) as $deliveryID => $calculationResult) { /** * @var Delivery\Services\Base $obDelivery */ $obDelivery = $availableDeliveries[$deliveryID]; $arDelivery = []; $arDelivery['ID'] = $obDelivery->getId(); $arDelivery['NAME'] = $obDelivery->getName(); $arDelivery['DESCRIPTION'] = $obDelivery->getDescription(); $arDelivery['CHECKED'] = $checkedDeliveryId === $obDelivery->getId(); $arDelivery['PRICE'] = $calculationResult->getPrice(); $arDelivery['PRICE_DISPLAY'] = SaleFormatCurrency( $calculationResult->getDeliveryPrice(), $order->getCurrency() ); $arResult['DELIVERY_LIST'][$deliveryID] = $arDelivery; } } /** * PAY SYSTEM */ $arResult['PAY_SYSTEM_ERRORS'] = []; foreach ($component->errorCollection->getAllErrorsByCode('payment') as $error) { $arResult['PAY_SYSTEM_ERRORS'][] = $error; } $arResult['PAY_SYSTEM_LIST'] = []; $availablePaySystem = OrderHelper::getAvailablePaySystems($order); $checkedPaySystemId = 0; if (!$order->getPaymentCollection()->isEmpty()) { $payment = $order->getPaymentCollection()->current(); $checkedPaySystemId = $payment->getPaymentSystemId(); } foreach ($availablePaySystem as $paySystem) { $arPaySystem = []; $arPaySystem['ID'] = $paySystem->getField('ID'); $arPaySystem['NAME'] = $paySystem->getField('NAME'); $arPaySystem['DESCRIPTION'] = $paySystem->getField('DESCRIPTION'); $arPaySystem['CHECKED'] = $arPaySystem['ID'] === $checkedPaySystemId; $arResult['PAY_SYSTEM_LIST'][$arPaySystem['ID']] = $arPaySystem; } /** * BASKET */ $arResult['BASKET'] = []; foreach ($order->getBasket() as $basketItem) { /** * @var BasketItem $basketItem */ $arBasketItem = []; $arBasketItem['ID'] = $basketItem->getId(); $arBasketItem['NAME'] = $basketItem->getField('NAME'); $arBasketItem['CURRENCY'] = $basketItem->getCurrency(); $arBasketItem['PRODUCT_ID'] = $basketItem->getField('PRODUCT_ID'); $arBasketItem['PROPERTIES'] = []; foreach ($basketItem->getPropertyCollection() as $basketPropertyItem): /** * @var BasketPropertyItem $basketPropertyItem */ $propCode = $basketPropertyItem->getField('CODE'); if ($propCode !== 'CATALOG.XML_ID' && $propCode !== 'PRODUCT.XML_ID') { $arBasketItem['PROPERTIES'][] = [ 'NAME' => $basketPropertyItem->getField('NAME'), 'VALUE' => $basketPropertyItem->getField('VALUE'), ]; } endforeach; $arBasketItem['QUANTITY'] = $basketItem->getQuantity(); $arBasketItem['QUANTITY_DISPLAY'] = $basketItem->getQuantity(); $arBasketItem['QUANTITY_DISPLAY'] .= ' ' . $basketItem->getField('MEASURE_NAME'); $arBasketItem['BASE_PRICE'] = $basketItem->getBasePrice(); $arBasketItem['BASE_PRICE_DISPLAY'] = SaleFormatCurrency( $arBasketItem['BASE_PRICE'], $arBasketItem['CURRENCY'] ); $arBasketItem['PRICE'] = $basketItem->getPrice(); $arBasketItem['PRICE_DISPLAY'] = SaleFormatCurrency( $arBasketItem['PRICE'], $arBasketItem['CURRENCY'] ); $arBasketItem['SUM'] = $basketItem->getPrice() * $basketItem->getQuantity(); $arBasketItem['SUM_DISPLAY'] = SaleFormatCurrency( $arBasketItem['SUM'], $arBasketItem['CURRENCY'] ); $arResult['BASKET'][$arBasketItem['ID']] = $arBasketItem; } /** * ORDER TOTAL BASKET PRICES */ //Стоимость товаров без скидок $arResult['PRODUCTS_BASE_PRICE'] = $order->getBasket()->getBasePrice(); $arResult['PRODUCTS_BASE_PRICE_DISPLAY'] = SaleFormatCurrency( $arResult['PRODUCTS_BASE_PRICE'], $arResult['CURRENCY'] ); //Стоимость товаров со скидами $arResult['PRODUCTS_PRICE'] = $order->getBasket()->getPrice(); $arResult['PRODUCTS_PRICE_DISPLAY'] = SaleFormatCurrency( $arResult['PRODUCTS_PRICE'], $arResult['CURRENCY'] ); //Скидка на товары $arResult['PRODUCTS_DISCOUNT'] = $arResult['PRODUCTS_BASE_PRICE'] - $arResult['PRODUCTS_PRICE']; $arResult['PRODUCTS_DISCOUNT_DISPLAY'] = SaleFormatCurrency( $arResult['PRODUCTS_DISCOUNT'], $arResult['CURRENCY'] ); /** * ORDER TOTAL DELIVERY PRICES */ $arShowPrices = $order->getDiscount() ->getShowPrices(); //Стоимость доставки без скидок $arResult['DELIVERY_BASE_PRICE'] = $arShowPrices['DELIVERY']['BASE_PRICE'] ?? 0; $arResult['DELIVERY_BASE_PRICE_DISPLAY'] = SaleFormatCurrency( $arResult['DELIVERY_BASE_PRICE'], $arResult['CURRENCY'] ); //Стоимость доставки с учетом скидок $arResult['DELIVERY_PRICE'] = $order->getDeliveryPrice(); $arResult['DELIVERY_PRICE_DISPLAY'] = SaleFormatCurrency( $arResult['DELIVERY_PRICE'], $arResult['CURRENCY'] ); //Скидка на доставку $arResult['DELIVERY_DISCOUNT'] = $arShowPrices['DELIVERY']['DISCOUNT'] ?? 0; $arResult['DELIVERY_DISCOUNT_DISPLAY'] = SaleFormatCurrency( $arResult['DELIVERY_PRICE'], $arResult['CURRENCY'] ); /** * ORDER TOTAL PRICES */ //Общая цена без скидок $arResult['SUM_BASE'] = $arResult['PRODUCTS_BASE_PRICE'] + $arResult['DELIVERY_BASE_PRICE']; $arResult['SUM_BASE_DISPLAY'] = SaleFormatCurrency( $arResult['SUM_BASE'], $arResult['CURRENCY'] ); //Общая скидка $arResult['DISCOUNT_VALUE'] = $arResult['SUM_BASE'] - $order->getPrice(); $arResult['DISCOUNT_VALUE_DISPLAY'] = SaleFormatCurrency( $arResult['DISCOUNT_VALUE'], $arResult['CURRENCY'] ); //К оплате $arResult['SUM'] = $order->getPrice(); $arResult['SUM_DISPLAY'] = SaleFormatCurrency( $arResult['SUM'], $arResult['CURRENCY'] );
Далее уже файл template.php
<?php use Bitrix\Main\Error; use Bitrix\Sale\Order; if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } /** @var array $arParams */ /** @var array $arResult */ /** @global CMain $APPLICATION */ /** @global CUser $USER */ /** @global CDatabase $DB */ /** @var CBitrixComponentTemplate $this */ /** @var string $templateName */ /** @var string $templateFile */ /** @var string $templateFolder */ /** @var string $componentPath */ /** @var OpenSourceOrderComponent $component */ CJSCore::Init(['jquery']); $this->addExternalJs($templateFolder . '/selectize/selectize.js'); $this->addExternalCss($templateFolder . '/selectize/selectize.default.css'); $this->addExternalCss($templateFolder . '/selectize/selectize.dropdown.css'); ?> <div class="os-order"> <?php if (isset($arResult['ID']) && $arResult['ID'] > 0) { include 'done.php'; } elseif ($component->order instanceof Order && count($component->order->getBasket()) > 0) { include 'form.php'; }else{?> <?php if (count($component->errorCollection) > 0): ?> <div class="errors_list" style="text-align: center;margin: 50px 0 20px 0;font-size: 24px;font-weight: 900;"> <?php foreach ($component->errorCollection as $error):?> <div class="error" style="color:black"><?= $error->getMessage() ?></div> <?php endforeach; ?> </div> <?php endif;?> <?}?> </div>
Далее создадим файл form.php.
<?php use Bitrix\Main\Error; use Bitrix\Main\Localization\Loc; use Bitrix\Main\Web\Json; if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } /** @var array $arParams */ /** @var array $arResult */ /** @global CMain $APPLICATION */ /** @global CUser $USER */ /** @var CBitrixComponentTemplate $this */ /** @var string $templateName */ /** @var string $templateFile */ /** @var string $templateFolder */ /** @var string $componentPath */ /** @var OpenSourceOrderComponent $component */ //$component->ErrorCollection->getErrorByCode('user_reg_error'); $cur_lang = $_SESSION["LANG_UI"]; include $_SERVER["DOCUMENT_ROOT"] .'/include/preloader.php'; //Логирование ошибок компонента //file_put_contents(__DIR__ . '/LOG.txt', print_r($component->errorCollection, true),FILE_APPEND); ?> <link rel="stylesheet" href="<?=SITE_TEMPLATE_PATH?>/css/timepicker.min.css" /> <script src="<?=SITE_TEMPLATE_PATH?>/js/timepicker.js"></script> <script > $(document).ready(function () { function changeDelivery(deliverys) { if(deliverys.data.DELIVERIES[48] || deliverys.data.DELIVERIES[49] || deliverys.data.DELIVERIES[50] || deliverys.data.DELIVERIES[51]){ //Удаляем доставку по согласованию если есть шиптор delete deliverys.data.DELIVERIES[46]; } return deliverys; } if($('input[id=method48]').prop('checked')) $('.make-an-order_adress').css({"display": "block"}); if($('input[id=method49]').prop('checked')) $('.make-an-order_adress').css({"display": "block"}); if($('input[id=method50]').prop('checked')) $('.make-an-order_adress').css({"display": "block"}); if($('input[id=method51]').prop('checked')) $('.make-an-order_adress').css({"display": "block"}); var $locationSearch = $('.location-search'); var $adressSearch = $('#property_ADDRESS'); /** * Recalculate all deliveries on location prop change */ var $deliveryBlock = $('.delivey-method_methods'); var $render_total_price = $('.render_total_price'); var delivery_print_warn = '<?=$arResult["WARN_DELIVERY"]?>'; if(delivery_print_warn === '1') $('span.warn_error').html('<?= Loc::getMessage('OPEN_MESS3_'.$cur_lang)?>'); function renderDelivery(deliveryData) { var html = ''; html += '<div class="delivey-method_method">'; html += '<input type="radio" name="delivery_id" id="method' + deliveryData.id + '" value="' + deliveryData.id + '">'; html += '<label for="method' + deliveryData.id + '" >'+ deliveryData.name +'<span>'+ deliveryData.price_display +'</span></label>'; html += ' <p class="method_desc">' + deliveryData.description + '</span>'; html += '</div>'; $deliveryBlock.append(html); } function rounded(number){ return +number.toFixed(0); } function renderDeliveryS(deliveryData) { if(deliveryData.ID ==='1'){} else if(deliveryData.ID ==='46' || $('#property_LOCATION-selectized').prev().text().length == 0){ var html = ''; html += '<div class="delivey-method_method">'; html += '<input type="radio" name="delivery_id" id="method' + deliveryData.ID + '" value="' + deliveryData.ID + '">'; html += '<label for="method' + deliveryData.ID + '" >'+ deliveryData.NAME +'</label>'; html += ' <p class="method_desc">' + deliveryData.DESCRIPTION + '</span>'; html += '</div>'; $deliveryBlock.append(html); } else{ var html = ''; html += '<div class="delivey-method_method">'; html += '<input type="radio" data-findme="123" name="delivery_id" id="method' + deliveryData.ID + '" value="' + deliveryData.ID + '">'; html += '<label for="method' + deliveryData.ID + '" >'+ deliveryData.NAME +'<span>'+ rounded(deliveryData.PRICE) +' <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?><i class="fa fa-rub"></i></span></label>'; html += ' <p class="method_desc">' + deliveryData.DESCRIPTION + '</span>'; html += '</div>'; $deliveryBlock.append(html); } } function renderTotalPrice(TotalPriceData) { var html = ''; html += ' <div class="my-order_delivery">'; html += ' <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_PRODUCTS_BASE_PRICE_'.$cur_lang)?></p>'; html += ' <p class="">' + TotalPriceData.PRODUCTS_BASE_PRICE_DISPLAY + ' <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p>'; html += ' </div>'; html += ' '; html += ' <div class="my-order_delivery">'; html += ' <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_PRODUCTS_PRICE_'.$cur_lang)?></p>'; html += ' <p class="">' + TotalPriceData.PRODUCTS_PRICE_DISPLAY + ' <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p>'; html += ' </div>'; html += ' '; html += ' <div class="my-order_delivery">'; html += ' <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_PRODUCTS_DISCOUNT_'.$cur_lang)?></p>'; html += ' <p class="">' + TotalPriceData.PRODUCTS_DISCOUNT_DISPLAY + ' <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p>'; html += ' </div>'; html += ' '; html += ''; html += ' <div class="my-order_delivery">'; html += ' <p class="delivery_name"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_DELIVERY_PRICES_TITLE_'.$cur_lang)?></p>'; html += ' <p class="delivery_price">' + TotalPriceData.DELIVERY_PRICE_DISPLAY + ' <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p>'; html += ' </div>'; html += ''; html += ' <div class="my-order_summ">'; html += ' <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_TOTAL_BASE_PRICE_'.$cur_lang)?></p>'; html += ' <p class="summ_summ">' + TotalPriceData.SUM_BASE_DISPLAY + ' <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p>'; html += ' </div>'; html += ' <div class="my-order_summ">'; html += ' <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_TOTAL_POCUP_'.$cur_lang)?></p>'; html += ' <p class="summ_summ">' + TotalPriceData.SUM_DISPLAY + ' <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p>'; html += ' </div>'; $render_total_price.append(html); } $('body').on('click', 'input[name=pay_system_id]', function(e){ var checked_delivery = $('input[name=delivery_id]:checked').val(); var payment_id = e.target.value; if(checked_delivery != 46) { if (payment_id === "13") $('.payment-way_pay-btn').html('<?= Loc::getMessage('OPEN_BTN1_' . $cur_lang)?>'); else $('.payment-way_pay-btn').html('<?= Loc::getMessage('OPEN_BTN2_' . $cur_lang)?>'); } }); $('body').on('click', 'input[name=delivery_id]', function(e){ var id_delivery = e.target.value; if(id_delivery ==="46") { $('.btn-done-mess').css({ "display": "block" }); $('.payment-way_pay-btn').css({ "margin-bottom": "0px" }); $('.payment-way_pay-btn').html('<?= Loc::getMessage('OPEN_BTN3_'.$cur_lang)?>'); } else { $('.btn-done-mess').css({ "display": "none" }); $('.payment-way_pay-btn').css({ "margin-bottom": "213px" }); $('.payment-way_pay-btn').html('<?= Loc::getMessage('OPEN_BTN1_'.$cur_lang)?>'); } if(id_delivery == 52 || id_delivery == 48 || id_delivery == 49 || id_delivery == 50 || id_delivery == 46 || id_delivery == 51 || id_delivery == 55 || id_delivery == 57 || id_delivery == 56){ $('.make-an-order_adress').css({"display": "block"}); }else{ $('.make-an-order_adress').css({"display": "none"}); } $('span.warn_error').hide(); $deliveryBlock.find('.delivey-method_method input#method' + id_delivery).prop('checked', true); var formData = $('#os-order-form').serialize(); //console.log(formData); var query = { c: 'opensource:order', //action: 'calculateDeliveries', action: 'saveDeliveryOrder', mode: 'ajax' }; var request = $.ajax({ url: '/bitrix/services/main/ajax.php?' + $.param(query, true), type: 'POST', data: formData }); request.done(function (result) { var selectedDelivery = $deliveryBlock.find('input:checked'); var selectedDeliveryId = 0; if(selectedDelivery.length > 0) { selectedDeliveryId = selectedDelivery.val(); } result = changeDelivery(result); $deliveryBlock.html(''); $.each(result.data.DELIVERIES, function (i, deliveryData) { if($('#property_LOCATION').val().length == 0 && (deliveryData.ID == '48' || deliveryData.ID == '49' || deliveryData.ID == '50' || deliveryData.ID == '51' )){ deliveryData.PRICE = 0; } renderDeliveryS(deliveryData); }); $render_total_price.html(''); renderTotalPrice(result.data); if(selectedDeliveryId > 0) { $deliveryBlock.find('.delivey-method_method input#method' + selectedDeliveryId).prop('checked', true); } }); request.fail(function () { //// console.error('Can not get delivery data'); }); }); $locationSearch.change(function (event) { var locationCode = $(event.target).val(); if (locationCode.length > 0) { var formData = $('#os-order-form').serialize(); var selectedDelivery = $deliveryBlock.find('input:checked'); var delivery_id = ''; if(selectedDelivery.length > 0){} else{ delivery_id = '&delivery_id=3'; var selectedDelivery = $deliveryBlock.find('input#method3'); } if(selectedDelivery.length > 0){ var query = { c: 'opensource:order', //action: 'calculateDeliveries', action: 'saveDeliveryOrder', mode: 'ajax' }; var request = $.ajax({ url: '/bitrix/services/main/ajax.php?' + $.param(query, true)+delivery_id, type: 'POST', data: formData }); BX.showWait(); request.done(function (result) { var selectedDeliveryId = 0; if(selectedDelivery.length > 0) { selectedDeliveryId = selectedDelivery.val(); } BX.closeWait(); result = changeDelivery(result); $deliveryBlock.html(''); $.each(result.data.DELIVERIES, function (i, deliveryData) { if($('#property_LOCATION').val().length == 0 && (deliveryData.ID == '48' || deliveryData.ID == '49' || deliveryData.ID == '50' || deliveryData.ID == '51' )){ deliveryData.PRICE = 0; } renderDeliveryS(deliveryData); }); $render_total_price.html(''); renderTotalPrice(result.data); if(selectedDeliveryId > 0) { $deliveryBlock.find('.delivey-method_method input#method' + selectedDeliveryId).prop('checked', true); } if(selectedDelivery in result.data.DELIVERIES == false){ $('#method46').click().delay( 500 ); } }); request.fail(function () { // console.error('Can not get delivery data'); }); } } }); $('body').on('input', '.location-search', function(event){ var locationCode = $(event.target).val(); if (locationCode.length > 0) { var formData = $('#os-order-form').serialize(); var selectedDelivery = $deliveryBlock.find('input:checked'); if(selectedDelivery.length > 0){} else{ var selectedDelivery = 3; } if(selectedDelivery.length > 0){ var query = { c: 'opensource:order', //action: 'calculateDeliveries', action: 'saveDeliveryOrder', mode: 'ajax' }; var request = $.ajax({ url: '/bitrix/services/main/ajax.php?' + $.param(query, true), type: 'POST', data: formData }); request.done(function (result) { var selectedDeliveryId = 0; if(selectedDelivery.length > 0) { selectedDeliveryId = selectedDelivery.val(); } result = changeDelivery(result); console.log(result.data.DELIVERIES); $deliveryBlock.html(''); $.each(result.data.DELIVERIES, function (i, deliveryData) { renderDeliveryS(deliveryData); }); $render_total_price.html(''); renderTotalPrice(result.data); if(selectedDeliveryId > 0) { $deliveryBlock.find('.delivey-method_method input#method' + selectedDeliveryId).prop('checked', true); } }); request.fail(function () { // console.error('Can not get delivery data'); }); } } }); $adressSearch.change(function (event) { var locationCode = $(event.target).val(); if (locationCode.length > 0) { var formData = $('#os-order-form').serialize(); // console.log(formData); var selectedDelivery = $deliveryBlock.find('input:checked'); if(selectedDelivery.length > 0){ var query = { c: 'opensource:order', //action: 'calculateDeliveries', action: 'saveDeliveryOrder', mode: 'ajax' }; var request = $.ajax({ url: '/bitrix/services/main/ajax.php?' + $.param(query, true), type: 'POST', data: formData }); request.done(function (result) { var selectedDeliveryId = 0; if(selectedDelivery.length > 0) { selectedDeliveryId = selectedDelivery.val(); } result = changeDelivery(result); $deliveryBlock.html(''); $.each(result.data.DELIVERIES, function (i, deliveryData) { renderDeliveryS(deliveryData); }); $render_total_price.html(''); renderTotalPrice(result.data); if(selectedDeliveryId > 0) { $deliveryBlock.find('.delivey-method_method input#method' + selectedDeliveryId).prop('checked', true); } }); request.fail(function () { // console.error('Can not get delivery data'); }); } } }); }); </script> <form action="" method="post" name="os-order-form" id="os-order-form"> <main class="make-an-order-main"> <div class="make-an-order"> <div class="wrapper"> <h2 class="make-an-order_title"><?= Loc::getMessage('ORDER_OFORM_'.$cur_lang)?></h2> <div class="make-an-order_status"> <p class="status_active"><?= Loc::getMessage('OPEN_MESS4_'.$cur_lang)?></p> <p><?= Loc::getMessage('ORDER_PAY_'.$cur_lang)?></p> <p><?= Loc::getMessage('ORDER_CONF_'.$cur_lang)?></p> </div> <div class="make-an-order_my-data"> <? if($component->errorCollection->getErrorByCode('user_reg_error')){?> <div class="warn_error" style="margin-bottom: 15px; color: red">* <?= $component->errorCollection->getErrorByCode('user_reg_error')->getMessage()?></div> <?}?> <?if($USER->IsAuthorized()){?> <div class="warn_error" style="margin-bottom: 15px;">* <?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_FIELD_PROFILE_'.$cur_lang)?></div> <?}?> <?if(!$USER->IsAuthorized()){?> <div class="user-type"> <div class="user-type-url-fiz <?if($_GET['type'] != 'ur' || !$_GET['type']) echo ' user-type-select'?>"><a href="/personal/order/make/"><?= Loc::getMessage('ORDER_UDER_TYPE_FIZ_'.$cur_lang)?></a></div> <div class="user-type-url-ur <?if($_GET['type'] == 'ur') echo ' user-type-select'?>"><a href="/personal/order/make/?type=ur"><?= Loc::getMessage('ORDER_UDER_TYPE_UR_'.$cur_lang)?></a></div> </div> <?}?> <div class="my-data_header"> <p class="my-data_title"><?= Loc::getMessage('ORDER_PERS_DAN_'.$cur_lang)?></p> <p class="my-data_hint"><span>*</span> - <?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_FIELD_REQUIRED_'.$cur_lang)?> </p> </div> <div class="my-data_inputs"> <input type="hidden" name="person_type_id" value="<?=$arParams['PERSON_TYPE_ID']?>"> <h2><?//= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_PROPERTIES_TITLE')?></h2> <? $array_user_field = ['property_FIO', 'property_EMAIL', 'property_PHONE','property_NAME_COMPANY','property_INN','property_CONTACT_PERSON','property_ZAKAZ_QR','property_ZAKAZ_TRACK']; $text_QR_code = "all-green_zakaz" . rand(); $text_TRACK_code = random_number(); ?> <?php foreach ($arResult['PROPERTIES'] as $propCode => $arProp): ?> <?if(in_array($arProp['FORM_LABEL'], $array_user_field)){?> <div class="my-data_groupbox"> <p class="my-data_input-title" <?if($arProp['FORM_LABEL'] ==="property_ZAKAZ_QR" ||$arProp['FORM_LABEL'] ==="property_ZAKAZ_TRACK" ) echo 'style="display:none;"';?>> <?= $arProp['NAME'] ?> <?if($arProp["IS_REQUIRED"] ==1){?><span>*</span><?}?> </p> <?if(count($arProp['ERRORS']) > 0){ ?> <span class="error"><?=$arProp['NAME'].' '. Loc::getMessage('ORDER_ERROR_PROP_'.$cur_lang);//= $error->getMessage() ?></span> <?} ?> <?php switch ($arProp['TYPE']): case 'LOCATION': ?> <div class="location"> <select class="location-search" name="<?= $arProp['FORM_NAME'] ?>" id="<?= $arProp['FORM_LABEL'] ?>"> <option data-data='<?echo Json::encode($arProp['LOCATION_DATA'])?>' value="<?= $arProp['VALUE'] ?>"><?=$arProp['LOCATION_DATA']['label']?></option> </select> </div> <? break; case 'ENUM': foreach ($arProp['OPTIONS'] as $code => $name):?> <label class="enum-option"> <input type="radio" name="<?= $arProp['FORM_NAME'] ?>" value="<?= $code ?>"> <?= $name ?> </label> <?endforeach; break; case 'DATE': $APPLICATION->IncludeComponent( 'bitrix:main.calendar', '', [ 'SHOW_INPUT' => 'Y', 'FORM_NAME' => 'os-order-form', 'INPUT_NAME' => $arProp['FORM_NAME'], 'INPUT_VALUE' => $arProp['VALUE'], 'SHOW_TIME' => 'Y', //'HIDE_TIMEBAR' => 'Y', 'INPUT_ADDITIONAL_ATTR' => 'placeholder="выберите дату"' ] ); break; case 'Y/N': ?> <input id="<?= $arProp['FORM_LABEL'] ?>" type="checkbox" name="<?= $arProp['FORM_NAME'] ?>" value="Y"> <? break; default: ?> <input id="<?= $arProp['FORM_LABEL'] ?>" <?if($arProp['FORM_LABEL'] ==="property_ZAKAZ_QR"||$arProp['FORM_LABEL'] ==="property_ZAKAZ_TRACK") echo 'style="display:none;"';?> type="text" name="<?= $arProp['FORM_NAME'] ?>" class="my-data_input" value="<? if($arProp['FORM_LABEL'] ==="property_ZAKAZ_QR"){echo $text_QR_code;} elseif($arProp['FORM_LABEL'] ==="property_ZAKAZ_TRACK"){echo $text_TRACK_code;} else echo $arProp['VALUE']; ?>"> <? endswitch; ?> </div> <?}?> <? endforeach; ?> <?if(!$USER->IsAuthorized()){?> <div class="my-data_checkbox reg_user_n"> <input type="checkbox" id="property_reg_yes" name="properties[reg_yes]"> <label for="property_reg_yes"><?= Loc::getMessage('ORDER_REGISTRATION_'.$cur_lang)?></label> </div> <?}?> </div> </div> <? foreach ($arResult['DELIVERY_ERRORS'] as $error): ?> <div class="error"><?= $error->getMessage() ?></div> <? endforeach;?> <div class="make-an-order_delivey-method"> <h2 class="delivey-method_header"><?= Loc::getMessage('ORDER_SPOSOB_DOST_'.$cur_lang)?></h2> <span class="warn_error"></span> <div class="delivey-method_methods"> <? $i = 0; if($arResult['DELIVERY_LIST'][48] || $arResult['DELIVERY_LIST'][49] || $arResult['DELIVERY_LIST'][50] || $arResult['DELIVERY_LIST'][51]) unset($arResult['DELIVERY_LIST'][46]); //Удаляем по согласованию если есть шиптор foreach ($arResult['DELIVERY_LIST'] as $arDelivery):?> <div class="delivey-method_method"> <input type="radio" name="delivery_id" id="method<?= $arDelivery['ID'] ?>" <?= $arDelivery['CHECKED'] ? 'checked' : '' ?> <?if($arDelivery['ID'] == $checkedDeliveryId) echo 'checked'?> value="<?= $arDelivery['ID'] ?>"> <label for="method<?= $arDelivery['ID'] ?>"> <?= $arDelivery['NAME'] ?> </label> <p class="method_desc"> <?= $arDelivery['DESCRIPTION'] ?> </p> </div> <? $i++; endforeach; ?> </div> <div class="paymet-desc"> <span><?=Loc::getMessage('DEL_DESCR1_'.$cur_lang);?></span> <p class="method_desc"> <span><?=Loc::getMessage('DEL_DESCR2_'.$cur_lang);?></span> </p> </div> </div> <div style="display: none" class="make-an-order_adress"> <div class="adress_line1"> <? $array_location_user = array('property_LOCATION'); foreach ($arResult['PROPERTIES'] as $propCode => $arProp): ?> <?if(in_array($arProp['FORM_LABEL'], $array_location_user)){?> <? foreach ($arProp['ERRORS'] as $error): ?> <span class="error"><?= $error->getMessage() ?></span> <? endforeach; ?> <?php switch ($arProp['TYPE']): case 'LOCATION': ?> <div class="location adress_groupbox"> <p class="adress_input_title"><?= Loc::getMessage('ORDER_GOROD_'.$cur_lang)?> <span>*</span> </p> <select class="location-search" name="<?= $arProp['FORM_NAME'] ?>" id="<?= $arProp['FORM_LABEL'] ?>"> <option data-data='<?echo Json::encode($arProp['LOCATION_DATA'])?>' value="<?//= $arProp['VALUE'] ?>"><?//=$arProp['LOCATION_DATA']['label']?></option> </select> </div> <? break;?> <? endswitch; } endforeach; ?> <? $address_user_field = array('property_DATE_DELIVERY','property_TIME_DELIVERY'); ?> <?php foreach ($arResult['PROPERTIES'] as $propCode => $arProp): ?> <?if(in_array($arProp['FORM_LABEL'], $address_user_field)){?> <? foreach ($arProp['ERRORS'] as $error): ?> <span style="" class="error form_data_correct"><?= $error->getMessage() ?></span> <? endforeach; ?> <div class="adress_groupbox"> <p class="adress_input_title"><?= $arProp['NAME'] ?> <span>*</span></p> <?if( $arProp['FORM_LABEL'] === 'property_TIME_DELIVERY') {?> <div style="width: 130px;"> <?}?> <input id="<?= $arProp['FORM_LABEL'] ?>" type="text" name="<?= $arProp['FORM_NAME'] ?>" class="my-data_input" value="<?= $arProp['VALUE'] ?>"> <?if( $arProp['FORM_LABEL'] === 'property_TIME_DELIVERY') {?> </div> <?}?> </div> <?}?> <? endforeach; ?> </div> <div class="adress_line2"> <? $address_user_field = array('property_ADDRESS','property_ZIP'); ?> <? $iy = 1; foreach ($arResult['PROPERTIES'] as $propCode => $arProp): ?> <?if(in_array($arProp['FORM_LABEL'], $address_user_field)){?> <?if(count($arProp['ERRORS']) > 0){//foreach ($arProp['ERRORS'] as $error): ?> <span style="position: absolute;<?if($iy == 1) {echo 'right: 60%;';$iy = 2;} else if($iy > 1) {echo 'right: 22%;';}?>" class="error"><?=$arProp['NAME'].' '. Loc::getMessage('ORDER_ERROR_PROP_'.$cur_lang);//= $error->getMessage() ?></span> <?} //endforeach; ?> <div class="adress_groupbox"> <p class="adress_input_title"><?if($arProp['FORM_LABEL'] === 'property_ADDRESS') echo Loc::getMessage('ORDER_ADR_DOST_'.$cur_lang); else echo Loc::getMessage('ORDER_ZIP_'.$cur_lang);?> <span>*</span></p> <input id="<?= $arProp['FORM_LABEL'] ?>" type="text" name="<?= $arProp['FORM_NAME'] ?>" <?if( $arProp['FORM_LABEL'] === 'property_ADDRESS') {?>placeholder="<?= Loc::getMessage('ORDER_GOROD_PLAC_'.$cur_lang)?>"<?}else{?>placeholder="<?= Loc::getMessage('ORDER_ZIP_'.$cur_lang)?>"<?}?> class="my-data_input" value="<?if( $arProp['FORM_LABEL'] === 'property_ZIP'){ echo $arProp['VALUE'];} else echo $arProp['VALUE']; ?>"> </div> <?}?> <? endforeach; ?> </div> </div> <div class="make-an-order_payment-way"> <h2 class="payment-way_title"> <?= Loc::getMessage('ORDER_PAY_MESS_'.$cur_lang)?> </h2> <? foreach ($arResult['PAY_SYSTEM_ERRORS'] as $error): ?> <div class="error"><?= $error->getMessage() ?></div> <? endforeach; $i = 8; ?> <div style="display: grid;grid-template-columns: repeat(2, min-content);column-gap: 41px;"> <? foreach ($arResult['PAY_SYSTEM_LIST'] as $arPaySystem): ?> <div class="payment-way_way"> <input type="radio" name="pay_system_id" id="way<?=$i?>" value="<?= $arPaySystem['ID'] ?>"> <label for="way<?=$i?>"><?= $arPaySystem['NAME'] ?></label> <p class="way_description"> <?= $arPaySystem['DESCRIPTION'] ?> </p> <?//= $arPaySystem['NAME'] ?> </div> <? $i++; endforeach; ?> </div> <button class="payment-way_pay-btn manager" type="submit"><?= Loc::getMessage('ORDER_PAY_NEXT_'.$cur_lang)?></button> <div class="btn-done-mess"><?= Loc::getMessage('btn-done-mess_'.$cur_lang)?></div> </div> <div class="make-an-order_my-order"> <div class="my-order_header"> <h2 class="my-order-title"><?= Loc::getMessage('ORDER_MESS1_'.$cur_lang)?></h2> </div> <div class="my-order_main"> <? foreach ($arResult['BASKET'] as $arBasketItem): ?> <? CModule::IncludeModule("iblock"); ?> <div class="my-order_product"> <p class="product_name"> <?= $arBasketItem['NAME'] ?>, <? if (!empty($arBasketItem['PROPERTIES'])): ?> <? foreach ($arBasketItem['PROPERTIES'] as $arProp): ?> <?= $arProp['NAME'] ?> <?= $arProp['VALUE'] ?> <? endforeach; ?> <? endif; ?> <?$name_quan = num_word($arBasketItem['QUANTITY'], array('коробка', 'коробки', 'коробок')); ?> <?= $name_quan?> </p> <p class="product_price"><?= $arBasketItem['SUM'] ?> <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p> </div> <? endforeach; ?> <div class="render_total_price"> <div class="my-order_delivery"> <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_PRODUCTS_BASE_PRICE_'.$cur_lang)?></p> <p class=""> <?= $arResult['PRODUCTS_BASE_PRICE'] ?> <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p> </div> <div class="my-order_delivery"> <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_PRODUCTS_PRICE_'.$cur_lang)?></p> <p class=""><?= $arResult['PRODUCTS_PRICE'] ?> <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p> </div> <div class="my-order_delivery"> <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_PRODUCTS_DISCOUNT_'.$cur_lang)?></p> <p class=""><?= $arResult['PRODUCTS_DISCOUNT'] ?> <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p> </div> <div class="my-order_delivery"> <p class="delivery_name"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_DELIVERY_PRICES_TITLE_'.$cur_lang)?></p> <p class="delivery_price"><?= $arResult['DELIVERY_PRICE'] ?> <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p> </div> <div class="my-order_summ"> <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_TOTAL_BASE_PRICE_'.$cur_lang)?></p> <p class="summ_summ"><?= $arResult['SUM_BASE'] ?> <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p> </div> <div class="my-order_summ"> <p class="summ_text"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_TOTAL_POCUP_'.$cur_lang)?></p> <p class="summ_summ"><?= $arResult['SUM'] ?> <?= Loc::getMessage('ORDER_VALUTE_'.$cur_lang)?></p> </div> </div> </div> </div> </div> </div> </main> <input type="hidden" name="save" value="y"> </form>
Файл init.php (содержит функции random_number() и function num_word() ) и /include/preloader.php поместил в архив
Скачать файлы оформления заказа
Далее уже создаем файл done.php
<?php use Bitrix\Main\Error; use Bitrix\Main\Localization\Loc; use Bitrix\Sale\Order; use Bitrix\Sale; if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } /** @var array $arParams */ /** @var array $arResult */ /** @global CMain $APPLICATION */ /** @global CUser $USER */ /** @global CDatabase $DB */ /** @var CBitrixComponentTemplate $this */ /** @var string $templateName */ /** @var string $templateFile */ /** @var string $templateFolder */ /** @var string $componentPath */ /** @var OpenSourceOrderComponent $component */ $cur_lang = $_SESSION["LANG_UI"]; ?> <main class="make-an-order-main order_success-blk"> <div class="make-an-order order_success-wrap"> <div class="wrapper"> <h2 class="make-an-order_title"><?= Loc::getMessage('ORDER_OFORM_'.$cur_lang)?></h2> <div class="make-an-order_status"> <p><?= Loc::getMessage('OPEN_MESS4_'.$cur_lang)?></p> <p class="<?if($arResult['PAY_SYSTEM_ID'] != 13) echo 'status_active'?>"><?= Loc::getMessage('ORDER_PAY_'.$cur_lang)?></p> <p class="<?if($arResult['PAY_SYSTEM_ID'] == 13) echo 'status_active'?>"><?= Loc::getMessage('ORDER_CONF_'.$cur_lang)?></p> </div> <div class="order_success"> <h2 class="success_title"><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_ORDER_CREATED_'.$cur_lang, [ '#ORDER_ID#' => $arResult['ID'], '#TRACK_ID#' => $arResult['PROPERTIES']['ZAKAZ_TRACK']['VALUE'] ]) ?></h2> <? if($arResult['PAY_SYSTEM_ID'] != 13) { $orderObj = Sale\Order::load($arResult['ID']); $paymentCollection = $orderObj->getPaymentCollection(); $payment = $paymentCollection[0]; $service = Sale\PaySystem\Manager::getObjectById($payment->getPaymentSystemId()); $context = \Bitrix\Main\Application::getInstance()->getContext(); $service->initiatePay($payment, $context->getRequest()); }else{ ?> <div class="pdf"> <a target="_blank" href="/personal/order/payment/?ORDER_ID=<?=$arResult['ID']?>&pdf=Y"><?= Loc::getMessage('ORDER_PDF_'.$cur_lang)?></a> </div> <? } ?> </div> </div> </div> </main> <? if (!empty($arResult['ORDER']["PAYMENT_ID"])): ?> <?=Loc::getMessage("SOA_PAYMENT_SUC", array( "#PAYMENT_ID#" => $arResult['PAYMENT'][$arResult['ORDER']["PAYMENT_ID"]]['ACCOUNT_NUMBER'] ))?> <? endif ?>
Также необходим файл script.js
$(document).ready(function () { $('.location-search').selectize({ valueField: 'code', labelField: 'label', searchField: 'label', create: false, render: { option: function (item, escape) { return '<div class="title">' + escape(item.label) + '</div>'; } }, load: function (q, callback) { if (!q.length) return callback(); var query = { c: 'opensource:order', action: 'searchLocation', mode: 'ajax', q: q }; $.ajax({ url: '/bitrix/services/main/ajax.php?' + $.param(query, true), type: 'GET', error: function () { callback(); }, success: function (res) { if (res.status === 'success') { callback(res.data); } else { console.log(res.errors); callback(); } } }); } }); });
И нужны стили, файл style.css.
.reg_user_n{ margin-bottom: 5px; padding-bottom: 10px; } .os-order { } .os-order .error { color: #a40000; padding-bottom: 5px; } .os-order .basket-properties { color: #919191; } .os-order table { border-collapse: collapse; } .os-order table th { background: #DFDFDF; padding: 5px; border: 1px solid #c9c9c9; } .os-order table td { padding: 5px; border: 1px solid #DFDFDF; } .os-order .location { /* min-width: 400px;*/ } .enum-option { display:block; } .warn_error{ color:green; display: block; padding-bottom: 10px; } @media(min-width: 800px){ .form_data_correct{ max-width: 152px; } } .form_data_correct{ padding: 18px 10px 0px 10px; } @media (max-width: 570px){ .adress_line2 span.error{ position: initial !important; } } .user-type{ padding: 0px 0 100px 0; width: fit-content; } .user-type-url-fiz, .user-type-url-ur{ border: 1px solid #6FA036; font-size: 18px; font-family: "OpiumNewC" !important; font-weight: 500 !important; padding: 10px; } .user-type-url-fiz{ float: left; } .user-type-url-ur{ margin-left: 8px; float: right; } .user-type-select{ background: #61A036; } .user-type-select a{ color: #ffffff; } @media (max-width: 760px){ .user-type{ width: auto; } } .pdf{ padding: 15px 30px; font-size: 14px; line-height: 13px; font-family: "OpiumNewC" !important; font-weight: 500 !important; color: white !important; background: #61A036; border-radius: 7px; display: block; width: fit-content; margin: 45px 0; } .pdf a{ color: white !important; } .paymet-desc{ position: relative; position: relative; line-height: 176.68%; } .paymet-desc span{ font-family: OpiumNewC; font-size: 14px; white-space: pre-wrap; background-color: rgb(255, 255, 255); } .paymet-desc p span{ color: #77828D !important; font-family: OpiumNewC; font-size: 13px; white-space: pre-wrap; background-color: rgb(255, 255, 255); } .btn-done-mess{ display: none; margin: 20px 0 213px 0; text-align: center; } @media(max-width: 450px){ .my-order_product p, .my-order_delivery p, .my-order_summ p{ font-size: 3.075vw !important; } } @media (max-width: 360px){ .user-type-url-fiz, .user-type-url-ur{ padding:6px; } .user-type-url-ur { margin-left: 5px; float: right; } .user-type-url-fiz a, .user-type-url-ur a { font-size: 15px; } } @media(max-width: 1500px) { .my-data_header { align-items: flex-start!important; width: 50% !important; flex-direction: column !important; } .my-data_title { margin-bottom: 30px; } }
В папке /lang/ru/ добавим языковой файл template.php
<?php $MESS['ORDER_VALUTE_ru'] = 'р.'; $MESS['ORDER_VALUTE_en'] = 'rub.'; $MESS['ORDER_OFORM_ru'] = 'Оформление заказа'; $MESS['ORDER_OFORM_en'] = 'Making an order'; $MESS['ORDER_PAY_ru'] = 'Оплата'; $MESS['ORDER_PAY_en'] = 'Payment'; $MESS['ORDER_CONF_ru'] = 'Подверждение'; $MESS['ORDER_CONF_en'] = 'Confirmation'; $MESS['ORDER_PERS_DAN_ru'] = 'Ваши данные'; $MESS['ORDER_PERS_DAN_en'] = 'Your data'; $MESS['ORDER_PDF_ru'] = 'Скачать счет в формате Pdf'; $MESS['ORDER_PDF_en'] = 'Download the invoice in Pdf format'; $MESS['OPEN_SOURCE_ORDER_TEMPLATE_FIELD_REQUIRED_ru'] = 'поля обязательные для заполнения'; $MESS['OPEN_SOURCE_ORDER_TEMPLATE_FIELD_REQUIRED_en'] = 'this field is required'; $MESS['OPEN_SOURCE_ORDER_TEMPLATE_FIELD_PROFILE_ru'] = 'Данные были заполнены автоматически из профиля пользователя'; $MESS['OPEN_SOURCE_ORDER_TEMPLATE_FIELD_PROFILE_en'] = 'The data was filled in automatically from the user profile'; $MESS['ORDER_UDER_TYPE_UR_ru'] = 'Юр. лицо'; $MESS['ORDER_UDER_TYPE_UR_en'] = 'Corporate body'; $MESS['ORDER_UDER_TYPE_FIZ_ru'] = 'Физ. лицо'; $MESS['ORDER_UDER_TYPE_FIZ_en'] = 'Private person'; $MESS['ORDER_REGISTRATION_ru'] = 'Зарегистрироваться как новый пользователь'; $MESS['ORDER_REGISTRATION_en'] = 'Register as a new user'; $MESS['ORDER_SPOSOB_DOST_ru'] = 'Способ доставки'; $MESS['ORDER_SPOSOB_DOST_en'] = 'Delivery method'; $MESS['ORDER_GOROD_ru'] = 'Город доставки (нас. пункт)'; $MESS['ORDER_GOROD_en'] = 'Delivery city (us. point)'; $MESS['ORDER_ADR_DOST_ru'] = 'Адрес доставки'; $MESS['ORDER_ADR_DOST_en'] = 'Delivery Address'; $MESS['ORDER_GOROD_PLAC_ru'] = 'Название улицы, номер дома, (корпус), номер квартиры или офиса'; $MESS['ORDER_GOROD_PLAC_en'] = 'Street name, house number, (building), apartment or office number'; $MESS['ORDER_ZIP_ru'] = 'Индекс'; $MESS['ORDER_ZIP_en'] = 'Postal code'; $MESS['ORDER_PAY_MESS_ru'] = 'Способ оплаты'; $MESS['ORDER_PAY_MESS_en'] = 'Payment method'; $MESS['ORDER_PAY_NEXT_ru'] = 'Перейти к оплате'; $MESS['ORDER_PAY_NEXT_en'] = 'Proceed to payment'; $MESS['ORDER_MESS1_ru'] = 'Ваш заказ'; ?>
На этом все, успехов в освоении !
Комментарии находятся на модерации или не добавлены.
Для добавления комментариев необходимо зарегистрироваться и авторизоваться
Также возможно авторизоваться через Социальную сеть Вконтакте (VK)