Попробовал вот так:
[QUOTE]CModule::IncludeModule('iblock');
$resource = CIBlockElement::GetByID(2171);
if ($ob = $resource->GetNextElement())
{
$arFields = $ob->GetFields();
$arFields['PROPERTIES'] = $ob->GetProperties();
$arFieldsCopy = $arFields;
$arFieldsCopy['PROPERTY_VALUES'] = array();
foreach ($arFields['PROPERTIES'] as $property) {
$arFieldsCopy['PROPERTY_VALUES'][$property['CODE']] = $property['VALUE'];
if ($arProp['PROPERTY_TYPE']=='L'){
if ($arProp['MULTIPLE']=='Y'){
$arFieldsCopy['PROPERTY_VALUES'][$arProp['CODE']] = array();
foreach($arProp['VALUE_ENUM_ID'] as $enumID){
$arFieldsCopy['PROPERTY_VALUES'][$arProp['CODE']][] = array(
'VALUE' => $enumID
);
}
} else {
$arFieldsCopy['PROPERTY_VALUES'][$arProp['CODE']] = array(
'VALUE' => $arProp['VALUE_ENUM_ID']
);
}
}
if ($property['PROPERTY_TYPE']=='F') {
if ($property['MULTIPLE']=='Y') {
if (is_array($property['VALUE']))
{
foreach ($property['VALUE'] as $key => $arElEnum)
$arFieldsCopy['PROPERTY_VALUES'][$property['CODE']][$key]=CFile::CopyFile($arElEnum);
}
} else
$arFieldsCopy['PROPERTY_VALUES'][$property['CODE']] = CFile::CopyFile($property['VALUE']);
}
}
$el = new CIBlockElement();
$NEW_ID = $el->Add($arFieldsCopy);
if(!$NEW_ID)
echo $el->LAST_ERROR;
else
echo 'Элемент скопирован. ID нового элемента: '.$NEW_ID;
}
[/QUOTE]
Выдаётся ошибка " Ошибка сохранения картинки для анонса."
[QUOTE]CModule::IncludeModule('iblock');
$resource = CIBlockElement::GetByID(2171);
if ($ob = $resource->GetNextElement())
{
$arFields = $ob->GetFields();
$arFields['PROPERTIES'] = $ob->GetProperties();
$arFieldsCopy = $arFields;
$arFieldsCopy['PROPERTY_VALUES'] = array();
foreach ($arFields['PROPERTIES'] as $property) {
$arFieldsCopy['PROPERTY_VALUES'][$property['CODE']] = $property['VALUE'];
if ($arProp['PROPERTY_TYPE']=='L'){
if ($arProp['MULTIPLE']=='Y'){
$arFieldsCopy['PROPERTY_VALUES'][$arProp['CODE']] = array();
foreach($arProp['VALUE_ENUM_ID'] as $enumID){
$arFieldsCopy['PROPERTY_VALUES'][$arProp['CODE']][] = array(
'VALUE' => $enumID
);
}
} else {
$arFieldsCopy['PROPERTY_VALUES'][$arProp['CODE']] = array(
'VALUE' => $arProp['VALUE_ENUM_ID']
);
}
}
if ($property['PROPERTY_TYPE']=='F') {
if ($property['MULTIPLE']=='Y') {
if (is_array($property['VALUE']))
{
foreach ($property['VALUE'] as $key => $arElEnum)
$arFieldsCopy['PROPERTY_VALUES'][$property['CODE']][$key]=CFile::CopyFile($arElEnum);
}
} else
$arFieldsCopy['PROPERTY_VALUES'][$property['CODE']] = CFile::CopyFile($property['VALUE']);
}
}
$el = new CIBlockElement();
$NEW_ID = $el->Add($arFieldsCopy);
if(!$NEW_ID)
echo $el->LAST_ERROR;
else
echo 'Элемент скопирован. ID нового элемента: '.$NEW_ID;
}
[/QUOTE]
Выдаётся ошибка " Ошибка сохранения картинки для анонса."