I've done some custom search "magic" at my store and realized when I read your post that you were absolutely right - the prev/next display always defaults to alphabetical display, even if that wasn't the requested listing order. Hadn't noticed that! Thank you for pointing it out. Now to see about fixing it.
The three files that work together on the mechanics of this are, as you've found,
includes/index_filters/default_filter.php
includes/modules/product_listing_alpha_sorter.php
includes/modules/product_prev_next.php
All three of these should be in an override directory. The adjusted files would go into the following, where your_template would be changed to the name of your actual template.
includes/index_filters/your_template/default_filter.php
includes/modules/your_template/product_listing_alpha_sorter.php
includes/modules/your_template/product_prev_next.php
That said, you've already added your custom search criteria to default_filter.php. Good job! product_listing_alpha_sorter.php is for the dropdown menu display, to show what criteria the results are appearing by. Let me know if you'd care to change that and I'll show you how I did mine.
The part that gave me trouble was getting the prev/next display to recognize the requested sort order. The default is alphabetical, and it's used in a switch case along with the rest of the order by options. Mine refused to switch no matter what I did, even if I removed the order by text from the query altogether - it still displayed in alphabetical order. I was able to get around this by starting a session in default_filter.php to pick up the order by text from either the user requested or default landing display.
Seems to work great here. Let's see if it will work for you, too!
In 1.3.9h, the core default_filter.php file contains the following block of code at approx. lines 21 - 25:
PHP Code:
if (isset($_GET['alpha_filter_id']) && (int)$_GET['alpha_filter_id'] > 0) {
$alpha_sort = " and pd.products_name LIKE '" . chr((int)$_GET['alpha_filter_id']) . "%' ";
} else {
$alpha_sort = '';
}
You've probably added some additional lines for your preferred search criteria.
Add the following immediately afterwards:
PHP Code:
// BOF ADJUST PREV/NEXT SORT ORDER DISPLAY
session_start();
$_SESSION['sort_order'] = $alpha_sort;
// EOF ADJUST PREV/NEXT SORT ORDER DISPLAY
Next, in product_prev_next.php, the core file from 1.3.9h contains the following block of code at approx. lines 70 - 75:
PHP Code:
$sql = "select p.products_id, p.products_model, p.products_price_sorter, pd.products_name, p.products_sort_order
from " . TABLE_PRODUCTS . " p, "
. TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " ptc
where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id= '" . (int)$_SESSION['languages_id'] . "' and p.products_id = ptc.products_id and ptc.categories_id = '" . (int)$current_category_id . "'" .
$prev_next_order;
Change this to:
PHP Code:
// BOF ADJUST PREV/NEXT SORT ORDER DISPLAY
$sql = "select p.products_id, p.products_model, p.products_price_sorter, pd.products_name, p.products_sort_order, p.products_date_added
from " . TABLE_PRODUCTS . " p,
" . TABLE_PRODUCTS_DESCRIPTION . " pd,
" . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
where p.products_status = '1'
and p.products_id = pd.products_id
and pd.language_id= '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = ptc.products_id
and ptc.categories_id = '" . (int)$current_category_id . "'
" . $_SESSION['sort_order'];
// EOF ADJUST PREV/NEXT SORT ORDER DISPLAY
That should do it. Hope this helps! :)