Excluding Products Without Image

if (Registry::get('settings.General.inventory_tracking') == 'Y' && // FIXME? Registry in model
        Registry::get('settings.General.show_out_of_stock_products') == 'N' &&
        $params['area'] == 'C'
    ) {
        $condition .= db_quote(
            ' AND (CASE products.tracking' .
            '   WHEN ?s THEN inventory.amount > products.min_stock' .
            '   WHEN ?s THEN products.amount > products.min_stock' .
            '   ELSE 1' .
            ' END)',
            ProductTracking::TRACK_WITH_OPTIONS,
            ProductTracking::TRACK_WITHOUT_OPTIONS
        );
    }

The above is an excerpt from fn.catalog.php in which I exclude products from being shown if they don't have more than a database-specified stock value. How would I access the other databases for images and image links in order to effectively prevent products without images from being displayed?

You should use the 'get_product_data_pre' hook and adjust the JOINs to use an INNER JOIN for the product image links.

Alternatively, you can use the get_product_data_post hook to check the data and return an empty array if your conditions aren't met. But you will have wasted an expensive DB query. But it's a lot easier to get right! :-)

You should NOT be modifying core files for these changes. It will only cause you upgrade headaches in the future.

Just check cscart_images_links table with object_id = PRODUCT_ID and object_type = 'product'

If image_id or detailed_id parameters. At least one of them should not be empty

Just check cscart_images_links table with object_id = PRODUCT_ID and object_type = 'product'

If image_id or detailed_id parameters. At least one of them should not be empty

Like this?

$condition .= db_quote(
            ' AND (CASE products.tracking' .
            '   WHEN ?s THEN inventory.amount > products.min_stock' .
            '   WHEN ?s THEN products.amount > products.min_stock' .
			'   WHEN ?s THEN (SELECT ?:images_links.image_id FROM ?:images_links WHERE ?:images_links.object_id=products.product_id AND ?:images_links.object_type = "product") != 0' .
			'   WHEN ?s THEN (SELECT ?:images_links.detailed_id FROM ?:images_links WHERE ?:images_links.object_id=products.product_id AND ?:images_links.object_type = "product") != 0' .
            '   ELSE 1' .
            ' END)',
            ProductTracking::TRACK_WITH_OPTIONS,
            ProductTracking::TRACK_WITHOUT_OPTIONS
        );

Not sure I'd use selects for your conditions (pretty expensive requiring full table scans for each). Suggest an INNER JOIN on the ?:images_links table with the conditions part of the JOIN to only have producta returned where ?:images_links.image_id AND ?:images_links.detailed_id are not both zero. I.e. something similar to:

$join = "INNER JOIN ?:images_links AS il ON il.object_id = ?:products.product_id AND il.object_type = 'product' AND (il.image_id != 0 OR il.detailed_id != 0)";

Just an example, not tested or validated in any particular use case.