OK this goes out to svenson as he seems one of the few to have mastered how to customise the product fields..
The site deals with downloadable items so I'm attempting to have a field for filesize on the advanced search.
I have followed your instructions in post #13 to the letter but I'm just getting a blank result screen.. -> here's what I did:
1) added the following in /public_html/includes/templates/template_default/templates/tpl_advanced_search_default.php:
PHP Code:
$products_filesize_arr = array(array('id' => '', 'text' => TEXT_NONE));
$products_filesize = $db->Execute("SELECT products_filesize from " . TABLE_PRODUCTS_DESCRIPTION . " GROUP BY products_filesize ORDER BY products_filesize");
while (!$products_filesize->EOF) {
$products_filesize_arr[] = array('id' => $products_filesize->fields['products_filesize'],
'text' => $products_filesize->fields['products_filesize']);
$products_filesize->MoveNext();
}
2) then this in the same file:
Code:
<fieldset>
<legend>Filesize Heading</legend>
<?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_pull_down_menu('products_filesize', $products_filesize_arr, $pInfo->products_filesize); ?>
<br class="clearBoth" />
</fieldset>
3) then I added the following in /public_html/includes/modules/pages/advanced_search/header_php.php:
PHP Code:
$sData['products_filesize'] = (isset($_GET['products_filesize']) ? zen_output_string($_GET['products_filesize']) : '');
4) Now in /public_html/includes/modules/pages/advanced_search_result/header_php.php I added the following on around line 24:
PHP Code:
(isset($_GET['products_filesize']) && !is_string($_GET['products_filesize'])) &&
5) in the same file I added on line 60:
PHP Code:
if (isset($_GET['products_filesize'])) {
$products_filesize = $_GET['products_filesize'];
}
..this is just below:
PHP Code:
if (isset($_GET['keyword']) && $_GET['keyword'] != HEADER_SEARCH_DEFAULT_TEXT && $_GET['keyword'] != KEYWORD_FORMAT_STRING) {
$keywords = $_GET['keyword'];
}
6) then I included this:
PHP Code:
'PRODUCTS_FILESIZE' => PRODUCTS_FILESIZE);
on line 153 (near the other similar statements).
7) then I added this:
PHP Code:
case 'PRODUCTS_FILESIZE':
$select_column_list .= 'pd.products_filesize';
break;
.. around line 90 (below the others)
8) then I have this around line 302:
PHP Code:
if (isset($_GET['products_filesize']) && zen_not_null($_GET['products_filesize'])) {
$where_str .= " AND pd.products_filesize = :products_filesizeID";
$where_str = $db->bindVars($where_str, ':products_filesizeID', $_GET['products_filesize'], 'string');
}
..just below these statements:
PHP Code:
$where_str = $db->bindVars($where_str, ':categoriesID', $_GET['categories_id'], 'integer');
$where_str = $db->bindVars($where_str, ':languagesID', $_SESSION['languages_id'], 'integer');
}
}
Well that's the 8 steps I followed. Perhaps I have positioned something wrongly or there is a typo - I can't see it though. My suspicions are with step 8 of the process. The data stored is in varchar - don't know if this makes a difference to the variable types as you were contemplating in post #21 of this thread.
Anyway I hope that you can offer some guidance after your success >> it would be greatly appreciated.
_thanks
Bookmarks