-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmoysklad_customer_order.php
63 lines (53 loc) · 2.03 KB
/
moysklad_customer_order.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/*
//Tell cURL that we want to carry out a POST request.
curl_setopt($curl, CURLOPT_POST, true);
//Set our post fields / date (from the array above).
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postValues));
*/
error_reporting(E_ALL);
require_once 'moysklad_routine_library.php';
$api = 'https://online.moysklad.ru/api/remap/1.1';
$curl = getCurl();
$curl = setCurl($curl, "$api/entity/organization", 'GET');
$persons = getJuridicalPerson($curl);
$curl = setCurl($curl, "$api/entity/counterparty", 'GET');
$counterparty = getCounterparty($curl);
$curl = setCurl($curl, "$api/entity/product", 'GET');
$nomenclature = getNomenclature($curl);
?>
<form id="order-form">
<p>Доступные юридические лица:<br/>
<?php
foreach ($persons as $key => $person) {
$personId = $person['id'];
echo '<label for="' . $personId . '">' . $person['name']
. '</label>
<input type="radio" data-organization-type="1" id="'
. $personId . '" name="organization"><br />';
}
echo 'Доступные контрагенты:<br />';
foreach ($counterparty as $key => $person) {
$personId = $person['id'];
echo '<label for="' . $personId . '">'
. $person['name']
. '</label><input type="radio" data-counterparty-type="1" id="'
. $personId . '" name="counterparty"><br />';
}
echo 'Номенклатура товаров:<br />';
foreach ($nomenclature as $key => $position) {
$positionId = $position['id'];
echo '<label for="' . $positionId . '">' . $position['name']
. ', количество для заказа => </label><input type="text"'
. ' id="' . $positionId . '" data-position-type="1"><br />';
}
?>
<input id="send" type="submit"
name="Сформировать заказ покупателя">
<br/>
</p>
</form>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript" src="/send-order.js"></script>