Advertisement
animdenis

filte to pic

Oct 22nd, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. CModule::IncludeModule('iblock');
  2. //PARAMS
  3. $iblockId = 6;
  4. $propArticul = 'CML2_ARTICLE';
  5. $propPhoto = 'MORE_PHOTO';
  6. $baseDir = $_SERVER['DOCUMENT_ROOT'] . '/upload';
  7.  
  8. //ACTION
  9. $el = new CIblockElement;
  10. $rs = CIblockElement::GetList([],['IBLOCK_ID' => $iblockId], false, false, ['ID', 'IBLOCK_ID', 'PROPERTY_' . $propArticul]);
  11. while($ob = $rs->GetNext()){
  12.     $fileMask = $ob['PROPERTY_'] . $propArticul . '_VALUE';
  13.     if(!empty($fileMask)){
  14.         if($mainPic = glob("{$baseDir}/{$fileMask}.*")) {
  15.             //$mainPic
  16.             //$el->Update($ob['ID'], ['']);
  17.         }
  18.  
  19.         //MORE_PHOTO
  20.         $arMorePhotoFilesIds = [];
  21.         foreach(glob("{$baseDir}/{$fileMask}_*.*") as $docFile) {
  22.             //write files
  23.         }
  24.  
  25.         //CIblockElement::SetPropertyValueEx();
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement