stevel Posted April 23, 2007 Author Share Posted April 23, 2007 Joe, please ask your web host about enabling PHP error logging or display. Marc, you have a PHP syntax error - in this case, a missing close brace. You removed one, but perhaps it was in the wrong place rather than being extra. I suggest comparing your edited file against the pre-edited files provided in the zip file. This may help you spot the problem. Ian, I was thinking about your page with the two address sections. Without some extra work, the code won't be able to tell which of the two country fields got changed. I suggest that you add two hidden fields that have a value of the current selection for country, call these old_country1 and old_country2, for example. Then when a refresh is seen, compare the current value of country1 (this is what I call the one in the left column) against old_country1. If it is the same, do NOT clear the state field. Same for country2 and old_country2. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Salvo Posted April 23, 2007 Share Posted April 23, 2007 (edited) HI all, I have the need to associate and divide all products to a particular area and I thought to use this contribution if it is adaptable. ie: Select first the COUNTRY from a drop down menu. Then all the areas in that country should be in another drop down menu. Therefore, all products associated to that areas, should be listed and be able to sort/filter by category/manufacturer. is it possible to adapt this nice contribution in this way? Thanks Salvo Edited April 23, 2007 by Salvo Quote Link to comment Share on other sites More sharing options...
stevel Posted April 23, 2007 Author Share Posted April 23, 2007 You can certainly apply the technique used to refresh the page and provide a dropdown of just the zones in the selected country (if any). You could extend it if you needed to further qualify a different dropdown. The basic idea is the use of an onChange JavaScript action to refresh the page and select choices for another item. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Salvo Posted April 23, 2007 Share Posted April 23, 2007 Hi Steve, I see that you are the creator of this nice contribution. Would you be interested in helping and of course create it as contribution? I am sure that there are many people out there interested in something like this. People can use it if there have some products that can only be sold in some locations. Thank you salvo Quote Link to comment Share on other sites More sharing options...
stevel Posted April 23, 2007 Author Share Posted April 23, 2007 Sorry, not really. I develop contribs that I want to use on my own store. If I have no use for something, I can't get too interested in writing it. I think what you want more than something like this contrib is a way to require that the customer select their location before browsing products, and then you can filter on that when displaying products. It would be a pain to have to do this selection more than once in a session. Depending on how many choices you offer, you might want to do the menu selection a different way (such as loading all the choices into a JavaScript array and filtering it). Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Salvo Posted April 23, 2007 Share Posted April 23, 2007 (edited) Steve, Thanks for your input I appreciated it. I will see if I can make it work. Salvo Edited April 23, 2007 by Salvo Quote Link to comment Share on other sites More sharing options...
ianric Posted April 26, 2007 Share Posted April 26, 2007 Ian, I see a couple of problems. First, on the left column select tag for country, you have onChange="return refresh_form(createaccount);" However, the name of the form on that page is not createaccount, it is checkout. Second, the field for the shipping country does not include the onChange action. That needs to be added. A third problem, unrelated to this, is that your img tag for the "visual verifier" is malformed, missing the closing bracket. I can't see your PHP code so you need to make sure that it properly establishes the country for both fields on a refresh. hi Steve I've fixed the 1st prob and that now refreshes OK. For the shipping part, doh!! didn't even occur to me, still ongoing. I'll also try your suggestion further down when my brain isn't as fried. The 3rd prob is fixed even tho it seemed to work. A related question. Is it possible to make the country & state lists a default size instead of fitting to the text inside. If I set the country to USA, for example, the states box expands to fit the text and it screws the layout. many thanks Ian Quote Link to comment Share on other sites More sharing options...
stevel Posted April 26, 2007 Author Share Posted April 26, 2007 Nope - width of the dropdown list is entirely controlled by the browser based on the longest value. You have no control over this (other than shortening list values.) I recently researched this so it's fresh in my mind. Even if you put it in a fixed-width table cell, the browser will make the cell wider so that it fits. No horizontal scrolling. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
ianric Posted April 27, 2007 Share Posted April 27, 2007 Nope - width of the dropdown list is entirely controlled by the browser based on the longest value. You have no control over this (other than shortening list values.) I recently researched this so it's fresh in my mind. Even if you put it in a fixed-width table cell, the browser will make the cell wider so that it fits. No horizontal scrolling. Thanks Steve. Ian Quote Link to comment Share on other sites More sharing options...
Mfred Posted May 2, 2007 Share Posted May 2, 2007 Hi, I integrated the contrib to my site. The default country selector is working, but the page doesent reload on changing the country, the code for reload is there <select name="country" onChange="return refresh_form(create_account);"> and I dont get any page errors. I didnt install the /admin/... files as I dont need it in the admin section. Do I have to alter them also for functionality? br, mfred Quote Link to comment Share on other sites More sharing options...
stevel Posted May 2, 2007 Author Share Posted May 2, 2007 No, you don't need the admin changes. Please follow the troubleshooting tips in the readme. In particular, make sure that the refresh_form JavaScript function is present in the loaded page (view page source in your web browser) and that there are no JavaScript errors reported. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Mfred Posted May 2, 2007 Share Posted May 2, 2007 steve thx for this fast reponse. The JS part is in the loaded head section of the page: function refresh_form(form_name) { form_name.action.value = 'refresh'; form_name.submit(); return true; } Normally i am working with firefox which gave no errors. Loading the page in IE gives a syntax error on line 113 which is: check_input("state", , "Das Bundesland sollte mindestens Zeichen enthalten."); On reloading the page this error disappears as it has then a state in the Fieldlist. But on changing the country I get the following error: Missing object on line 404 <td class="main"><select name="country" onChange="return refresh_form(create_account);"><option value="">Bitte wählen</option><option value="2">Albania</option><option value="5">Andorra</option><option value="14" SELECTED>Austria</option>....[LONGLISTHERE] </select> <span class="inputRequirement">* (Seite lädt nach Auswahl neu)</span></td> br, mfred Quote Link to comment Share on other sites More sharing options...
Mfred Posted May 3, 2007 Share Posted May 3, 2007 I found it out. The problem was that the 'minimum value' for state in the admin menu was empty. I replaced it with a 0 then it worked :) Quote Link to comment Share on other sites More sharing options...
dr_lucas Posted July 2, 2007 Share Posted July 2, 2007 (edited) I am having a problem while Register Globals are off on checkout_shipping_address.php and checkout_payment_address.php When selecting the country in the drop down menu the page refresh and goes back to the "Please select". It works fine when register globals are on and all other pages except for these 2 files. How can I fix this? TIA Edited July 2, 2007 by dr_lucas Quote Did I help you? Click "Like" or "Thanks"! It's free of charge. :)My contributions:Total Configuration (newly updated 07/2018, for both osC 2.2 and 2.3.4.1 BS Frozen CE)User Tracking with Admin 1.0 (newly updated 07/2018)FedEx - Web Services v9, FAQ System , Who's Online Enhancement, Order Editor, MoneyBookers IPN, Ship in Cart (MS2), Admin Products Paging, Margin Report v1.00, 2Checkout INS / IPN (Instant Notification System) for MS2.2, Visitor Web Stats, Time Zone Offset - Adjust to match your location, Category Meta Tags Link to comment Share on other sites More sharing options...
dr_lucas Posted July 2, 2007 Share Posted July 2, 2007 I seem to have made a mistake while editing these 2 files, so it works fine with register globals off. I do have a different issue now, when the page refresh on these 2 files after selecting the country, there is still no dropdown menu in the state field. There is only the standard blank space that you can type it in, but no dropdown. It works fine on create account page and other pages when selecting the country. Any ideas? Quote Did I help you? Click "Like" or "Thanks"! It's free of charge. :)My contributions:Total Configuration (newly updated 07/2018, for both osC 2.2 and 2.3.4.1 BS Frozen CE)User Tracking with Admin 1.0 (newly updated 07/2018)FedEx - Web Services v9, FAQ System , Who's Online Enhancement, Order Editor, MoneyBookers IPN, Ship in Cart (MS2), Admin Products Paging, Margin Report v1.00, 2Checkout INS / IPN (Instant Notification System) for MS2.2, Visitor Web Stats, Time Zone Offset - Adjust to match your location, Category Meta Tags Link to comment Share on other sites More sharing options...
stevel Posted July 2, 2007 Author Share Posted July 2, 2007 Compare your code against the pre-edited versions. especially around the code which displays the state field in the form. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Shianna Posted July 8, 2007 Share Posted July 8, 2007 I have a problem with the state not clearing out when the country is changed. This is only happening on create_account, checkout_shipping_address and checkout_payment_address. The other pages admin_customers and address_book_process do not have this problem. I have spent hours and cannot figure it out. This does seem to be an ongoing problem with this mod and I DID download all of the supposed fixes for this problem and compared them to the newest updates and they are all the same. It looks like the three files with problems originally had the problem fixed with this line: if ($HTTP_POST_VARS['action'] == 'refresh') {$state = '';} but it is not clearing the state field when my form refreshes. If anyone has had this problem and found a way to fix it please let me know. Register globals is ON and this is a fresh install with this being the first mod added to these pages. I apologize in advance if the fix is already posted in here but I browsed through all 39 pages and didn't find what I needed. Quote Link to comment Share on other sites More sharing options...
stevel Posted July 8, 2007 Author Share Posted July 8, 2007 See if the edits here solve the problem for you. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Shianna Posted July 9, 2007 Share Posted July 9, 2007 Thank you. That did the trick! :) Quote Link to comment Share on other sites More sharing options...
Guest Posted July 19, 2007 Share Posted July 19, 2007 Hi guys, excellent contribution. I would also expect this to be in the new oscommerce core, for sure!!! Everything works perfectly but.... I got 3 languages in my site (CatalanCooking) and dropdown boxes in create_account.php work well for english and spanish version but not catalan... :blink: I can't understand what I'm missing. Any help apreciated, people. Thanks in advance Quote Link to comment Share on other sites More sharing options...
stevel Posted July 19, 2007 Author Share Posted July 19, 2007 You put a font tag with a color in the text for the error messages for minimum name length, etc., in the Catalan file. You can't do that because the quote character in the string causes a JavaScript error. You don't have these in the English definitions. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
congiothoang Posted July 21, 2007 Share Posted July 21, 2007 (edited) does everyone know how to put a onChange behavor of javascript into a dropdown menu Ex: Dropdown menu in address_book_detail.php (or any dropdown menu) echo tep_draw_pull_down_menu('state', $zones_array, $cur_zone_value['zone_name']); And I want to put this javascripts onChange="javscript: handle_selection(document.getElementById('state').value);" into the that dropdown menu. So it will come out like this in html: <select name="something" id="something" onChange="javscript: handle_selection(document.getElementById('state').value);" ><option></option><option></option></selection Thanks in advance! Congiothoang Edited July 21, 2007 by congiothoang Quote Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2007 Share Posted July 21, 2007 Steve, many thanks. I hope one day I have such clear knowledge and find problems as fast as you, guy!! Many thanks!!! Quote Link to comment Share on other sites More sharing options...
judyxt Posted July 22, 2007 Share Posted July 22, 2007 Thanks Steve I actually did it and everything works on both sites now God Bless you for all your help and patients. Judy Quote Link to comment Share on other sites More sharing options...
Guest Posted July 30, 2007 Share Posted July 30, 2007 does everyone know how to put a onChange behavor of javascript into a dropdown menu Ex: Dropdown menu in address_book_detail.php (or any dropdown menu) echo tep_draw_pull_down_menu('state', $zones_array, $cur_zone_value['zone_name']); And I want to put this javascripts onChange="javscript: handle_selection(document.getElementById('state').value);" into the that dropdown menu. So it will come out like this in html: <select name="something" id="something" onChange="javscript: handle_selection(document.getElementById('state').value);" ><option></option><option></option></selection Thanks in advance! Congiothoang I'm not using your mod but I thought I could help. It's pretty simply actually. According to the documentation, these are the possibilities for this function: tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) The Fourth part is for your own custom parameters. Just add a coma after your default selection and put your parameters between two single quotes. For example: tep_draw_pull_down_menu('state', $zones_array, $cur_zone_value['zone_name'],'onChange="javscript: handle_selection(document.getElementById('state').value);"') Cheers! :) 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.