'obj.category_id', 'type' => '=', 'value' => $category_id ); } $ingredient_ids = isset($_GET['ingredient']) ? $_GET['ingredient'] : null; if ($ingredient_ids) { $fields[] = array( 'name' => 'tb2.ingredient_id', 'type' => 'IN', 'value' => $ingredient_ids, 'is_having' => true ); } $fields[] = array( 'name' => 'obj.status', 'type' => '=', 'value' => 'publish' ); $context['recipes_count'] = RecipeModel::count($fields); $context['recipes'] = RecipeModel::filter( $fields, ['-obj.created_at'], CATALOG_MAX_RECIPES, offset: calc_page_offset(CATALOG_MAX_RECIPES, $context['page']) ); return $context; } }