if (isset($PROP_del[$k1]) && is_array($PROP_del[$k1])) { foreach ($PROP_del[$k1] as $prop_value_id => $tmp) { if (!array_key_exists($prop_value_id, $PROP[$k1])) $PROP[$k1][$prop_value_id] = null; } } if (isset($PROP[$k1]) && is_array($PROP[$k1])) { foreach ($PROP[$k1] as $prop_value_id => $prop_value) { $PROP[$k1][$prop_value_id] = CIBlock::makeFilePropArray( $PROP[$k1][$prop_value_id], $PROP_del[$k1][$prop_value_id] === "Y", isset($_POST["DESCRIPTION_PROP"][$k1][$prop_value_id])? $_POST["DESCRIPTION_PROP"][$k1][$prop_value_id]: $_POST["PROP_descr"][$k1][$prop_value_id] ); } } } $DESCRIPTION_PROP = $_POST["DESCRIPTION_PROP"]; if(is_array($DESCRIPTION_PROP)) { foreach($DESCRIPTION_PROP as $k1=>$val1) { foreach($val1 as $k2=>$val2) { if(is_set($PROP[$k1], $k2) && is_array($PROP[$k1][$k2]) && is_set($PROP[$k1][$k2], "DESCRIPTION")) $PROP[$k1][$k2]["DESCRIPTION"] = $val2;
foreach($arFields as $k=>$v) { if( $k != "PROPERTY_VALUES" && strncmp($k, "PROPERTY_", 9) == 0 ) { $prop_id = substr($k, 9); if (isset($arFileProps[$prop_id])) { foreach ($v as $prop_value_id => $file) { $v[$prop_value_id] = CIBlock::makeFilePropArray( $v[$prop_value_id], $_REQUEST["FIELDS_del"][$TYPE.$ID][$k][$prop_value_id]["VALUE"] === "Y", $_REQUEST["FIELDS_descr"][$TYPE.$ID][$k][$prop_value_id] ); } } if(isset($_REQUEST["FIELDS_descr"][$TYPE.$ID][$k]) && is_array($_REQUEST["FIELDS_descr"][$TYPE.$ID][$k])) { foreach($_REQUEST["FIELDS_descr"][$TYPE.$ID][$k] as $PROPERTY_VALUE_ID => $ar) { if( is_array($ar) && isset($ar["VALUE"]) && isset($v[$PROPERTY_VALUE_ID]["VALUE"]) && is_array($v[$PROPERTY_VALUE_ID]["VALUE"]) )
} break; case 'DETAIL': $arIBlockElementAdd['DETAIL_PICTURE'] = CIBlock::makeFileArray($srcValue, false); if ($arIBlockElementAdd['DETAIL_PICTURE']['error'] == 0) { $arIBlockElementAdd['DETAIL_PICTURE']['COPY_FILE'] = 'Y'; } break; default: if (is_array($srcValue)) { $arPropertySaveValues[$srcKey] = array(); foreach ($srcValue as $fileID => $fileValue) { $arPropertySaveValues[$srcKey][$fileID] = CIBlock::makeFilePropArray($srcValue[$fileID], false); } } else { $arPropertySaveValues[$srcKey] = CIBlock::makeFilePropArray($srcValue, false); } break; } } } $arPropertySaveValues["CML2_LINK"] = $parentElement; $arIBlockElementAdd['PROPERTY_VALUES'] = $arPropertySaveValues; $sku = new \Bitrix\Iblock\Template\Entity\Element(0); $sku->setFields($arIBlockElementAdd); $arIBlockElementAdd["NAME"] = htmlspecialcharsback(\Bitrix\Iblock\Template\Engine::process($sku, $title)); unset($arIBlockElementAdd['PROPERTY_VALUES']["CML2_LINK"]); $idNewElement = $obIBlockElement->Add($arIBlockElementAdd, false, true, true); if ($idNewElement) { $productData['ID'] = $idNewElement; CCatalogProduct::Add($productData, false);