Jump to content
Latest News: (loading..)
stevel

Country-State Selector

Recommended Posts

This is what I have between 195 and 210

}
? ? ?}

? ? ?$messageStack->add_session('addressbook', SUCCESS_ADDRESS_BOOK_ENTRY_UPDATED, 'success');

? ? ?tep_redirect(tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
? ?}
?}

// +Country-State Selector
}
// -Country-State Selector ?

 

I am going to go through the instructions again and see if I messed up

Edited by ryanf

If I was crafty, this would be a funny signature.

Share this post


Link to post
Share on other sites

Never mind I fixed the problem I was having. Copy and Pasting out of the html file doesn't work too well, all the lines paste as one line and you have to then hit enter where they should all be. I missed one and one of the lines was commented out.


If I was crafty, this would be a funny signature.

Share this post


Link to post
Share on other sites

Sorry about the HTML - I will fix that today. I see someone made a few suggestions in the contribution download area (not the best place for that, admittedly!) I'll probably work those in and post an update.

 

Please let me know how this works for you.

Share this post


Link to post
Share on other sites

Hello all,

 

Nice contrib, but i have one problem with it.

 

When editing an existing second adress in the adress-book (adress_book_process.php?edit=), and i change the country, it will jump back to the country that i want to change...

 

Can somebody confirm this behaviour. (Might be I installed something else, that causes this, not sure about ....)

 

 

greetings

 

tower

Share this post


Link to post
Share on other sites

Yes, I can confirm this. I could have sworn I tested this case... Worse, if the country has zones, it doesn't preselect the old zone/state.

 

I haven't figured out a solution yet - I'll work on it. If anyone else can figure it out, please chime in. The code for the address_book is more complex than that for create_account, as it has to deal with the existing entry. I think I over-simplified.

Edited by stevel

Share this post


Link to post
Share on other sites

Ok, I see what's wrong and how to fix it. Give me another day... my brain is a bit too fuzzy from lack of sleep right now.

 

Basically, in address_book_process.php, I have to recreate the $entry array from the post values from the refreshed form. Then there's the matter of the code in address_book_details.php not being quite right either...

 

Stay tuned...

Share this post


Link to post
Share on other sites

Version 1.0.1 posted, with all fixes. The major changes were in the two address book files, though I added a (int) cast to the query in create_account.php. I also fixed the formatting of the HTML file to make copy/paste work.

 

Please let me know of any problems. Enjoy!

Share this post


Link to post
Share on other sites

First of all thanks for this contribution.

 

I have a rather modified store and I have installed the contribution to a T but don't have it working completely.

 

I get the following error on the catalog/address_book_process.php file.

 

Parse error: parse error in /home/virtual/site3/fst/var/www/html/newstore2/address_book_process.php on line 190

 

Here is what the block of code looks like in that area. (Showing lines 183-209)

 

 ? ? ?$messageStack->add_session('addressbook', SUCCESS_ADDRESS_BOOK_ENTRY_UPDATED, 'success');

? ? ?tep_redirect(tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
? ?}
?}

// +Country-State Selector
}

? if ($refresh) {
? ? // Recreate $entry from post values collected above
?$entry = array(
? ?'entry_firstname' => $firstname,
? ?'entry_lastname' => $lastname,
? ?'entry_street_address' => $street_address,
? ?'entry_postcode' => $postcode,
? ?'entry_city' => $city,
? ?'entry_state' => "",
? ?'entry_zone_id' => (int)0,
? ?'entry_country_id' => (int)$country);
? if (ACCOUNT_GENDER == 'true') $entry['entry_gender'] = $gender;
? ? ?if (ACCOUNT_COMPANY == 'true') $entry['entry_company'] = $company;
? ? ?if (ACCOUNT_SUBURB == 'true') $entry['entry_suburb'] = $suburb;
? ?}
?else
// -Country-State Selector
? ?$entry_query = tep_db_query("select entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$HTTP_GET_VARS['edit'] . "'");

 

 

 

Any help would be greatly appreciated.

 

Thank you

Edited by magicproshop

Share this post


Link to post
Share on other sites

Damn - my error.

 

The group for line 191 should end with:

 

if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) {

 

which was an original line. I'll fix the docs and re-upload. Sorry!

Edited by stevel

Share this post


Link to post
Share on other sites

Ok when I remove the } the address_book.php page loads fine and I don't get the message I listed in the previous post.

 

But when I then click "edit" or "delete" in the address section to edit or delete an address the javascript kicks in and refreshes the page and adds a blank address.

 

 

Sorry my poor programing skill is certainly coming thru.

 

Any ideas?

Share this post


Link to post
Share on other sites

Send your address_book_process.php file to me at webmaster at cheshiregarden dot com. I assume you meant address_book_process.php and not address_book.php in the last post.

Share this post


Link to post
Share on other sites

I found the problem that others are complaining about, it has to do with the HTML cut&paste issue once again I'm nearly certain. When you copy&paste the code for the line 55 replacement in address_book_process.php from the html file, the code is pasted like this:

 

 // +Country-State Selector
if ($process) {
// -Country-State Selector    if (ACCOUNT_GENDER == 'true') {

 

When it should be entered like this:

 

 // +Country-State Selector
if ($process) {
// -Country-State Selector
   if (ACCOUNT_GENDER == 'true') {

 

Check your address_book_process.php around line 63 and make sure that "// -Country-State Selector" line has a return after it. ;)

 

Awesome contribution, thanks. B)

Share this post


Link to post
Share on other sites

Interesting.. I think I see what in the HTML is causing that and will fix it. Or perhaps I should just do text like everyone else - sigh. That's what I get for trying to be modern! B)

Share this post


Link to post
Share on other sites

Superb contribution, this is just what I'm looking for.

 

However, I'm having the same problems as above but i did not cut from HTML I opened your file in MacroMedia so I could just cut the text as is.

 

My parse error was line 196 unexpected } when this was removed as described above I too get blank entries whether trying to edit or delete.

 

Loaded version 1.03

Share this post


Link to post
Share on other sites
Superb contribution, this is just what I'm looking for.

 

However, I'm having the same problems as above but i did not cut from HTML I opened your file in MacroMedia so I could just cut the text as is.

 

My parse error was line 196 unexpected } when this was removed as described above I too get blank entries whether trying to edit or delete.

 

Loaded version 1.03

Well sorry for this , it would seem i missed the deletion of a little code on the line 100 replacement - alls seems to be okily dockily :D

 

Regards

 

Andy

Share this post


Link to post
Share on other sites

Update 1.0.4 posted with support for Update Address during checkout. Only new files in this update, you can leave previously edited files alone.

 

I seem to have discovered a simpler approach on this latest version, but I'm not going back to "simplify" the older files.

 

If I've made any mistakes here, be sure to let me know! I am pretty sure the HTML is ok this time!

Share this post


Link to post
Share on other sites
Update 1.0.4 posted with support for Update Address during checkout. Only new files in this update, you can leave previously edited files alone.

 

I seem to have discovered a simpler approach on this latest version, but I'm not going back to "simplify" the older files.

 

If I've made any mistakes here, be sure to let me know! I am pretty sure the HTML is ok this time!

"Only new files"? Does the 1.0.4 contain "all" the files I need, or do I need to get 1.0.3 and 1.0.4?

Sorry If I'm too tired to understand exactly what you meant. 10-month old little kids can sure keep a guy up late at night.

--Jeff


--Jeff

Of course I don't look busy! I did it right the first time!

Share this post


Link to post
Share on other sites

Too late to edit, darn.

I guess I answer me own Q's by looking in the zip myself. Looks like all the files are there. Oh, what a day. :blink:


--Jeff

Of course I don't look busy! I did it right the first time!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×