stevel Posted April 13, 2008 Author Share Posted April 13, 2008 I recommend that you go over the World Zones contribution carefully and make sure that the zones are correct and, for each country, complete. I have had issues with this contribution in the past. 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...
Top_Speed Posted April 16, 2008 Share Posted April 16, 2008 Hi Steve and others... Q? On the State selector (works great) but my 1st State by default is Alabama. Some customers tend to skip over this and then their State is left as Alabama even though it really may be Texas. Is there a hack that will make the default State "Please select..." and post an error if not selected?? Thanks for your time. KJ Quote define('PROJECTS', 'Something that goes on forever!'); Link to comment Share on other sites More sharing options...
♥FWR Media Posted April 16, 2008 Share Posted April 16, 2008 Hi Steve and others... Q? On the State selector (works great) but my 1st State by default is Alabama. Some customers tend to skip over this and then their State is left as Alabama even though it really may be Texas. Is there a hack that will make the default State "Please select..." and post an error if not selected?? Thanks for your time. KJ I just installed this for a customer (Can't believe it is still immaculate after all this time) I "think" the change I made was catalog/create_account.php echo tep_draw_pull_down_menu('zone_id', $zones_array, STORE_ZONE); Where STORE_ZONE is the selected. Quote Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
stevel Posted April 16, 2008 Author Share Posted April 16, 2008 The change that KJ asked for is in my latest version (1.4.x). Adding the default state in the way you did it will work on the create account page as long as the customer does not get an error filling it out and have to reenter, at which point the state will reset (and won't work if the country is different.) It also doesn't work on the other "address book" pages. 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...
♥FWR Media Posted April 16, 2008 Share Posted April 16, 2008 (edited) The change that KJ asked for is in my latest version (1.4.x). Adding the default state in the way you did it will work on the create account page as long as the customer does not get an error filling it out and have to reenter, at which point the state will reset (and won't work if the country is different.) It also doesn't work on the other "address book" pages. Ah ok steve I probably installed 1.4X for my client and was misremembering. I've also noticed people starting to add rubbish to the contribution, such a shame, all the best ones like this get killed by the posting of irrelevant crap. Insaini is a name I've seen doing this before. Edited April 16, 2008 by FWR Media Quote Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
insaini Posted April 16, 2008 Share Posted April 16, 2008 Ah ok steve I probably installed 1.4X for my client and was misremembering. I've also noticed people starting to add rubbish to the contribution, such a shame, all the best ones like this get killed by the posting of irrelevant crap. Insaini is a name I've seen doing this before. WOW.. you seem like an individual that attacks before knowing anything to begin with.. the contribution i uploaded is EXACTLY the same as the previous versions.. with the difference being ONLY AJAX support .. if you had even looked at the code.. I used stevel's function to the T and only abstracted it to a function (thus instead of having 15 lines of code which are exactly the same in 4 different files.. it is contained now in only 1 file.. ) .. you really should open a couple files.. read and see what the difference is before you open your mouth star.. Quote Link to comment Share on other sites More sharing options...
stevel Posted April 16, 2008 Author Share Posted April 16, 2008 I don't understand the attack either. Ajax is a natural fit for this contribution, and was something I thought about doing. It's not for everyone, though. I appreciate Jesse's taking a crack at 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...
♥FWR Media Posted April 17, 2008 Share Posted April 17, 2008 (edited) WOW.. you seem like an individual that attacks before knowing anything to begin with.. the contribution i uploaded is EXACTLY the same as the previous versions.. with the difference being ONLY AJAX support .. if you had even looked at the code.. I used stevel's function to the T and only abstracted it to a function (thus instead of having 15 lines of code which are exactly the same in 4 different files.. it is contained now in only 1 file.. ) .. you really should open a couple files.. read and see what the difference is before you open your mouth star.. Please accept my apologies Insaini. I just get fed up with contributions having loads of rubbish appended to them most of which are useless. I went off "half cocked" because I was having a frustrating evening. I was wrong to direct this at you, especially as I had not viewed your addition. Instead of interacting on the web last night perhaps I should have been reading a page or two from "how to make friends and influence people". <slaps self around head> Edited April 17, 2008 by FWR Media Quote Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
insaini Posted April 17, 2008 Share Posted April 17, 2008 Please accept my apologies Insaini. I just get fed up with contributions having loads of rubbish appended to them most of which are useless. I went off "half cocked" because I was having a frustrating evening. I was wrong to direct this at you, especially as I had not viewed your addition. Instead of interacting on the web last night perhaps I should have been reading a page or two from "how to make friends and influence people". <slaps self around head> Done and Accepted.. I do know what you mean about a lot of junk be added to contribution pages.. makes it tough to know what to download.. Quote Link to comment Share on other sites More sharing options...
♥FWR Media Posted April 17, 2008 Share Posted April 17, 2008 Done and Accepted.. I do know what you mean about a lot of junk be added to contribution pages.. makes it tough to know what to download.. Very gracious of you. Thanks Quote Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
cmakynen Posted April 20, 2008 Share Posted April 20, 2008 No doubt a really simple thing, but I can't see it and would appreciate your help. This evening I noticed my installation of the AJAX country/state selector 1.5.1 was not calling up the saved state when Updating an address. Always showing default Alabama - but all the correct zip, address and country and name info. Will not update the state field, and in fact won't let me off the update page because "a required field " is blank. I'm guessing that would be the state field... To make it even more confusing for me, I have copied the actual files, all of them, from the contribution into place - I had manually changed them a few nights ago, but didn't think I needed to go through that all again. So just copied them all up. New address works fine, jsut update does not. So the source I'm using is exactly what is in the 1.5.1 contribution from April 12. Is there a bug fix I just haven't noticed posted? Thanks Chris Quote Link to comment Share on other sites More sharing options...
stevel Posted April 20, 2008 Author Share Posted April 20, 2008 The Ajax version is brand new. I haven't tried it myself yet. Perhaps Jesse can help 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...
insaini Posted April 20, 2008 Share Posted April 20, 2008 No doubt a really simple thing, but I can't see it and would appreciate your help. This evening I noticed my installation of the AJAX country/state selector 1.5.1 was not calling up the saved state when Updating an address. Always showing default Alabama - but all the correct zip, address and country and name info. Will not update the state field, and in fact won't let me off the update page because "a required field " is blank. I'm guessing that would be the state field... To make it even more confusing for me, I have copied the actual files, all of them, from the contribution into place - I had manually changed them a few nights ago, but didn't think I needed to go through that all again. So just copied them all up. New address works fine, jsut update does not. So the source I'm using is exactly what is in the 1.5.1 contribution from April 12. Is there a bug fix I just haven't noticed posted? Thanks Chris Hmm.. so this is only when updating an address in the 'my account' area and not when creating an account? Let me check Quote Link to comment Share on other sites More sharing options...
insaini Posted April 20, 2008 Share Posted April 20, 2008 No doubt a really simple thing, but I can't see it and would appreciate your help. This evening I noticed my installation of the AJAX country/state selector 1.5.1 was not calling up the saved state when Updating an address. Always showing default Alabama - but all the correct zip, address and country and name info. Will not update the state field, and in fact won't let me off the update page because "a required field " is blank. I'm guessing that would be the state field... To make it even more confusing for me, I have copied the actual files, all of them, from the contribution into place - I had manually changed them a few nights ago, but didn't think I needed to go through that all again. So just copied them all up. New address works fine, jsut update does not. So the source I'm using is exactly what is in the 1.5.1 contribution from April 12. Is there a bug fix I just haven't noticed posted? Thanks Chris Ok I have uploaded the fixed version 1.5.3 There are a few small code changes necessary.. First open catalog/includes/functions/ajax.php change the function declaration line from function ajax_get_zones_html($country, $ajax_output = true) { to function ajax_get_zones_html($country, $default_zone = '', $ajax_output = true) { Next in that same function change this part if ( tep_db_num_rows($zones_query) ) { $output .= tep_draw_pull_down_menu('zone_id', $zones_array); } else { $output .= tep_draw_input_field('state'); } to this if ( tep_db_num_rows($zones_query) ) { $output .= tep_draw_pull_down_menu('zone_id', $zones_array, $default_zone); } else { $output .= tep_draw_input_field('state', $default_zone); } Now open catalog/create_account.php change <?php // +Country-State Selector echo ajax_get_zones_html($country,false); // -Country-State Selector ?> to this <?php // +Country-State Selector echo ajax_get_zones_html($country,'',false); // -Country-State Selector ?> Do the same above change to file catalog/includes/modules/checkout_new_address.php Now open catalog/includes/modules/address_book_details.php and change this // +Country-State Selector echo ajax_get_zones_html($entry['entry_country_id'], false); // -Country-State Selector to this // +Country-State Selector echo ajax_get_zones_html($entry['entry_country_id'],($entry['entry_zone_id'] == 0 ? $entry['entry_state'] : $entry['entry_zone_id']), false); // -Country-State Selector That should take care of it all Quote Link to comment Share on other sites More sharing options...
cmakynen Posted April 20, 2008 Share Posted April 20, 2008 Ok I have uploaded the fixed version 1.5.3 There are a few small code changes necessary.. Thanks for taking the time to look at this insaini. Unfortunately - I still have a problem - although slightly improved, because it doesn't show "alabama" every time in edit mode! I applied the entire 1.5.3 version, overwriting everything except languages\english.php which I just left as it was already. In it I have the default state set with define ('DEFAULT_COUNTRY', '223'); Exact symptoms: I'm logged in as an existing customer. I am editing an address in my address book - either the default address or any other existing record in my address book. - via address_book_process.php (url is appended with?edit=number) Everything looks good, I make my changes and click "update" Screen refreshes to same address_book_process.php (url is appended with?edit=number) but with changes in all fields except state. Cannot exit the screen via the update button, but no errors are displayed Only way out is "back" button or click some other unrelated link No changes are saved to any part of the address. If you would like to see it in action in my not yet active store, http://www.classicbikebooks.com/ Test user: nobody@midwestmx.com password: letmein Thanks! Quote Link to comment Share on other sites More sharing options...
insaini Posted April 20, 2008 Share Posted April 20, 2008 (edited) Thanks for taking the time to look at this insaini. Unfortunately - I still have a problem - although slightly improved, because it doesn't show "alabama" every time in edit mode! I applied the entire 1.5.3 version, overwriting everything except languages\english.php which I just left as it was already. In it I have the default state set with define ('DEFAULT_COUNTRY', '223');Exact symptoms: I'm logged in as an existing customer. I am editing an address in my address book - either the default address or any other existing record in my address book. - via address_book_process.php (url is appended with?edit=number) Everything looks good, I make my changes and click "update" Screen refreshes to same address_book_process.php (url is appended with?edit=number) but with changes in all fields except state. Cannot exit the screen via the update button, but no errors are displayed Only way out is "back" button or click some other unrelated link No changes are saved to any part of the address. If you would like to see it in action in my not yet active store, http://www.classicbikebooks.com/ Test user: nobody@midwestmx.com password: letmein Thanks! Ahhh i think i found the problem.. open catalog/address_book_process.php around line 40 if (isset($_POST['action']) && ($_POST['action'] == 'process')) { change to if (isset($_POST['action']) && (($_POST['action'] == 'process') || ($_POST['action'] == 'update'))) { Sorry about that.. I will make that change and upload it as a new package hopefully that resolves all issues OH and also .. you may want to put the a css tag for the indicator somewhere in your css file #indicator { visibility:hidden; } you can position this as you see fit for your site.. Edited April 20, 2008 by insaini Quote Link to comment Share on other sites More sharing options...
cmakynen Posted April 20, 2008 Share Posted April 20, 2008 Thanks !!! Adding the || ($_POST['action'] == 'update') was exactly the trick. You rock :) Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted April 21, 2008 Share Posted April 21, 2008 (edited) Hi Jesse, I'm just trying to install this on a very modified page here but I am getting an error when i change country from the default... the error is Any ideas what the cause might be? Thanks Dave Edited April 21, 2008 by stubbsy Quote Link to comment Share on other sites More sharing options...
insaini Posted April 21, 2008 Share Posted April 21, 2008 (edited) Hi Jesse, I'm just trying to install this on a very modified page here but I am getting an error when i change country from the default... the error is Any ideas what the cause might be? Thanks Dave The problem i guess is partially my fault i should have realized.. it seems as though you changed the stock osc form name for that page.. the name of the form is usually 'account' youve changed it to 'checkout' not really sure why that is but in any case you need to open /catalog/includes/ajax.js.php and in the getStatesRequest function find the line that begins with document.account and change it to document.checkout .. for the time being.. let me see if I can change that so its not necessary.. as well you have multiple country selections for shipping address and billing address.. ill see if i can modify it so that it works for multiple country selection boxes.. but for the time being use the above fix... should work.. J Edited April 21, 2008 by insaini Quote Link to comment Share on other sites More sharing options...
insaini Posted April 21, 2008 Share Posted April 21, 2008 Hi Jesse, I'm just trying to install this on a very modified page here but I am getting an error when i change country from the default... the error is Any ideas what the cause might be? Thanks Dave Ive updated the code so that it works with multiple country drop-downs and any form name.. code changes.. first open catalog/includes/ajax.js.php remove the original two functions named getStates and getStatesRequest and replace with these functions function getStates(countryID, form, div_element) { if (request.readyState == 4 || request.readyState == 0) { // indicator make visible here.. getObject("indicator").style.visibility = 'visible'; var contentType = "application/x-www-form-urlencoded; charset=UTF-8"; var fields = "action=getStates&country="+countryID; request.open("POST", 'create_account.php', true); //request.onreadystatechange = getStatesRequest; request.onreadystatechange = function() { getStatesRequest(request, form, div_element); }; request.setRequestHeader("Content-Type", contentType); request.send(fields); } } //Called when the AJAX response is returned. function getStatesRequest(request, form, div_element) { var next = false; if (request.readyState == 4) { // make hidden getObject('indicator').style.visibility = 'hidden'; getObject(div_element).innerHTML = request.responseText; if (form.state) { form.state.focus(); } else if (form.zone_id) { form.zone_id.focus(); } } } next open catalog/create_account.php change <?php echo tep_get_country_list('country',$country,'class="formtextinput" onChange="getStates(this.value);"') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?> to <?php echo tep_get_country_list('country',$country,'class="formtextinput" onChange="getStates(this.value, this.form, \'states\');"') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?> notice the difference in the getStates function call.. two added parameters.. this.form (should never change) and \'states\' this you need to change for any page with multiple country select boxes .. basically if you have a billing select and shipping select change it to be \'billing_states\' and \'shipping_states\' then you also need to change the <DIV element which surrounds the states dropdown in each .. from <div id="states"> to <div id="billing_states"> and for the other one.. shipping states.. should be clear enough? make the above code changes to the files catalog/includes/modules/checkout_new_address.php and catalog/includes/modules/address_book_details.php that should be all there is to it.. new package will be uploaded soon.. J Quote Link to comment Share on other sites More sharing options...
insaini Posted April 21, 2008 Share Posted April 21, 2008 Actually you may just want to download the new package and update manually... ive changed the ajax function and now there is no need to pass in this.form in those function calls anymore .. J Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted April 21, 2008 Share Posted April 21, 2008 Hi Jesse, thanks for the quick response, much appreciated. I'll give that a go when i get 5 later on Thanks again Dave Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted April 21, 2008 Share Posted April 21, 2008 Hi Jesse, thats still throwing up a runtime error. Any ideas? (btw, the page started off as a page from the FEC contribution so I have no idea why the creator changed the form name) Cheers Dave Quote Link to comment Share on other sites More sharing options...
insaini Posted April 21, 2008 Share Posted April 21, 2008 Hi Jesse, thats still throwing up a runtime error. Any ideas? (btw, the page started off as a page from the FEC contribution so I have no idea why the creator changed the form name) Cheers Dave Dave.. I see that you have a link to a file called global.js .. can you post the contents of that file please.. Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted April 21, 2008 Share Posted April 21, 2008 (edited) Edited April 21, 2008 by stubbsy 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.