If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / [Done 1.3.9a] 1.3.8a-"State/Province" becomes blank -Updating Address book

[Done 1.3.9a] 1.3.8a-"State/Province" becomes blank -Updating Address book

Locked

Started by bigm on 19 Feb 2008, 3:06 AM · Views: 2,956

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
19 Feb 2008, 3:06 AM
#1
bigm avatar

bigm

New Zenner

Join Date:
Feb 2008
Posts:
8
Plugin Contributions:
0

Post #1 by bigm

Hello,

I'm using ZenCart 1.3.8a.

We have a problem with updating Address Book Entry.
It happens with the setting "State - Always display as pulldown" is True.

When a customer ,in a country which does not have state pulldown list, tries to change his adress in his Address Book, his state information becomes blank.
So,need to type the state name agin to go though.

Any suggestions?

Thanks for any input!

Yuji

19 Feb 2010, 3:47 PM
#2
jean_paul avatar

jean_paul

New Zenner

Join Date:
Jan 2010
Posts:
18
Plugin Contributions:
0

Post #2 by jean_paul

I have the same problem. Also with version 1.3.8a. Would seem to be a bug unfortunately.

My current Configuration\Customer Details settings:

State :: true
State - Always display as pulldown? :: true

My current Configuration\Minimum Values settings:

State :: [empty] (NOT the numeral zero)

[note: this is so State can be optional for countries that do not have states/provinces]

I will try my best to investigate/fix the code myself (might take a while as I'm new to both PHP and Zen Cart), but it would be ace if someone else has already has come up with a fix for this?

If I don't hear anything back, I will post my solution here if and when I manage to get somewhere. If I do post some code, it would be fab if someone from the Zen team could look over what I've done?

Thanks and best wishes,
Jean-Paul

19 Feb 2010, 7:26 PM
#3
jean_paul avatar

jean_paul

New Zenner

Join Date:
Jan 2010
Posts:
18
Plugin Contributions:
0

Post #3 by jean_paul

Well, I've found the offending line of code in tpl_modules_address_book_details.php

echo zen_draw_input_field('state', zen_get_zone_name($entry->fields['entry_country_id'], $entry->fields['entry_zone_id'], $entry->fields['entry_state']), zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state"');

Changing the name of the Input field from 'state' to anything else (for example 'TEST_state') solves the problem. However, I don't yet know why nor what else this might break. So don't go changing this code just yet!

Would appreciate any leads - if any of the Zen Cart team are reading this?!

Thanks!
Jean-Paul

20 Feb 2010, 5:14 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #4 by drbyte

You'll need to make changes in 3 places, on 2 lines of code:
/includes/modules/pages/address_book_process/header_php.php
line 70, change as shown:```
$state =[B] (isset($_POST['state'])) ? [/B]zen_db_prepare_input($_POST['state']) [B]: FALSE[/B];

line 307, change as shown: ```
  $state = ($flag_show_pulldown_states[B] && $state != FALSE[/B]) ? $state : $zone_name;

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Feb 2010, 3:24 PM
#5
jean_paul avatar

jean_paul

New Zenner

Join Date:
Jan 2010
Posts:
18
Plugin Contributions:
0

Post #5 by jean_paul

Thanks so much for your reply. Was taking me forever to work out. Still not familiar enough with Zen Cart and PHP I guess. Probably would have got there eventually but I certainly appreciate your prompt response! Owe you a cup of coffee.

I'll try out your solution and will only post again here if I encounter any further problems with this particular issue. Thanks again.

21 Feb 2010, 1:37 AM
#6
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #6 by torvista

I'm a bit confused, changes are required in 3 places ?

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

21 Feb 2010, 2:37 AM
#7
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Post #7 by tony_sar

torvista:

I'm a bit confused, changes are required in 3 places ?

3 places on 2 line of code , if you look at the code DrByte has mentioned you will see the changes are in Red and there are 3 of them within 2 line

21 Feb 2010, 2:33 PM
#8
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #8 by torvista

Doh!
thanks, yes, completely obvious, sometimes you look but you just don't see:blush:

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...