Re: Advanced Search - customized product fields?
Hi!
If the search page doesn`t go to the result page there must be something wrong in your
tpl_advanced_search_default.php file
or the
/include/modules/pages/advanced_search/header_php.php
you didn`t post your changes there, right?
and if your sure about the value of "dwarf" isn`t string than string is def. not the right variable type - but string should work as well (i think).
these are the possible variable types in php (as far as i know):
"array"
"double"
"integer"
"object"
"resource"
"string"
"unknown type"
Re: Advanced Search - customized product fields?
found another issue while testing my advanced search in different languages -
if you just want to search on of your "advanced search features" without a searchterm in the keywords section and you are using a different language than english, you have to replace a value in
/includes/languages/YOUR_Language/advanced_search.php
Code:
from
define('KEYWORD_FORMAT_STRING', 'Schlüsselworte');
to
define('KEYWORD_FORMAT_STRING', 'keywords');
otherwise the shop searches for the search term "Schlüsselworte" (for the german example) and that leads to wrong results
hope this helps someone.
br
zvenson
Re: Advanced Search - customized product fields?
It may not be appropriate for everyone, but I think it can be very simple. Do not add any extra text boxes for custom fields for example products_author.
1. includes/modules/pages/advanced_search_result/header_php.php
Find:
$where_str .= "(pd.products_name LIKE '%:keywords%'
After:
OR p.products_model
LIKE '%:keywords%'
Add:
OR p.products_author
LIKE '%:keywords%'
2. includes/languages/your_template/advanced_search.php
Replace:
define('HEADING_SEARCH_CRITERIA', 'Choose Your Search Terms');
with:
define('HEADING_SEARCH_CRITERIA', 'Title, Author, ISBN/ISSN');
Re: Advanced Search - customized product fields?
Hi rajoo.sharma !
Thanks for this - it is a different attempt but should work as well for some people. In my case I needed a little more advanced search where you can specify different values and a description the same time without using the "AND" thing in the description field..
And I needed to search extra database tables.
But your solution is good and simple and should be much easier to implement then what i came up with...:bigups:
cheers!
Re: Advanced Search - customized product fields?
Hi Guys,
I've been playing with my advanced search file to see if I could just search categories meta tags and descriptions. I was following this post as well as this one...
http://www.zen-cart.com/forum/showthread.php?t=114787
I've made some changes and have run into this output
1146 Table 'lim0908902331618.TABLE_META_TAGS_CATEGORIES_DESCRIPTION' doesn't exist
in:
[select count(distinct p.products_id) as total FROM (zen_products p LEFT JOIN zen_manufacturers m USING(manufacturers_id), zen_products_description pd, zen_categories c, zen_products_to_categories p2c ) LEFT JOIN zen_meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id AND mtpd.language_id = 1 LEFT JOIN TABLE_META_TAGS_CATEGORIES_DESCRIPTION mtcd ON mtcd.categories_id= c.categories_id AND mtcd.language_id = 1 WHERE (p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND c.categories_id = mtcd.categories_id AND ((pd.products_name LIKE '%boy%' OR p.products_model LIKE '%boy%' OR m.manufacturers_name LIKE '%boy%' OR (mtpd.metatags_keywords LIKE '%boy%' AND mtpd.metatags_keywords !='') OR (mtcd.metatags_keywords LIKE '%boy%' AND mtcd.metatags_keywords !='') OR (mtpd.metatags_description LIKE '%boy%' AND mtpd.metatags_description !='') OR pd.products_description LIKE '%boy%') ))]
I'm not an SQL girl so I'm not sure how to resolve this issue although I did confirm that the table META_TAGS_CATEGORIES_DESCRIPTION is there. I must be referencing / linking it wrong in the query code. Any ideas?
Re: Advanced Search - customized product fields?
The constant for that table is:
TABLE_METATAGS_CATEGORIES_DESCRIPTION
Re: Advanced Search - customized product fields?
Thank you! By the way how did you know that? Is it located in myphpadmin somewhere?
Re: Advanced Search - customized product fields?
oh gosh, could I bother you again...
I'm getting this result now...
1054 Unknown column 'cd.categories_id' in 'where clause'
in:
[select count(distinct p.products_id) as total FROM (zen_products p LEFT JOIN zen_manufacturers m USING(manufacturers_id), zen_products_description pd, zen_categories c, zen_products_to_categories p2c ) LEFT JOIN zen_meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id AND mtpd.language_id = 1 LEFT JOIN zen_meta_tags_categories_description mtcd ON cd.categories_id= c.categories_id AND dc.language_id = 1 WHERE (c.categories_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND c.categories_id = cd.categories_id AND c.categories_id = dc.categories_id AND ((cd.metatags_description LIKE '%infant%' OR cd.metatags_keywords LIKE '%infant%' OR dc.categories_name LIKE '%infant%' OR cd.metatags_title LIKE '%infant%' OR (mtpd.metatags_keywords LIKE '%infant%' AND mtpd.metatags_keywords !='') OR (mtpd.metatags_description LIKE '%infant%' AND mtpd.metatags_description !='') OR pd.products_description LIKE '%infant%') ))]
Re: Advanced Search - customized product fields?
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
Re: Advanced Search - customized product fields?
Hi gforce!
thanks for the flowers and sorry for not answering earlier - just discovered your post - did you find a solution yet? Blank page sounds like php syntax error to me - haven't found the time to look into your code yet but will do it soon!
cheers!