♥ecartz Posted August 27, 2009 Share Posted August 27, 2009 (edited) Contribution link: DHTML State Selection This add on addresses a missing feature and fixes a bug in address editing. In standard osCommerce, when you add or edit an address, you have to enter the state (or province or county or region or whatever it is called in your country) free hand into a text box. The desired feature being to select from a drop down to avoid typos, etc. Then, if you submit, it replaces your entry with a drop down menu of all the states in that country. However, if you selected the wrong country, you then have to change the country and submit the form to get the correct drop down. That's the bug. This add on dynamically switches between drop down menus for the various countries. For example, with the default osCommerce install, it will allow you to select the United States as the country and then pick Alabama (or any of the other US states) from a drop down menu. Then, if you change your country to Canada, the drop down will show a list of Canadian provinces. If you pick a country that does not have any zones in the database, it will show the standard text input. The add on also defaults the country to the store country setting. There is one feature that is removed. If the user does not have Javascript running in their browser, then this version only ever shows the text input. This fixes the bug of not being able to switch countries but at the price of never offering the convenience of the drop down to a non-javascript user. A possible future enhancement would be to show both the text input and the drop down in this case. However, that was beyond the scope of the current project. Another add on that does something similar via AJAX is Country-State Selector. I haven't used it, so I pass on the question of which is better. Edited August 27, 2009 by ecartz Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
sackling Posted September 3, 2009 Share Posted September 3, 2009 Had some problems installing that other contribution so I will be trying out yours now. Thanks! Quote Link to comment Share on other sites More sharing options...
Guest Posted September 4, 2009 Share Posted September 4, 2009 Go ezcart! I already had figured out how to install on address book and checkout shipping. Maybe I should have posted that? Anyways, thumbs up for you. ;) Quote Link to comment Share on other sites More sharing options...
zygos Posted October 8, 2009 Share Posted October 8, 2009 Hi all This Addon dose not work when STS in activated any ideas ? Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted October 8, 2009 Author Share Posted October 8, 2009 Someone would have to modify your store so that STS knew to add the javascript on the appropriate pages. A possible solution might be to change </table></form></td> <!-- body_text_eof //--> to </table></form><?php require('includes/form_check.js.php'); ?></td> <!-- body_text_eof //--> and eliminate the other call to form_check. I don't have STS installed, so I can't test it. Or troubleshoot it for that matter. Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
karlaredor Posted November 10, 2009 Share Posted November 10, 2009 Someone would have to modify your store so that STS knew to add the javascript on the appropriate pages. A possible solution might be to change </table></form></td> <!-- body_text_eof //--> to </table></form><?php require('includes/form_check.js.php'); ?></td> <!-- body_text_eof //--> and eliminate the other call to form_check. I don't have STS installed, so I can't test it. Or troubleshoot it for that matter. I've tried manually adding the contents of form_check.js.php and I can't get the js code (what was added) to show. Any ideas? Quote Link to comment Share on other sites More sharing options...
maxi032 Posted March 7, 2010 Share Posted March 7, 2010 It is working only when language is en. I need it to work for other languages too. I don't understand what is the problem. Please help! Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted March 12, 2010 Author Share Posted March 12, 2010 It is working only when language is en.It's not clear to me why the language would make a difference. None of the new SQL queries are language dependent. Also, if I try it on my test site, it works (at least in Spanish and German). Perhaps the problem would be more obvious if you posted a link to the page that is not working? Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
Guest Posted December 25, 2011 Share Posted December 25, 2011 Hi Matt! Tank you so much for a fantastic contribution. I installed it yesterday on my multi language site, and it worked out of the box! :) It does have some glitiches though, which I'd like to fix, example: -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Date / Time: 24-12-2011 23:02:22 Error Type: [E_NOTICE] Undefined index: US On line 482 File create_account.php -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Date / Time: 24-12-2011 23:05:49 Error Type: [E_NOTICE] Undefined index: telephone On line 57 File create_account.php -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Date / Time: 24-12-2011 23:05:49 Error Type: [E_NOTICE] Undefined index: fax On line 58 File create_account.php -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ I think these also concerns File includes/modules/address_book_details.php and so on. Also wrt the added file to form check (I might be wrong on this), shouldn't this line case '<?php echo $country_id_for[$country_with_zones_code]; ?>': be with double quotes? Also, I am thinking of installing "active countries" to be able to activate/deactivate countries through admin. Would that possibly be in conflict with yours? I have a list of zones, approx. 4 thousands of them, somewhere. If I find it and it's error free I'll be happy to supply it. Anyhow, thanks for a fantastic contribution! Sara Quote Link to comment Share on other sites More sharing options...
Guest Posted July 2, 2015 Share Posted July 2, 2015 (edited) Hi, I had the same problem, the addon worked when the language was English, but not when the language was Romanian. After studying the HTML output I found that the form_check.js was not working at all when the language was Romanian. It throws an error because of translation text in the file romana.php. The line that generated the JS error was like: define('JS_ERROR_SUBMITTED', 'Acest formular a fost deja trimis. Va rugam apasati "Ok" si asteptati ca acest proces sa se incheie.'); Just had to remove the " from text. I shared this, just in case someone faces the same problem. Regards Aurelian P.S.: Thanks Matt for the great Addon :beers: Edited July 2, 2015 by aurelian.zaha Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.