I wanted all of the address information to show on the “Create an Account” page so I am able to collect all of the customers info before approving their account for wholesale.
I found a post with instructions of where I could edit… app/design/frontend/default/default/template/customer/form/register.phtml and remove the code below to make the address info show.
<?php if($this->getShowAddressFields()): ?>
and
<?php endif; ?>
Well I removed the “Display none” from the first part of the code and that made it show up but none of the states are showing. Here is the code for that area.
If I remove the “Display none” on the second part of that code and added it back to the first part of the code would they be able to manually enter their state. I would try this myself but it’s on a live site with a lot of visitors right now........
or does anyone else know how to make the states show up???
Uhm, It’s not impossible to do that, but the database of Magento just has the regions of some countries, such as US, CA, DT, FR.... If you want to display them, you must write some scripts in the “onchange()” event of country select box (when user change the country, the state /province will be changed , correlated with the country),
You can consult my solution:
- display the US state/province:
+ replace this:
+ if the user is not in US, he/she can input their choice in the textbox.
- If you want the state/province to auto-change when the country changed, you can write some AJAX code to do this. (now I have not much time, so you can try yourself:D ), use that function to change the country_code when user changes the country:
$this->setData('country_id','US'); // replace 'US' by 'FR'.,or something.., default is 'US'
then getRegionCollection() to print out the state/province.
i´m using 1.3.1, and enabeling the whole Data form with the working region_id field is quite easy:
in the “register.phtml” delete or comment out the line:
<?php if($this->getShowAddressFields()): ?>
and also <?php endif; ?>
then go to .....template/customer/address/edit.phtml
and copy the javascript snippet at the end of the file, because it changed, or use this and overwrite the script at the end of register.phtml
New script from edit.phtml:
<script type="text/javascript\">
var dataForm = new VarienForm(’form-validate’, true);
new RegionUpdater(’country’, ‘region’, ‘region_id’, <?php echo $this->helper('directory')->getRegionJson() ?>);
</script>
I tried what you were talking about with the edit.phtml script but that didn’t make the states show up. I was assuming I needed to change the “display: none” and that made the box show up but there are no states in it. Can you explain what you were referring to when you said “enabling the whole Data form with the working region_id field”
OK so as the weeks went by I have worked out by searching through the forum and by sheer guesswork, how to make my registration page work for me with required and non required fields behaving and looking good.
However none of the changes I made to register.phtml seem to have made any difference to the ‘checkout address’ form / customer ‘add new address’ form. Do these forms work from a different file or files somehwere else where I will have to duplicate the changes I made to register.phtml in oder for them to work here also?
Please please somebody help. This is delaying the launch of my site.
Screenshots attached again.
First picture: shows revised and working registration page (modern theme)
Second picture: shows ‘add new address’ form - changes to register.phtml having made no effect at all.
Lastly - what is the function of address.phtml? Altering this - in fact deleting this file makes no difference to function of the site as far as I can see!!!
Yes, in Magento ver. 1.3.2.3 the following code working. I just add $this->setShowAddressFields(true); before <?php if($this->getShowAddressFields()): ?>
OK so I have been away and have just got back to sorting this out.
I did as suggested and added code as Saskia suggested at correct place BUT When United Kingdom is selected there is STILL no drop down box of counties (states if l you prefer that description) so my customers in the UK still have to add their county/state details manually. Drop down box works great for US, Switzerland, Germany, etc but nothing for UK! Surely there must be a way to show not only a drop down box for UK but also the counties/states or at least a way to add states so that they are selectable from drop down box.
If counties/states are not included in the stock magento databse then they should be ad if not then please could somebody show me how to add them.
Hope I am explaining myself here. How have other UK users managed?