From 5188a1f07575b91bf895c66381c3a1ec856ba6d8 Mon Sep 17 00:00:00 2001 From: nikolays93 Date: Mon, 30 Mar 2020 12:35:36 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B5=D1=80=D0=B6=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=82=D0=B8=D0=BF=D0=B0=20=D1=81=D0=B2=D0=BE=D0=B9?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=B0=20"=D0=A4=D0=B0=D0=B9=D0=BB"=20(resolv?= =?UTF-8?q?e=20#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install/components/opensource/order/class.php | 22 ++++++++++++++++++- .../order/templates/.default/form.php | 10 ++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/install/components/opensource/order/class.php b/install/components/opensource/order/class.php index ebf26b4..f6c57b1 100644 --- a/install/components/opensource/order/class.php +++ b/install/components/opensource/order/class.php @@ -133,6 +133,26 @@ public function createVirtualOrder(int $personTypeId) return $this->order; } + public function getPropertiesFromRequest() + { + $properties = $this->request['properties'] ?? []; + $arFileProperties = $this->request->getFileList()->get('properties'); + + if (is_array($arFileProperties)) { + foreach ($arFileProperties as $fileKey => $arFileField) { + foreach ($arFileField as $fieldCode => $arFileFieldValue) { + if( ! isset($properties[$fieldCode])) { + $properties[$fieldCode] = array("ID" => ''); + } + // @todo Multiple property + $properties[$fieldCode][$fileKey] = current($arFileFieldValue); + } + } + } + + return $properties; + } + /** * @param array $propertyValues * @throws Exception @@ -374,7 +394,7 @@ public function executeComponent() try { $this->createVirtualOrder($this->arParams['PERSON_TYPE_ID']); - $propertiesList = $this->request['properties'] ?? $this->arParams['DEFAULT_PROPERTIES'] ?? []; + $propertiesList = $this->getPropertiesFromRequest() ?: $this->arParams['DEFAULT_PROPERTIES'] ?? []; if (!empty($propertiesList)) { $this->setOrderProperties($propertiesList); } diff --git a/install/components/opensource/order/templates/.default/form.php b/install/components/opensource/order/templates/.default/form.php index ee96e5d..ba6595b 100644 --- a/install/components/opensource/order/templates/.default/form.php +++ b/install/components/opensource/order/templates/.default/form.php @@ -19,7 +19,7 @@ /** @var OpenSourceOrderComponent $component */ ?> -
+ @@ -90,6 +90,14 @@ + +