Found it. The category being initially displayed has products that are still 'registered' in the site's products_to_categories table but not in the products_description.
Find this code on lines 29-62 of admin/includes/ih_manager.php
Code:
// set categories and products if not set
if ($products_filter == '' && $current_category_id > 0) {
$new_product_query = $db->Execute(
"SELECT ptc.products_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd
ON ptc.products_id = pd.products_id
AND pd.language_id = " . (int)$_SESSION['languages_id'] . "
WHERE ptc.categories_id = " . (int)$current_category_id . "
ORDER BY pd.products_name"
);
$products_filter = ($new_product_query->EOF) ? '' : $new_product_query->fields['products_id'];
if ($products_filter !== '') {
zen_redirect(zen_href_link(FILENAME_IMAGE_HANDLER, 'ih_page=manager&products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id));
}
} else {
if ($products_filter == '' && $current_category_id == '') {
$reset_categories_id = zen_get_category_tree('', '', '0', '', '', true);
$current_category_id = $reset_categories_id[0]['id'];
$new_product_query = $db->Execute(
"SELECT ptc.products_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd
ON ptc.products_id = pd.products_id
AND pd.language_id = " . (int)$_SESSION['languages_id'] . "
WHERE ptc.categories_id = " . (int)$current_category_id . "
ORDER BY pd.products_name"
);
$products_filter = ($new_product_query->EOF) ? null : $new_product_query->fields['products_id'];
if ($products_filter === null) {
unset($_GET['products_filter']);
} else {
$_GET['products_filter'] = $products_filter;
}
}
}
and change to
Code:
// set categories and products if not set
if ($products_filter == '' && $current_category_id > 0) {
$new_product_query = $db->Execute(
"SELECT ptc.products_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
INNER JOIN " . TABLE_PRODUCTS . " p
ON p.products_id = ptc.products_id
INNER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd
ON ptc.products_id = pd.products_id
AND pd.language_id = " . (int)$_SESSION['languages_id'] . "
WHERE ptc.categories_id = " . (int)$current_category_id . "
ORDER BY pd.products_name"
);
$products_filter = ($new_product_query->EOF) ? '' : $new_product_query->fields['products_id'];
if ($products_filter !== '') {
zen_redirect(zen_href_link(FILENAME_IMAGE_HANDLER, 'ih_page=manager&products_filter=' . $products_filter . '¤t_category_id=' . $current_category_id));
}
} else {
if ($products_filter == '' && $current_category_id == '') {
$reset_categories_id = zen_get_category_tree('', '', '0', '', '', true);
$current_category_id = $reset_categories_id[0]['id'];
$new_product_query = $db->Execute(
"SELECT ptc.products_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
INNER JOIN " . TABLE_PRODUCTS . " p
ON p.products_id = ptc.products_id
INNER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd
ON ptc.products_id = pd.products_id
AND pd.language_id = " . (int)$_SESSION['languages_id'] . "
WHERE ptc.categories_id = " . (int)$current_category_id . "
ORDER BY pd.products_name"
);
$products_filter = ($new_product_query->EOF) ? null : $new_product_query->fields['products_id'];
if ($products_filter === null) {
unset($_GET['products_filter']);
} else {
$_GET['products_filter'] = $products_filter;
}
}
}
That'll be included in a forth-coming v5.3.5 of IH-5; see this GitHub issue for tracking: https://github.com/lat9/zen_Image-Handler/issues/16
Bookmarks