COLLECTIONS Array foreach FILTER_PROPERTIES PROPERTIES as Property if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
$COLLECTIONS = Array();
foreach( $FILTER_PROPERTIES[ 'PROPERTIES' ] as $Property ){
if ( substr_count( mb_strtoupper( trim( $Property[ 'NAME' ] ) ) , 'КОЛЛЕКЦИЯ' ) ){
foreach( $Property[ 'VALUES' ] as $Value ){
if ( !is_array( $COLLECTIONS[ $Property[ 'ID' ] ] ) ){
$COLLECTIONS[ $Property[ 'ID' ] ] = Array();
}
$COLLECTIONS[ $Property[ 'ID' ] ][ $Value[ 'ID' ] ] = $Value[ 'VALUE' ];
}
}
}
$COLLECTION_NAME = '';
foreach( $val[ 'PROPERTIES' ] as $p ){
if ( $COLLECTIONS[ $p['PID'] ][ $p['VID'] ] ){
$COLLECTION_NAME = $COLLECTIONS[ $p['PID'] ][ $p['VID'] ];
break;
}
}