adrian Posted January 2, 2018 Author Share Posted January 2, 2018 Thanks @sodesign - looks like you are using a Page Reference field that only accepts a single value, under Details > Page field value type - is that correct? I think I must not have properly tested with Single. Can you please try replacing: if(!$pageMatch->id && $title!='') { with: if(!$pageMatch->id && $childFieldValue!='') { here: https://github.com/adrianbj/BatchChildEditor/blob/f3a77b5338fd69b14b939edbae9948f42af2fc14/BatchChildEditor.module#L1675 Please let me know if that works. Link to comment Share on other sites More sharing options...
sodesign Posted January 2, 2018 Share Posted January 2, 2018 Perfect, that's now working without error. Thank you for resolving this! 1 Link to comment Share on other sites More sharing options...
adrian Posted January 2, 2018 Author Share Posted January 2, 2018 4 minutes ago, sodesign said: Perfect, that's now working without error. Thank you for resolving this! No worries - thanks for reporting and helping to debug. I have committed a new version with this fix. 1 Link to comment Share on other sites More sharing options...
sodesign Posted January 3, 2018 Share Posted January 3, 2018 Just a quick follow-up to this - I have been importing more content in a tsv and ran across another issue. When the title of the page being matched contains a comma, the selector in the line above throws an error. $pageMatch = $this->wire('pages')->get("id=$options, title={$childFieldValue}"); An example page title is "Fixed Height, Loop Leg" - The error was from the Selector class, and the snippet included something to the effect of: "field: Fixed, value: Height " I think this was why I had used the selector value sanitizer method previously. I tried this: $pageMatch = $this->wire('pages')->get("id=$options, title={$this('sanitizer')->selectorValue($childFieldValue)}"); The import runs successfully, though I'm unsure if this might have knock-on effects elsewhere. 1 Link to comment Share on other sites More sharing options...
adrian Posted January 3, 2018 Author Share Posted January 3, 2018 Thanks again @sodesign - I have added that on that line, and also a few others. Please test the latest version. Link to comment Share on other sites More sharing options...
kixe Posted February 13, 2018 Share Posted February 13, 2018 (edited) @adrian Got this error after install and trying to edit a page. Error: Uncaught Error: Call to a member function getLanguageValue() on null in .../site/modules/BatchChildEditor/BatchChildEditor.module:860 The error occurs due to the fact there is no title field assigned to the page template. I think your module should handle this since its easy to remove title now with the $template->noGlobal option. .. and this one in the exported csv file after using the template you provided in the README.md <br /> <b>Notice</b>: Undefined index: configurablePages in <b>.../site/assets/cache/FileCompiler/site/modules/BatchChildEditor/ProcessChildrenCsvExport.module</b> on line <b>94</b><br /> <br /> <b>Warning</b>: in_array() expects parameter 2 to be array, null given in <b>.../site/assets/cache/FileCompiler/site/modules/BatchChildEditor/ProcessChildrenCsvExport.module</b> on line <b>94</b><br /> <br /> Edited February 13, 2018 by kixe 2nd error Link to comment Share on other sites More sharing options...
adrian Posted February 13, 2018 Author Share Posted February 13, 2018 Thanks @kixe - they should both be fixed now. Link to comment Share on other sites More sharing options...
kixe Posted February 13, 2018 Share Posted February 13, 2018 First is fixed. Thanks. While playing around getting still some notices: Notice: Trying to get property of non-object in .../site/assets/cache/FileCompiler/site/modules/BatchChildEditor/ProcessChildrenCsvExport.module on line 230 https://github.com/adrianbj/BatchChildEditor/blob/2e079d342ea56ac7be58ae2de4d6cdc1317eec0e/ProcessChildrenCsvExport.module#L230 check wire('fields')->$fieldName first Notice: Trying to get property of non-object in .../site/assets/cache/FileCompiler/site/modules/BatchChildEditor/ProcessChildrenCsvExport.module on line 161 https://github.com/adrianbj/BatchChildEditor/blob/master/ProcessChildrenCsvExport.module#L161 field label expected but field label is not required. Needs fallback to name. Link to comment Share on other sites More sharing options...
adrian Posted February 13, 2018 Author Share Posted February 13, 2018 Sorry about the other notices - I have never dealt with templates without a title field before. Any chance you feel like putting together a PR for these as you find them? Sorry, I am not going to have much time for my PW modules for a while. Thanks! Link to comment Share on other sites More sharing options...
kixe Posted February 14, 2018 Share Posted February 14, 2018 I ended up with the following simple template since I was just looking for a csv export/ download option. It works without any errors for any kind of field (repeaters included) <?php // template provides file download of some children data in csv format // export as CSV if $_GET['csv_export‘] == 1 is in url if(isset($input->get->csv_export) && $input->get->csv_export == 1) { // create data array $data = $page->children->explode(function($item){ return array( 'ID'=> $item->id, // page property 'Author' => $item->author->first()->name, // page field 'Length' => $item->timeslots? $item->timeslots * 30 : 0, // integer field 'Info' => $item->info // runtime markup field ); }); // set header header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=file.csv"); header("Pragma: no-cache"); header("Expires: 0"); $output = fopen("php://output", "wb"); foreach ($data as $fields) fputcsv($output, $fields); fclose($output); exit; } // display content of template with link to same page with appended csv_export=1 else { $page->_content = "<a href='./?csv_export=1'>Export Child Pages as CSV</a>"; //link to initiate export } 1 Link to comment Share on other sites More sharing options...
mel47 Posted February 15, 2018 Share Posted February 15, 2018 19 hours ago, kixe said: I ended up with the following simple template since I was just looking for a csv export/ download option. It works without any errors for any kind of field (repeaters included) <?php // template provides file download of some children data in csv format // export as CSV if $_GET['csv_export‘] == 1 is in url if(isset($input->get->csv_export) && $input->get->csv_export == 1) { // create data array $data = $page->children->explode(function($item){ return array( 'ID'=> $item->id, // page property 'Author' => $item->author->first()->name, // page field 'Length' => $item->timeslots? $item->timeslots * 30 : 0, // integer field 'Info' => $item->info // runtime markup field ); }); // set header header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=file.csv"); header("Pragma: no-cache"); header("Expires: 0"); $output = fopen("php://output", "wb"); foreach ($data as $fields) fputcsv($output, $fields); fclose($output); exit; } // display content of template with link to same page with appended csv_export=1 else { $page->_content = "<a href='./?csv_export=1'>Export Child Pages as CSV</a>"; //link to initiate export } Will be willing to test anytime!! I have tons of pages with repeaters to export in CSV... Link to comment Share on other sites More sharing options...
neosin Posted March 21, 2018 Share Posted March 21, 2018 I found a definite bug (latest module+pw 3.0.96) If you go to a page and click children, choose batch edit, choose "edit" mode (only one i tested) as the option and then in the list; edit some children in the modal and save those - the children titles in the parent will have no value set for "title" and in the batch list it now shows empty values where the titles used to be. It appears that the variable for title is not saving or updating properly. I was editing other fields but for some reason it made my titles blank when I didn't edit the titles... very odd. also the title in the actual children themselves is now empty (in English, French is fine) 1 Link to comment Share on other sites More sharing options...
adrian Posted March 22, 2018 Author Share Posted March 22, 2018 Hi @neosin - thanks for reporting - looks like it was a multi-language site bug that crept in at some point. Can you please try the latest version and let me know if everything looks ok now? Thanks! 1 Link to comment Share on other sites More sharing options...
neosin Posted March 22, 2018 Share Posted March 22, 2018 9 minutes ago, adrian said: Hi @neosin - thanks for reporting - looks like it was a multi-language site bug that crept in at some point. Can you please try the latest version and let me know if everything looks ok now? Thanks! updated and I can confirm the issue is resolved thanks. On a side note, I keep getting mixed up with the save buttons all over the place in the modal and the pages. Clicking save twice will take some getting used to. 1 Link to comment Share on other sites More sharing options...
Karl_T Posted May 21, 2018 Share Posted May 21, 2018 Hi @adrian, I have found an issue regarding page reference field. If the template does not contain title field and the page reference field is listed at the top, i.e. first template field, the module would fail to add/replace the correct value and show empty for that page reference field, while other position is working fine. Link to comment Share on other sites More sharing options...
mel47 Posted June 19, 2018 Share Posted June 19, 2018 On 8/29/2017 at 12:49 PM, adrian said: I decided to go ahead to do this so now you can specify exactly which pages will be exported. Hopefully others will find this useful also: Hi, Does this works in 1.8.10 (PW 3.0.106)? I don't see this selector. Thanks! Link to comment Share on other sites More sharing options...
adrian Posted June 19, 2018 Author Share Posted June 19, 2018 1 hour ago, mel47 said: Does this works in 1.8.10 (PW 3.0.106)? I don't see this selector. Yep, it works, but if you want it to appear at the time of export then you need to check "User override CSV settings" - otherwise it will use the selector defined on the page's settings tab. Does that make sense? Link to comment Share on other sites More sharing options...
mel47 Posted June 20, 2018 Share Posted June 20, 2018 18 hours ago, adrian said: Yep, it works, but if you want it to appear at the time of export then you need to check "User override CSV settings" - otherwise it will use the selector defined on the page's settings tab. Does that make sense? Hum, I really feel stupid. It's not there either. But to answer your question, nope for me it does make sense. Sorry... ? The description mentions only separator and stuff like this, nothing about page selector. I would never have activated this option since I don't really need/want to modify those options. But I guess if it works, I will be fine with that! ? Link to comment Share on other sites More sharing options...
adrian Posted June 20, 2018 Author Share Posted June 20, 2018 I think it's probably because you haven't defined the parent as a page that is separately configurable. Do that and you should be fine: Link to comment Share on other sites More sharing options...
mel47 Posted June 21, 2018 Share Posted June 21, 2018 OMG I finally find it! ? A little bit not user-friendly, unfortunately. So after activating this configurable settings page, I finally discovered under "settings" a "Batch child editor setting". After going back to my BCE tab, the page selector is now there. Strangely when I removed this specific page from configurable pages (just for testing), the settings section disappear, however the page selector/fields to export are still sticking to my export CSV in BCE tab. Thanks for your patience! 1 Link to comment Share on other sites More sharing options...
adrian Posted June 21, 2018 Author Share Posted June 21, 2018 22 hours ago, mel47 said: however the page selector/fields to export are still sticking to my export CSV in BCE tab. Thanks for noticing that - good catch. It should be fixed in the latest version. Sorry you're not finding it user-friendly - I agree it's become quite the behemoth in terms of config settings - it makes it very flexible it terms of the interface you can craft for your site editors, but I understand it can be a little unwieldy to configure. Link to comment Share on other sites More sharing options...
mel47 Posted June 22, 2018 Share Posted June 22, 2018 53 minutes ago, adrian said: Thanks for noticing that - good catch. It should be fixed in the latest version. Sorry you're not finding it user-friendly - I agree it's become quite the behemoth in terms of config settings - it makes it very flexible it terms of the interface you can craft for your site editors, but I understand it can be a little unwieldy to configure. The problem, IMHO, is the absence of mention in description of config. If it's written somewhere than these settings while appear in tab settings of a configurable page, I will not have search that much for it. But I don't blame, I have myself problems to well documenting my own code... ? At least someone else can now find the information if they search the thread. Link to comment Share on other sites More sharing options...
BFD Calendar Posted July 22, 2018 Share Posted July 22, 2018 Installed this module and didn't get it to work at first, now I'm stuck with an error "Error: Using $this when not in object context (line 907 of /var/www/clubmoral_com/site/modules/BatchChildEditor/BatchChildEditor.module) " when I go to the parent page from which I want to export children as csv. PW 3.0.98 Module version 1.8.12 Link to comment Share on other sites More sharing options...
adrian Posted July 22, 2018 Author Share Posted July 22, 2018 4 hours ago, BFD Calendar said: Installed this module and didn't get it to work at first, now I'm stuck with an error "Error: Using $this when not in object context (line 907 of /var/www/clubmoral_com/site/modules/BatchChildEditor/BatchChildEditor.module) " when I go to the parent page from which I want to export children as csv. PW 3.0.98 Module version 1.8.12 I think the issue is likely php 5.3 - is that the version you are using? Any chance you can upgrade? If not, let me know and I can make an adjustment to support 5.3 Link to comment Share on other sites More sharing options...
BFD Calendar Posted July 22, 2018 Share Posted July 22, 2018 Yes, it's PHP 5.4. It's a free fast unlimited hosting but they don't want to upgrade. In the meantime I used Ryan's new import/export module and already finished very well what I wanted to do (copy pages from one site to another). I don't think I'll need it on this site, but thanks anyway. 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