public static function getPropertyDescription($propertyCode, $propertyParams = array()) { $propertyCode = (string) $propertyCode; if ($propertyCode === '') { return false; } if (!is_array($propertyParams)) { $propertyParams = array(); } switch ($propertyCode) { case self::CODE_MORE_PHOTO: $propertyDescription = array('PROPERTY_TYPE' => PropertyTable::TYPE_FILE, 'USER_TYPE' => null, 'NAME' => loc::getMessage('IBPT_PROP_TITLE_MORE_PHOTO'), 'CODE' => self::CODE_MORE_PHOTO, 'MULTIPLE' => 'Y', 'FILE_TYPE' => 'jpg, gif, bmp, png, jpeg', 'ACTIVE' => 'Y'); break; case self::CODE_SKU_LINK: $propertyDescription = array('PROPERTY_TYPE' => PropertyTable::TYPE_ELEMENT, 'USER_TYPE' => self::USER_TYPE_SKU_LINK, 'NAME' => Loc::getMessage('IBPT_PROP_TITLE_SKU_LINK'), 'CODE' => self::CODE_SKU_LINK, 'XML_ID' => self::XML_SKU_LINK, 'MULTIPLE' => 'N', 'ACTIVE' => 'Y'); if (isset($propertyParams['LINK_IBLOCK_ID'])) { $propertyDescription['LINK_IBLOCK_ID'] = (int) $propertyParams['LINK_IBLOCK_ID']; } if (isset($propertyParams['USER_TYPE_SETTINGS'])) { $propertyDescription['USER_TYPE_SETTINGS'] = $propertyParams['USER_TYPE_SETTINGS']; } break; case self::CODE_BLOG_POST: $propertyDescription = array('PROPERTY_TYPE' => PropertyTable::TYPE_NUMBER, 'USER_TYPE' => null, 'NAME' => Loc::getMessage('IBPT_PROP_TITLE_BLOG_POST'), 'CODE' => self::CODE_BLOG_POST, 'MULTIPLE' => 'N', 'ACTIVE' => 'Y'); break; case self::CODE_BLOG_COMMENTS_COUNT: $propertyDescription = array('PROPERTY_TYPE' => PropertyTable::TYPE_NUMBER, 'USER_TYPE' => null, 'NAME' => Loc::getMessage('IBPT_PROP_TITLE_BLOG_COMMENTS_COUNT'), 'CODE' => self::CODE_BLOG_COMMENTS_COUNT, 'MULTIPLE' => 'N', 'ACTIVE' => 'Y'); break; default: $propertyDescription = false; break; } if ($propertyDescription !== false) { if (isset($propertyParams['NAME'])) { $propertyDescription['NAME'] = $propertyParams['NAME']; } if (isset($propertyParams['SORT'])) { $propertyDescription['SORT']; } if (isset($propertyParams['XML_ID']) && !isset($propertyDescription['XML_ID'])) { $propertyDescription['XML_ID'] = $propertyParams['XML_ID']; } } return $propertyDescription; }
$update = OrderPropsTable::update($propertyId, array_diff_key($propertyForDB, array('ID' => 1))); if ($update->isSuccess()) { $propertyCode = ($v = $property['CODE']) ? $v : false; $result = CSaleOrderPropsValue::GetList($b = 'ID', $o = 'ASC', array('ORDER_PROPS_ID' => $propertyId, '!CODE' => $propertyCode)); while ($row = $result->Fetch()) { CSaleOrderPropsValue::Update($row['ID'], array('CODE' => $propertyCode)); } } else { $errors[] = loc::getMessage('ERROR_EDIT_PROP') . ': ' . implode(', ', $update->getErrorMessages()); } } else { $insert = OrderPropsTable::add($propertyForDB); if ($insert->isSuccess()) { $propertyId = $property['ID'] = $insert->getId(); } else { $errors[] = loc::getMessage('ERROR_ADD_PROP') . ': ' . implode(', ', $insert->getErrorMessages()); } } // cleanup files if ($errors) { if (isset($savedFiles)) { $filesToDelete = $savedFiles; } } else { if ($existentProperty && $existentProperty['TYPE'] == 'FILE') { $filesToDelete = Input\File::asMultiple(Input\File::getValue($existentProperty, $existentProperty['DEFAULT_VALUE'])); if (isset($files)) { $filesToDelete = array_diff($filesToDelete, Input\File::asMultiple(Input\File::getValue($property, $files))); } } }
} $iblockID = COption::GetOptionInt(ADMIN_MODULE_NAME, 'IBLOCK_ID'); if ($iblockID) { $arProps = []; $propsOb = \Bitrix\Iblock\PropertyTable::getList(['filter' => ['IBLOCK_ID' => $iblockID, 'ACTIVE' => 'Y'], 'select' => ['NAME', 'CODE']]); while ($props = $propsOb->fetch()) { $arProps[$props['CODE']] = $props['NAME']; } } $obGroups = LotinfoFieldsToPropsTable::getList(['order' => ['ID' => 'ASC']]); $obGroups = new CAdminResult($obGroups, $listTableId); $obGroups->NavStart(); $adminList->NavText($obGroups->GetNavPrint("Разделы")); $colHeaders = [["id" => 'ID', "content" => 'ID', "sort" => 1, "default" => true], ["id" => 'LOTINFO_FIELD', "content" => Loc::getMessage("PROPS_EDIT_LOTINFO_FIELD"), "sort" => 2, "default" => true], ["id" => 'PROP_ID', "content" => Loc::getMessage('PROPS_EDIT_PROP_ID'), "sort" => 3, "default" => true], ["id" => 'FIELD_ID', "content" => Loc::getMessage('PROPS_EDIT_FIELD_ID'), "sort" => 3, "default" => true]]; $adminList->AddHeaders($colHeaders); $visibleHeaderColumns = $adminList->GetVisibleHeaderColumns(); $arUsersCache = []; while ($arRes = $obGroups->GetNext()) { $row =& $adminList->AddRow($arRes["ID"], $arRes); $arActions = [["ICON" => "delete", "TEXT" => "Удалить", "ACTION" => $adminList->ActionDoGroup($arRes["ID"], "delete")], ["ICON" => "edit", "TEXT" => "Редактировать", "ACTION" => $adminList->ActionRedirect("lotinfo_props_edit.php?ID=" . $arRes["ID"] . "&lang=" . LANGUAGE_ID), "DEFAULT" => true]]; $row->AddActions($arActions); } $adminList->AddFooter([["title" => "Всего", "value" => $obGroups->SelectedRowsCount()], ["counter" => true, "title" => "Отмечено", "value" => "0"]]); $adminList->AddGroupActionTable(["delete" => "Удалить"]); $aContext = [["TEXT" => GetMessage("MAIN_ADD"), "LINK" => "lotinfo_props_edit.php", "TITLE" => GetMessage("POST_ADD_TITLE"), "ICON" => "btn_new"]]; $adminList->AddAdminContextMenu($aContext); $adminList->CheckListMode(); $APPLICATION->SetTitle(loc::getMessage("PAGE_TITLE")); require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_after.php'; $adminList->DisplayList(); require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_admin.php';