You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
Hi,
When the customer comes to enter their details, they will find a drop down menu with all the states of America, what I want to do is to change this to a text field where a user can enter either their state if US or county/province if UK or Europe.
Any way of changing the state/province drop down to a simple one line text field??
Regards,
David
Offline
Cheers, thanks for that.
I've done what you suggested in the ste_checkout.pl file, just read your comments about the customer accounts section where you wrote...
This doesn't change where the customer accounts get created (for that I think you can just edit the elements ste_custacct*), just the checkout, but it seems to work ok.
Just wondering, what to do there exactly, im not technically minded so I could do with some help here!
Thanks for your help so far.
David
Offline
For the customer accounts, the SELECT fields are populated in the routines:
ste_custacct_stateprovlist
ste_custacct_shipstateprovlist
In the file ./cgi-bin/library/modules/ste_custacct.pl. You will want to edit the form elements, though, to completely replace the SELECT fields with TEXTBOXes.
Offline
I am trying to implement this as well as I do not use a realtime shipping method and I require a county/state/province text-box rather than a drop down pre-set selection list.
I have modified the fine and the county/state/province option now appears as a text-box on the checkout.
I am however unsure as to how to edit the code in to make the customer accounts pages use a textbox instead of the dropdown selection list so that these pages co-ordinate with the textbox information entered by the customer at checkout.
I have noticed the state/county/province option list appears in the admin area on the customer accounts page, also on the 1st checkout page and on the create new customer account page. Are there any other pages that need changing for this to work?
Can someone please help with modifying the routines in the file ? I am totaly stuck here. The codes are as below:
####################################################################### # Ste Custacct StateProvList # ####################################################################### sub ste_custacct_stateprovlist { &initialize_sub_add('ste_custacct_stateprovlist'); ######### ######### This routine displays form data for a state/province listing. ######### print <<ENDOFTEXT; <OPTION VALUE=""></OPTION> ENDOFTEXT $sql_statement = " SELECT stateprov_id FROM stateprov WHERE stateprov_id<>'' "; my @disp = database_call('stateprov','SELECT',$sql_statement); foreach $row(@disp) { ($stateprov_id) = @$row; if ($stateprov_id eq "$fd_tracking_stateprov" && $fd_pg ne "ste_custacctnew") { print <<ENDOFTEXT; <OPTION VALUE="$stateprov_id" SELECTED>$stateprov_id</OPTION> ENDOFTEXT } else { print <<ENDOFTEXT; <OPTION VALUE="$stateprov_id">$stateprov_id</OPTION> ENDOFTEXT } ######### End of if statement. } ######### End of foreach statement. &initialize_sub_remove('ste_custacct_stateprovlist'); } ######### End of subroutine.
####################################################################### # Ste Custacct ShipStateProvList # ####################################################################### sub ste_custacct_shipstateprovlist { &initialize_sub_add('ste_custacct_shipstateprovlist'); ######### ######### This routine displays form data for a state/province listing. ######### print <<ENDOFTEXT; <OPTION VALUE=""></OPTION> ENDOFTEXT $sql_statement = " SELECT stateprov_id FROM stateprov WHERE stateprov_id<>'' "; my @disp = database_call('stateprov','SELECT',$sql_statement); foreach $row(@disp) { ($stateprov_id) = @$row; if ($stateprov_id eq "$fd_trackitem_shipstateprov" && $fd_pg ne "ste_custacctnew") { print <<ENDOFTEXT; <OPTION VALUE="$stateprov_id" SELECTED>$stateprov_id</OPTION> ENDOFTEXT } else { print <<ENDOFTEXT; <OPTION VALUE="$stateprov_id">$stateprov_id</OPTION> ENDOFTEXT } ######### End of if statement. } ######### End of foreach statement. &initialize_sub_remove('ste_custacct_shipstateprovlist'); } ######### End of subroutine.
I have noticed these routines only seem to create part of the HTML form element tags; only the <OPTION> part is created. The HTML <SELECT> tag which creates the drop down list in the first place must be somewhere else? Where does the <SELECT> HTML form code reside so they can be modified appropriatly?
Also last of all (honest!) ...are there any database issues with modifying this form item like this? Will the state/county/province information for customer accounts be intact and stored ok if this is altered to the form of a text box from the original drop down selection list?
Cheers
myqee
Offline
Hi, I'm totally winging it here, but I think for the customer accounts you can just edit the files ste_custacctnew.txt and ste_custacctupd.txt and change
<SELECT NAME="tracking_stateprov"> (CGIGET TYPE="SUB" VALUE="ste_custacct_stateprovlist") </SELECT>
to an input box.
<input type="text" name="tracking_stateprov">
I don't think you will need to modify any program code. Likewise I don't think there should be any database issues, but customers have been known to enter weird stuff anywhere they can...
HTH,
Dave
Offline
Thanks Dave. That was very helpful ...
I've followed what you said and have taken it a little further as well as few more txt files need modifying and with a little extra code too.
So far all appears to be working in the shop-front side of the website. I now need to just do the same for the CCP admin area and replace all its state/province/county option areas in to text-boxes as well. Any ideas anyone?
Currently if a customer enters a state/county/province name that does match one from the original drop down slection list then in all the drop down lists for this option (the ones still in the admin area) default to the empty non-selected option in the drop down list. It is cruicial I can get all admin state/province/county option drop down lists converted to text boxes as well so the text entered by customers for state/province/county show up and I can then proccess orders, customer accounts, etc. Any ideas where these are located to mod? I'm trying to find them in the .pl's and .txt's with not much luck so far.
Just as a note to anyone wanting to try implement this as well this is what I have done so far....
In look for the lines
$type = "SELECT-TABLE";
$param = "stateprov";
and change SELECT-TABLE to TEXTBOX
In change
<SELECT NAME="tracking_stateprov">
(CGIGET TYPE="SUB" VALUE="ste_custacct_stateprovlist")
</SELECT>
to
<input type="text" name="tracking_stateprov" size="20">
In change
<SELECT NAME="tracking_shipstateprov">
(CGIGET TYPE="SUB" VALUE="ste_custacct_stateprovlist")
</SELECT>
to
<input type="text" name="trackitem_shipstateprov" size="20">
In change
<SELECT NAME="tracking_stateprov">
(CGIGET TYPE="SUB" VALUE="ste_custacct_stateprovlist")
</SELECT>
to
<input type="text" name="tracking_stateprov" size="20" value="(CGIVAR)fd_tracking_stateprov(/CGIVAR)">
In change
<SELECT NAME="tracking_shipstateprov">
(CGIGET TYPE="SUB" VALUE="ste_custacct_stateprovlist")
</SELECT>
to
<input type="text" name="trackitem_shipstateprov" size="20" value="(CGIVAR)fd_trackitem_shipstateprov(/CGIVAR)">
--end--
Now this does appear to work perfectly so far. If anyone knows how to get this sorted for the admin area's state/province/county drop down slection lists as well please post as this whole process is futile without that really.
If you read this Nick do you have any comments as to what I am doing here good, bad or indifferent? Many thanks.
myqee
Offline
Well after many bloody, sweat and tears(!) I've finally got the state/province/county drop down lists in the admin area converted to text-boxes as well. Now the entries from the customers appear correctly in admin area for us to view in the backend when processing orders etc... :-)
As per usual after looking through reams and reams of code it turned out to be something simple... just a database entry change!! My site is running using csv so I will describe how I made the changes this way, however, if your site is using MYSQL I imagine what you have to do is pretty much the same anayway.
Firstly change the state/province/county drop down lists on the admin update customer accounts page. In the file: change lines:
custacct_stateprov,SYSTEM,County/State/Province,50,N,SELECT-TABLE,stateprov,,N custacct_shipstateprov,SYSTEM,Shipping County/State/Province,50,N,SELECT-TABLE,stateprov,,N
to:
custacct_stateprov,SYSTEM,County/State/Province,50,N,TEXTBOX-REG,,,N custacct_shipstateprov,SYSTEM,Shipping County/State/Province,50,N,TEXTBOX-REG,,,N
Now you need to change the state/province/county drop down list on the admin update online order page. In the file: change the line:
tracking_stateprov,SYSTEM,Billing County/State/Province,50,Y,SELECT-TABLE,stateprov,,N
to:
tracking_stateprov,SYSTEM,Billing County/State/Province,50,Y,TEXTBOX-REG,,,N
You dont have to do this part if you are not running the inbuilt affiliatte scheme but I thought it would be better to include it and round of this mod properly.
This will convert the affilliate accounts state/province/county drop down lists to text-boxes as well.
In the file change line:
affacct_stateprov,SYSTEM,County/State/Province,50,Y,SELECT-TABLE,stateprov,,N
to:
affacct_stateprov,SYSTEM,County/State/Province,50,Y,TEXTBOX-REG,,,N
Now make the changes for the store front affiliate area. In the file change:
<SELECT NAME="tracking_stateprov"> (CGIGET TYPE="SUB" VALUE="ste_affacct_stateprovlist") </SELECT>
to:
<input type="text" name="tracking_stateprov" size="20">
In the file change:
<SELECT NAME="tracking_stateprov"> (CGIGET TYPE="SUB" VALUE="ste_custacct_stateprovlist") </SELECT>
to:
<input type="text" name="tracking_stateprov" size="20" value="(CGIVAR)fd_tracking_stateprov(/CGIVAR)">
---end---
Thats it! Now all the state/province/county drop down lists are text boxes allowing for flexability. Please do note though that if you are using realtime shipping methods this is NOT a good idea as they require conformed entries in this field.
As usual all disclaimers apply, use at own risk... etc...
hope this is all of use to some of you.
Offline
Has anyone been using this modification successfully?
Has anyone found a better way to allow for data entry regarding this field that allows for a more user friendly experience upon checkout if they are from outside North America?
Any comments and suggestions are much appreciated!
Offline
That's a great post, MYQEE. Thanks. It would seem essential for everyone shipping out of UK or USA.
Thing is, I've worked through the instructions and no problems have come up yet, but I still have a dropdown for the state/province list in the shipping fields that appear as an alternative to the billing fields on the first checkout page. Is that right and, if so, is there a code change to fix this too? Or have I done something wrong?
Much obliged!
Offline