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

OsCommerce vs. Magento


Die Weiterentwicklung zur Version 3 von OsCommerce verläuft schleppend. Schon lange ist eine neue OsCommerce Version angekündigt worden, dennoch befindet sich diese immer noch im Alpha Stadium.


Während dieser Zeit mausert sich langsam aber sicher ein neues Shop System an die Spitze. Magento, ein junges aber viel versprechendes Open Source Shop-System. Magento gibt es auch als Enterprise Version zu kaufen. Mit dem kauf erhält man vollen Support so wie ich das auf den ersten Blick sehe und noch einige andere Annehmlichkeiten.

Deutlich macht das auch der Vergleich der Suchabfragen zu Magento und OsCommerce über Google Insights

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