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
22 changes: 21 additions & 1 deletion install/components/opensource/order/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
10 changes: 9 additions & 1 deletion install/components/opensource/order/templates/.default/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/** @var OpenSourceOrderComponent $component */

?>
<form action="" method="post" name="os-order-form" id="os-order-form">
<form action="" method="post" name="os-order-form" id="os-order-form" enctype="multipart/form-data">

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

Expand Down Expand Up @@ -90,6 +90,14 @@
<?
break;

case 'FILE':
?>
<input id="<?= $arProp['FORM_LABEL'] ?>" type="file"
name="<?= $arProp['FORM_NAME'] ?>"
value="<?= $arProp['VALUE'] ?>">
<?
break;

default:
?>
<input id="<?= $arProp['FORM_LABEL'] ?>" type="text"
Expand Down