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

hursey013
 
hursey013 replied on at Permalink Reply
hursey013
bump... any ideas?
ryan replied on at Permalink Reply
ryan
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
hursey013 replied on at Permalink Reply
hursey013
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.
Tony replied on at Permalink Best Answer Reply
Tony
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:

$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>
<? } ?>
WebStudioEast replied on at Permalink Reply
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.
Tony replied on at Permalink Reply
Tony
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.
dsdev replied on at Permalink Reply
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?
Tony replied on at Permalink Reply
Tony
yeah, probably, if that's where the error is occuring.
chrisjterrell replied on at Permalink Reply
chrisjterrell
I am having the same issue on eCommerce address. Where specifically would i need to add the Code above?
goldfish replied on at Permalink Reply
goldfish
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.
hursey013 replied on at Permalink Reply
hursey013
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?
goldfish replied on at Permalink Reply
goldfish
Hooray! Fortunately this seems to be fixed in 5.4.1b2.
KenHarvestClouds replied on at Permalink Reply
KenHarvestClouds
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!