Address attribute type
Permalink 1 user found helpful
I added an address attribute to a page type of mine, which populated the custom attributes section with two address fields, city, state, country and postal code. My problem is that the State/Province drop down box is not populated with any options, so I am unable to choose the appropriate state. Do these State/Province options need to manually be added in somewhere? Thanks, -Brian
bump... any ideas?
What version of Concrete5 are you running?
The values should be pulling from these files:
/concrete/helpers/lists/countries.php
/concrete/helpers/lists/state_provinces.php
The values should be pulling from these files:
/concrete/helpers/lists/countries.php
/concrete/helpers/lists/state_provinces.php
I'm running 5.3.3.1 - yeah that's strange, I see those files with the correct arrays in them, and it seems like the countries list is getting pulled in properly, but for states I only get the "Choose State/Province" option, nothing else.
I was having this same problem. seems like some of the javascript isn't being initiated. ended up finding a work around by adding this to my page type controller:
...and then this to my page type view:
<? if( $cp->canWrite() || $cp->canAdmin() ){ ?>
<script>
<? AddressAttributeTypeController::action_load_provinces_js(); ?>
</script>
<? } ?>
$c = $this->getCollectionObject(); $cp = new Permissions($c); if( $cp->canWrite() || $cp->canAdmin() ) $this->addHeaderItem( '<script type="text/javascript" src="'.DIR_REL.'/concrete/models/attribute/types/address/country_state.js" ></script>' );
...and then this to my page type view:
<? if( $cp->canWrite() || $cp->canAdmin() ){ ?>
<script>
<? AddressAttributeTypeController::action_load_provinces_js(); ?>
</script>
<? } ?>
If someone can shed some light on what files this code goes into I would appreciate it. I can't find a "page type" controller.
look for /controllers/page_types/my_page_type.php for the controller, and then /themes/my_theme_name/my_page_type.php for the view.
Tony, how would this work for the core commerce? Would I have to add this to the controller and page type within the corecommerce package?
yeah, probably, if that's where the error is occuring.
I am having the same issue on eCommerce address. Where specifically would i need to add the Code above?
Having the same issue: After I enabled the Address attribute for collections in the Dashboard, created a Page Attribute of type Address, and added it to a Page Type. When adding a page through the Dashboard the country Select List populates, but the State/Province Select List does not.
Do I need to create a controller file for my page and add Tony's code above to get this to work? I'm just trying to get it to work on the default page type for my theme - not a single page. Any help much appreciated.
Do I need to create a controller file for my page and add Tony's code above to get this to work? I'm just trying to get it to work on the default page type for my theme - not a single page. Any help much appreciated.
Same exact thing I'm looking for, editing address attribute for a normal page type (not single page). I tried Tony's steps above but could not get it to work properly, any ideas?
Hooray! Fortunately this seems to be fixed in 5.4.1b2.
Does this still apply to 5.4.2.1? I'm having a similar problem on my dashboard with attributes. I'd like to have all of the states & provinces entered without having to do them all manually!