neosin Posted April 4, 2018 Share Posted April 4, 2018 I've imported a batch of data but for whatever reason when switching language on the site, I can't get the other language data to appear. The data exists and is editable in the admin but even editing & re-saving the record data has no effect to make it display. To do a test I created a page along the imported records in the admin under the parent I need it in and this page displays proper data in both languages. There must be a setting or field required that I forgot to add to make it work properly? Here is the import script loop $fr = $languages->get("fr"); while($row = $result->fetch_assoc()) { $program_id = wire("sanitizer")->text($row['program_id']); $p = wire('pages')->get("template=legacy-programs,program_id={$program_id}"); $title_en = \Encoding::toUTF8($row['title_en']); $title_fr = \Encoding::toUTF8($row['title_fr']); if($p->id > 0){ // Item exists, was it updated? if($p->date_updated != date('Y-m-d H:i',strtotime($today))){ $p->of(false); $p->title = $title_en; $p->setLanguageValue($fr,'title',$title_fr); $p->program_id = $program_id; $p->setName($program_id); $p->setName($program_id, 'fr'); $p->save(); }else{ continue; } }else{ // Item doesn't exists, create it. $p = new Page(); $p->template = "legacy-programs"; $p->parent_id = 2245; $p->of(false); $p->title = $title_en; $p->setLanguageValue($fr,'title',$title_fr); $p->program_id = $program_id; $p->setName($program_id); $p->setName($program_id, 'fr'); $p->save(); } } This work great in the admin, I can see the data and edit it but for some reason it will not display the french version fields on the front end. The records show that they are published and visible/searchable in record settings. Link to comment Share on other sites More sharing options...
adrian Posted April 4, 2018 Share Posted April 4, 2018 Are the other languages active? on the settings tab of the page? You should set the status for each language to active during the import. Or after the fact you can do with the AdminActions module's "Page Active Languages Batcher" feature. 1 Link to comment Share on other sites More sharing options...
neosin Posted April 4, 2018 Author Share Posted April 4, 2018 7 minutes ago, adrian said: Are the other languages active? on the settings tab of the page? You should set the status for each language to active during the import. Or after the fact you can do with the AdminActions module's "Page Active Languages Batcher" feature. aha yes I see that the "active" is not checked for the url of the french versions. I thought this was only for the URL when visiting that link, so I was under the impression the data would still be accessible/visible. thank you for the quick diagnosis much appreciated if anyone else is curious or needs details on setting active by API 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now