Advertisement
animdenis

Copy Photo to element

Sep 23rd, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. CModule::IncludeModule('iblock');
  2. $formId = 275;
  3. $toId = 853;
  4. $dbResFrom = CIBlockElement::GetList(array('name' => 'ASC'), array('IBLOCK_ID' => 5, 'ID' => $formId));
  5. if($obFrom = $dbResFrom->GetNext())
  6. {
  7.     $dbResTo = CIBlockElement::GetList(array('name' => 'ASC'), array('IBLOCK_ID' => 5, 'ID' => $toId));
  8.     if($obTo = $dbResTo->GetNext())
  9.     {
  10.         $arLoadProductArray = Array(
  11.             "DETAIL_PICTURE" => CFile::MakeFileArray(CFile::GetPath($obFrom['DETAIL_PICTURE'])),
  12.             "PREVIEW_PICTURE" => CFile::MakeFileArray(CFile::GetPath($obFrom['PREVIEW_PICTURE']))
  13.         );
  14.  
  15.         $el = new CIBlockElement;
  16.         $res = $el->Update($toId, $arLoadProductArray);
  17.  
  18.     }
  19. }
  20.  
  21. $VALUES = array();
  22. $res = CIBlockElement::GetProperty(5, $formId, "sort", "asc", array("CODE" => "MORE_PHOTO"));
  23. while ($ob = $res->GetNext())
  24. {
  25.     $VALUES[] = CFile::MakeFileArray(CFile::GetPath($ob['VALUE']));
  26. }
  27. CIBlockElement::SetPropertyValueCode($toId, "MORE_PHOTO", $VALUES);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement