Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions install/components/opensource/order/templates/.default/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<form action="" method="post" name="os-order-form" id="os-order-form">

<input type="hidden" name="person_type_id" value="<?=$arParams['PERSON_TYPE_ID']?>">
<input type="hidden" name="delivery_id" value="<?= $arParams['DEFAULT_DELIVERY_ID'] ?>">
<input type="hidden" name="pay_system_id" value="<?= $arParams['DEFAULT_PAY_SYSTEM_ID'] ?>">

<h2><?= Loc::getMessage('OPEN_SOURCE_ORDER_TEMPLATE_PROPERTIES_TITLE')?>:</h2>
<table>
Expand Down Expand Up @@ -99,8 +101,8 @@
/** @var Error $error */
?>
<div class="error"><?= $error->getMessage() ?></div>
<? endforeach;
foreach ($arResult['DELIVERY_LIST'] as $arDelivery):?>
<? endforeach; ?>
<? foreach ($arResult['DELIVERY_LIST'] as $arDelivery):?>
<label>
<input type="radio" name="delivery_id"
value="<?= $arDelivery['ID'] ?>"
Expand All @@ -117,8 +119,8 @@
/** @var Error $error */
?>
<div class="error"><?= $error->getMessage() ?></div>
<? endforeach;
foreach ($arResult['PAY_SYSTEM_LIST'] as $arPaySystem): ?>
<? endforeach; ?>
<? foreach ($arResult['PAY_SYSTEM_LIST'] as $arPaySystem): ?>
<label>
<input type="radio" name="pay_system_id"
value="<?= $arPaySystem['ID'] ?>"
Expand Down
28 changes: 26 additions & 2 deletions install/components/opensource/order/templates/.default/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
$(document).ready(function () {
$('.location-search').selectize({
jQuery(document).ready(function($) {
var $orderForm = $('[name="os-order-form"]'),
$location = $('.location-search', $orderForm);

$orderForm.on('submit', function(e) {
e.preventDefault();

var query = {
c: 'opensource:order',
action: 'saveOrder',
mode: 'ajax'
};

$.ajax({
url: '/bitrix/services/main/ajax.php?' + $.param(query, true),
type: 'POST',
dataType: 'json',
data: $orderForm.serialize(),
success: function (res) {
console.log(res)
alert('Check request results in console!');
}
});
});

$location.selectize({
valueField: 'code',
labelField: 'label',
searchField: 'label',
Expand Down