Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CModule::IncludeModule('iblock');
- //PARAMS
- $iblockId = 6;
- $propArticul = 'CML2_ARTICLE';
- $propPhoto = 'MORE_PHOTO';
- $baseDir = $_SERVER['DOCUMENT_ROOT'] . '/upload';
- //ACTION
- $el = new CIblockElement;
- $rs = CIblockElement::GetList([],['IBLOCK_ID' => $iblockId], false, false, ['ID', 'IBLOCK_ID', 'PROPERTY_' . $propArticul]);
- while($ob = $rs->GetNext()){
- $fileMask = $ob['PROPERTY_'] . $propArticul . '_VALUE';
- if(!empty($fileMask)){
- if($mainPic = glob("{$baseDir}/{$fileMask}.*")) {
- //$mainPic
- //$el->Update($ob['ID'], ['']);
- }
- //MORE_PHOTO
- $arMorePhotoFilesIds = [];
- foreach(glob("{$baseDir}/{$fileMask}_*.*") as $docFile) {
- //write files
- }
- //CIblockElement::SetPropertyValueEx();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement