Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $marks = [];
- $types = [];
- foreach (BCatalogMark::model()->findAll() as $item) {
- $marks[$item['id']] = [
- 'id' => $item['id'],
- 'alias' => $item['alias']
- ];
- }
- foreach (BCatalogType::model()->findAll() as $item) {
- $types[$item['id']] = [
- 'id' => $item['id'],
- 'alias' => $item['alias']
- ];
- }
- foreach ($data['type'] as $match) {
- foreach ($types as $type) {
- foreach ($marks as $mark){
- if(
- in_array($mark['alias'], $alias) &&
- in_array($type['alias'], $alias) &&
- $type['id'] == $match['type'] &&
- in_array($mark['alias'], $match['marks'])
- ){
- //тут будет нужный тебе тип в $match, советую записывать их в массив и делать array_unique,
- // так как возможны повторы
- }
- }
- }
- //ПОМЕНЯЙ НА 6 строке на "array_push($alias, $item);"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement