Jump to content

Batch Child Editor


adrian

Recommended Posts

This is  a s lightly obscure issue, but hopefully very easy to deal with. If a page only has one child, then the child doesn't necessarily have a sort attribute. In this case, BatchChildEditor will add a sort attribute and save the page. This seems to me to be unnecessary (and is causing a small problem with a module of mine). Is it possible and reasonable to not set the sort if there is only one child?

The relevant code is at the end of the saveChildren() method:

$cp->sort = $i;

if($cp->isChanged()) {
    $cp->of(false);
    $cp->save();
}

I think it would need something like:

if($this->wire('input')->post->individualChildTitles->count() > 1) {
    $cp->sort = $i;
}

if($cp->isChanged()) {
    $cp->of(false);
    $cp->save();
}

but maybe there is a better solution?

  • Like 1
Link to comment
Share on other sites

Hi @MarkE - looking at the pages DB table, it seems that in reality I should just be setting the sort values starting at 0 and not 1. Not sure why I set it up this way - seems like generally it doesn't matter, but setting the first child page to 0 should work for you I believe. 

I have made that change for the latest version - can you let me know how it goes for you please?

  • Like 1
Link to comment
Share on other sites

Hi @virtualgadjo - it's only one language at a time IIRC. The problem with multiple is how to arrange the data in the export. Different users will need different layouts so it's best to generate these sorts of exports yourself. I tend to use AdminActions to create these sorts of custom imports.

  • Like 1
Link to comment
Share on other sites

hi @adrian

and thanks a lot for your answer, i'll try tu use AdminActionh for this too, didn't think of this although i often use AdminActions for many other purposes 🙂

i've solved my current problem using batch child for the fields i need in the default language adding the page id to the field list and using Ryan recent ProcessLanguageFieldExportImpor to export the multi language ones then i just had to agregate both csv based on the page ids

you're right, my first thought was to write my own code but pw does so many things "by itself it must have made me a little lazy 😀

have a nice day
 

Link to comment
Share on other sites

  • 1 month later...

I'm trying to export to csv a list of current member users. There seems to be no way to do this without listerPro. Does Batch Child Editor allow you to export any admin pages?

/EDIT

I was looking in the wrong spot. I was looking for export function under Access > Users in the drop down on the top bar but when I went to Admin > Access > Users -- Edit in the page tree, I was able to make it work. For anyone looking for that functionality maybe that helps.

Thanks Adrian.

Link to comment
Share on other sites

Not sure what you are making work via Admin > Access > Users, because to get BCE to work here like that, I need to replace line 185 with:
 

        if(!$this->data['allowAdminPages'] && (!in_array($this->editedPage->id, $this->wire('config')->usersPageIDs) && ($this->editedPage->template->flags & Template::flagSystem))) return;

 

Link to comment
Share on other sites

54 minutes ago, adrian said:

Not sure what you are making work via Admin > Access > Users, because to get BCE to work here like that, I need to replace line 185 with:
 

        if(!$this->data['allowAdminPages'] && (!in_array($this->editedPage->id, $this->wire('config')->usersPageIDs) && ($this->editedPage->template->flags & Template::flagSystem))) return;

 

Don't know buddy, I guess you're just that good. 😊

 

Screen Shot 2023-03-17 at 12.33.08 PM.png

Screen Shot 2023-03-17 at 12.33.46 PM.png

Link to comment
Share on other sites

  • 2 weeks later...

Hey Adrian,

New issue, different project. I set up a tracking system for a client that wanted to keep a record of all downloads of a certain file they offer on their site. Only logged in users can access the file and on download a page is created under user tracking showing the user name, date of dl etc.

They also wanted to export that list as a csv so I'm using Batch Child Editor to give them that function and it worked well for a while but now there's 6800 ish pages in user tracking and whenever they attempt to export it throws an error: Error: Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away.

They are on shared hosting so resources are limited so I told them that with the csv they have they should delete the older pages but even that fails so I had to use phpMyAdmin.

Lister has no problem handling the volume but BCE does so are you aware of a limit to BCE and is there a way around it?

------------

I believe the issue is that the BCE editor is displaying all of the child pages at once and with so many, that's what chokes it. If it's possible to implement some kind of pagination it should fix the problem.

Edited by digitex
Link to comment
Share on other sites

  • 2 weeks later...

Hi @digitex - you're right about the displaying of all the child pages - this module really doesn't work well in edit with lots of children - poor design on my part :)

That said, I think if you disable edit mode for branches with lots of children, you should be able to offer the CSV export mode and I think it should be ok. It won't be as capable as Lister still because Lister batches exports whereas BCE tries to do all in one batch.

I really haven't used this module in a long time so I'm afraid I don't have much impetus to modify the export functionality, but hopefully it will work for you with edit mode disabled.

Link to comment
Share on other sites

  • 2 months later...
  • 5 months later...
On 12/13/2023 at 9:31 PM, adrian said:

The field pairings is only available from the Settings tab of those pages selected under Configurable pages. Does that help?

I want to update map data on City pages and I followed your instructions from here:

This is how my settings in city's parent page looks like:

659716071_Kepernyofoto2023-12-15-10_16_14.thumb.png.2f9d80c8a7cc583e76a64bf5b1b2026a.png

The format of the CSV what I uploaded:

City1 name,City1 name,41.88700499999999,-87.64885009999999
City2 name,City2 name,47.474851,20.5913671
City3 name,City3 name,79890229999999,20.0036779
...

After uploading the cities map data is empty. Could you help me?

 

Link to comment
Share on other sites

  • 1 month later...

Hey there,

I’ve been playing around with BCE. I love all its functionalities and will need it for a project very soon.

A quick question though : when in lister mode, you can define filters, and that’s great. But I could not find how to predefine blank filter. Imagine that my client will frequently use a filter on a field called "place". How can I get this filter ready to be filled, like "Place" + "contains texte like" + _blank_ ? Otherwise, he will always have to pick the right field and the right matching condition each time he lands on the page.
And BTW, is there any way to hide the filter "Parents" "equals" "id" ? Because this is implicit and my cause confusion to my client.

Many thanks in advance 😊

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...