Posts mit dem Label SimpleSuggest werden angezeigt. Alle Posts anzeigen
Posts mit dem Label SimpleSuggest werden angezeigt. Alle Posts anzeigen

März 07, 2010

Session problems have nothing to do with Simple Suggest

The problem with the shopping cart, one user described, caused not of problems with the ajax simple suggest for osCommerce, it was how I guessed a generally session problem, the user answered in the oscommerce forum:

I figure why my search field throw the products from the basket out, because I hadn't have tep_hide_session_id (); Thanks for your help (if you have another suggestion feel free to say) BR J

some other usefull tipps to fix the session problem can be found in this thread:

März 05, 2010

Session problems

A user told me this:

when I put something in the cart and go to search, enter something in the search field and click search button, find me a product that I have set but all disappeared from the shopping cart.

After I asked some questions he told me his links look like this:

http://localhost/shop/shopping_cart.php?osCsid=f39597ef4bc176592687ea0d5f2d13bb

May he has a generally session problem

November 17, 2009

BUG: First letter special char

Another problem with special chars. If the first letter you type, is a special char, the suggestion wont show. I think the decoding problems caused of different character sets in the MySQL database.

I will test the contribution with some other databases.

BUG: Special Country Chars

Today I have fixed an other little bug in the AJAX Search suggestion for OsCommerce



Cezar99 send me this screenshot from his polish OsCommerce online-shop. The problem can be fixed with the following change in the file searchSuggest.php

Change this line:
//Return each product name seperated by a newline.
echo SIMPLESUGGEST_MARK_SEARCH_CHAR == 'true' ?
str_replace($search,'' . $search . '',htmlentities($suggest['pn']) . "\n"):
htmlentities($suggest['pn']) . "\n";

To this:

//Return each product name seperated by a newline.
echo SIMPLESUGGEST_MARK_SEARCH_CHAR == 'true' ?
str_replace($search,'' . $search . '',html_entity_decode(htmlentities($suggest['pn'])) . "\n"):
html_entity_decode(htmlentities($suggest['pn'])) . "\n";

Now SimpleSuggest should be able to show foreign chars correct in the search suggestion. May chars could not be combined in products name, i tried some polish and a german special char, the german char was not correct decode but this should not be a problem.

November 16, 2009

BUG: searchReq.readyState1 on fast typing

In the SimpleSuggest Contribution for OsCommerce another bug has been registered by cezar99, thanks at this point. If you type fast in the search input box you get an alert:

searchReq.readyState1

At this moment I got no solution, the only way at the time is to change a function in your ajax_search.js.

Try tho remove the else condition in ajax_search.js in the function searchSuggest():
this will only hide the message!

Change:
//Called from keyup on the search textbox.
//Starts the AJAX request.
function searchSuggest() {
if (searchReq.readyState == 4 || searchReq.readyState == 0) {
var str = escape(document.getElementById('txtSearch').value);

searchReq.open("GET", 'searchSuggest.php?search=' + str, true);
searchReq.onreadystatechange = handleSearchSuggest;
searchReq.send(null);
}
else {
alert('searchReq.readyState' + searchReq.readyState);
}
}

To this:
//Called from keyup on the search textbox.
//Starts the AJAX request.
function searchSuggest() {
if (searchReq.readyState == 4 || searchReq.readyState == 0) {
var str = escape(document.getElementById('txtSearch').value);

searchReq.open("GET", 'searchSuggest.php?search=' + str, true);
searchReq.onreadystatechange = handleSearchSuggest;
searchReq.send(null);
}
}

An other little detail who do not work 100% correct at the moment is, if you have a product name including an ß and "Mark search char strong" is activated, the name of the product will be destroyed, cause ß contains an s.

I will correct these things in future.

Update: Other languages and special chars may also generate problems.


Try to use stripslashes instead of htmlentities in searchSuggest.php at this point the problem can be fixed, but my time today goes to the end...

//Return each product name seperated by a newline.
//echo stripslashes($suggest['pn']) . "\n";/*
echo SIMPLESUGGEST_MARK_SEARCH_CHAR == 'true' ?
str_replace($search,'' . $search . '',stripslashes($suggest['pn']) . "\n"):
stripslashes($suggest['pn']) . "\n";//*/





BUG: Warning: call_user_func(tep_cfg_select_option(array('true', 'false'),)

Update: One Day since SimpleSuggest - Ajax Search for OsCommerce is released, there is a first bug to fix, thx to cezar99. In the first package there was an error in the sql script.
If you have a warning like this:

Warning:
call_user_func(tep_cfg_select_option(array('true',
'false'),)[function.call-user-func]: First argument
is expected to be a valid callback in /admin/includes/functions/general.php on line 1284

Warning: call_user_func(tep_cfg_select_option(array('true',
'false'),)[function.call-user-func]: First argument
is expected to be a valid callback in
/admin/includes/functions/general.php on line 1284

In your OsCommerce Admin section, use this to correct the error:
UPDATE `configuration` SET `use_function` = '', `set_function` = 'tep_cfg_select_option(array(''true'', ''false''),' WHERE `configuration`.`configuration_key` like 'SIMPLESUGGEST_MARK_SEARCH_CHAR' LIMIT 1;
UPDATE `configuration` SET `use_function` = '', `set_function` = 'tep_cfg_select_option(array(''true'', ''false''),' WHERE `configuration`.`configuration_key` like 'SIMPLESUGGEST_ACTIVE' LIMIT 1;

November 15, 2009

SimpleSuggest - Ajax Search Suggestion for OsCommerce

SimpleSuggest - Ajax search suggest for
OsCommerce 2.2 RC2a

Thist contribution adds a simple Ajax search suggestion box to your OsCommerce search box.
You can add the search suggestion easy to every other search box within your OsCommerce. You can activated/deactivated it in the admin section, change the number of results and some other planned.

Users of a fresh install can copie the catalog folder, by keep the structure, note STS users
have to watch where they place the ajax_search.js script file which later is included in the head.

Well have fun and see if it is useful for us and report bugs and ideas on:
http://forums.oscommerce.com/user/226804-straka/

http://addons.oscommerce.com/info/7114