->
where('blog.active = 1'
) ->
innerJoin('blog', 's_categories', 'cat', 'cat.id = blog.category_id'
) ->
andWhere('category_id IN (:ids)'
) ->
andWhere('cat.shops IS NULL OR cat.shops LIKE :shopLike'
) ->
andWhere('blog.shop_ids IS NULL OR blog.shop_ids LIKE :shopLike'
) ->
setParameter(':shopLike', '%|' .
$shopId . '|%'
) ->
setParameter('ids',
$blogIds, Connection::PARAM_INT_ARRAY
) ->
execute() ->
fetchAllAssociative();
$blogIds =
array_column($blogs, 'id'
);
$blogTranslations =
$this->
fetchTranslations($blogIds,
$shopContext);
foreach ($blogs as $key => &
$blog) { if (isset($blogTranslations[$blog['id'
]]) &&
empty($blogTranslations[$blog['id'
]]['active'
])) { unset($blogs[$key]);
continue;
} $blog['changed'
] =
new DateTime($blog['changed'
]);
$blog['urlParams'
] =
[ 'sViewport' => 'blog',
'sAction' => 'detail',