Jump to content
adrian

Batch Child Editor

Recommended Posts

After test importing hundreds of pages in the last days I think BCE is a real time saver! Good job Adrian!

I still struggle with one feature though... since I have a lot of ProField Textareas to import to I have to use field pairings which works great, even with images, but the only location to configure field pairings are the parent pages.

This means I have to add each and every parent page to "Configurable Pages" in BCE settings. I can work with that but wouldn't make it more sense to make it template related? Since the template defines the fields to use then field pairings would be unique to a template?

I think I read something about this before in this thread but cannot find it anymore...

Share this post


Link to post
Share on other sites
On 16.11.2016 at 1:02 AM, adrian said:

Ok, the new version supports adding files and images. It works in both standard and field pairings modes. I haven't added support for descriptions/tags yet - will wait to see if anyone has the need.

It should work for local server paths to files/images, as well as remote urls.

Please test and let me know if you have any problems. 

While importing one image per field works fine I seem to be unable to import multiple images to an image field. The image field has no special setting and importing just one image works. 

I have tried with different separators(#, ##, \r, |) but to no avail. Strange, because this week I imported multiple values to an option field with no problems.

Did I miss something?

BCE 1.4.9 on PW 2.8.35 3.0.39

Edited by Klenkes
PW version change

Share this post


Link to post
Share on other sites

@mel47 and @Klenkes - not ignoring you guys - I will try to take a look at your issues/requests in a next few days.

  • Like 2

Share this post


Link to post
Share on other sites

just asking... could it be that it is not yet supported to import multiple images(separated with a delimiter) to an image field?

I went through the module code(not that I understand a lot of it but getting better) and couldn't find any reference to importing multiple images.

Share this post


Link to post
Share on other sites

Hi @mel47 and @Klenkes - sorry for the delay in dealing with your issues. I have implemented some fixes, but things are not well tested yet, so I am just going to attach the updated version to this post.

On 12/7/2016 at 7:26 PM, mel47 said:

Again me... I have a problem I couldn't understand. I created my CSV file with " " in each column :

"Article in Metabolic Brain Disease-Bosoi-2009";;"Accepted article";"Publication";2008-12-29 18:12:48;;"<p>Latest paper was published in Metab Brain Disease</p>";"<p>Latest paper was published online December 23<sup>rd</sup>.</p>";;;"Bosoi et al.-2009-MetabBrainDis"

The last field is Page. Everything imports fine (no error), but last field is imported as

Bosoi et al.-2009-MetabBrainDis"

Why it keeps this extra " ?

Thanks

Melanie

@mel47 - can you please test the attached version and let me know if it fixes it. I inadvertently deleted my line ending fix in a recent commit. It has been reinstated so hopefully that will take care of this for you.

 

On 12/8/2016 at 1:01 AM, Klenkes said:

After test importing hundreds of pages in the last days I think BCE is a real time saver! Good job Adrian!

I still struggle with one feature though... since I have a lot of ProField Textareas to import to I have to use field pairings which works great, even with images, but the only location to configure field pairings are the parent pages.

This means I have to add each and every parent page to "Configurable Pages" in BCE settings. I can work with that but wouldn't make it more sense to make it template related? Since the template defines the fields to use then field pairings would be unique to a template?

I think I read something about this before in this thread but cannot find it anymore...

@Klenkes - I am not against this idea because I can understand the problems you are having. Unfortunately I think that would be a huge change to the module. I'll definitely think about it, but I can't promise a timely resolution for this I'm afraid - hope you understand!

 

On 12/19/2016 at 2:51 AM, Klenkes said:

just asking... could it be that it is not yet supported to import multiple images(separated with a delimiter) to an image field?

I went through the module code(not that I understand a lot of it but getting better) and couldn't find any reference to importing multiple images.

Yeah you were right - I never implemented the multiple values separator logic for files/images. The attached version should take care of this. I have tested with field pairings, but not without at the moment. Please let me know how it goes for you.

 

 

Edited by adrian
Removed attached version because it's now on Github
  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, adrian said:

 

@mel47 - can you please test the attached version and let me know if it fixes it. I inadvertently deleted my line ending fix in a recent commit. It has been reinstated so hopefully that will take care of this for you.
BatchChildEditor.zip

Perfect! Works as expecting when CSV is pasted.

Thanks again!

  • Like 1

Share this post


Link to post
Share on other sites
On 21.12.2016 at 2:43 AM, adrian said:

Yeah you were right - I never implemented the multiple values separator logic for files/images. The attached version should take care of this. I have tested with field pairings, but not without at the moment. Please let me know how it goes for you.

Ahhh...  new module name: ImportingMadeEasy! Absolutely great!
I tested with field pairing and it works without any flaws.

And no rush with the  "Configurable Pages" issue, or even if it is no doable. The way BCE now works is absolutely great and I can plan to migrate a few websites to PW.

Many thanks and have a great christmas holiday.

  • Like 2

Share this post


Link to post
Share on other sites

Hey all

This module works great. But, I do have one problem. I need to export most of the data on the website to a csv, but the site is in multiple languages available. And I need all the available languages in the same csv. Is there any option to fix this in the module or are there plans for this module to add an export option for multiple languages?

-Edit-

The website I currently use is build like this:

  • Products
    • Category
      • Product
      • Product
      • Etc...
    • Category
    • Etc.

Is it possible to export a csv file containing all the categories together with the products? Something like pages and sub-pages...

 

Thanks in advance,

 

Harmen

Share this post


Link to post
Share on other sites
6 hours ago, Harmen said:

And I need all the available languages in the same csv.

Hi @Harmen - how do you envision all the languages being formatted in the CSV - using a "|" or some other separator, or do you have some other approach in mind?

 

6 hours ago, Harmen said:

Is it possible to export a csv file containing all the categories together with the products? Something like pages and sub-pages...

Currently BCE only supports direct children of a page. I am not sure how to come up with a standardized approach for handling sub-pages/grandchildren in CSV format. Perhaps if you could explain (or provide an example) of how you'd like the CSV to look I could implement it, or you could provide a PR :)

  • Like 3

Share this post


Link to post
Share on other sites

Some of my thoughts but I really don't know if it's feasible or too much error-prone.

For sub-levels:

Having a new field (in the CSV): sub-levels. I discovered this approach in the Menu Builder module. However, since this field doesn't exist in template, it could be confusing if we forget to add it when add or replace data.

For multi-language:

According to me, it shouldn't use | since they are already use for many images/pages. Furthermore, I used CSV in Excel to fill quickly in column format, so I need different CSV fields. I guess the best option is having for example: body_en;body_fr. But I'm not sure how to order the CSV since there is maybe non-multi-language fieldtypes in the template. And/or, since not applicable to CSV import-export, to add data, it could be a multilanguage area (it used when you edit a ML option's fieldtypes).


But I have no idea how those things works, so I let you decide how good they are...

  • Like 1

Share this post


Link to post
Share on other sites

Hey @adrian

Thanks for your reply. I've asked my contractor how the csv file must be classified. He gave me an example which you can see in the attachment.

There is one product in the attachment, but the same needs to happen for all products and categories. Languages are seperated per column. Each product in a row, Same for categories. I hope this helps you, I will also think for a solution in the code of the module altough I don't have that much experience with exports to csv formats.

Note: With my 18 yrs I expect you're way better than me, but I will give it a try to think about it ;)

 

-Edit-

I wrote a module to get the categories and products (and more stuff) from the prestashop database and import the data in Processwire. What would be easier, write another piece of code in my module/or new module to get the data out of the database and directly import it to a csv file, or just make a csv file from the data in the Processwire fields?

 

Sorry for so many questions, still a bit newbie here I guess :D

example.xlsx

Edited by Harmen
Additional information
  • Like 1

Share this post


Link to post
Share on other sites

@adrian

Found a way to get the grandchildren into the csv file. You can find my code in the attachment. But I don't get all the data from the fields like image links and more. Maybe I've missed something? I guess it doens't get all the data, because the labels are different for the categories and products

-Still searching for multiple language-

 

ProcessChildrenCsvExport.module

Share this post


Link to post
Share on other sites

Hi Harmen,

Sorry it's taken me a while to respond to your post. I took a quick look at the code you added and I think all that logic needs to end up in a function that we can call for children and then again for grandchildren, rather than duplicating.

I am honestly wondering if this is a good fit for BCE because I am not sure that everyone will want the same formatting for grandchildren, although honestly I don't know how it looks yet, but grandchildren can have different templates/fields which would surely make a mess in a CSV?

I wonder if you'd be better off with something like a custom implementation using PHPExcel (https://github.com/PHPOffice/PHPExcel).

I do however agree with adding options for multilanguage support for exports. I don't expect this should be too difficult if we take the approach of a separate column for each language version of each field. 

Cheers,
Adrian

  • Like 1

Share this post


Link to post
Share on other sites

Hi Adrian,

No worries, it's ok. Good idea, functions are always good to use, less code easier to call.

I understand not everyone wants the same. Maybe an inputfield with radio buttons at the module info to check if they want to export the grandchildren too can fix it. You're right. It would be a mess, even my grandchildren pages don't have the same name as the fields of the child pages while the fields have the same type.

I will take a look at PHPExcel next week.

If you need any help during the development of multiple languages - message me ;) I will also search for a solution.

Regards,

Harmen

  • Like 1

Share this post


Link to post
Share on other sites

I am using this on one of my sites to export csv via the api and it all works fine except I am getting some spurious code at the start of each csv file - i.e:

<script>
var config = {"urls":{"root":"\/pw\/"

</script>

Can anyone help with where this might be coming from, I've done a search everywhere I can think of and can't find it.

Many thanks

Share this post


Link to post
Share on other sites

@Hantsweb - can you narrow it down to a certain branch of the page tree or does it happen everywhere on your site?

What version of PW? What version of this module?

What other modules do you have installed?

Share this post


Link to post
Share on other sites

On a multilanguage install if pages doesn't have the title filled for the user's language, BCE shows the title on the default language. This is good, but can be misleading because one can think that the title is filled but actually it's empty.

I could imagine a solution to notify the user about it, eg. like this:

bce-default-title.png

Perhaps there's a better solution, this was the first that came to me.

Share this post


Link to post
Share on other sites

@Hantsweb - any chance you have the SessionHandlerDB module installed?

@tpr - I wonder if in reality this should come under an overhaul for BCE to add multi-language support in general - maybe the edit interface needs tabs to make it possible to edit titles in all languages? Trouble is that I am really going to start running out of time for major module changes here. Anyone up for putting together a PR?

 

Share this post


Link to post
Share on other sites

I think a comprehensive multi-language support would be a really complex task. This tweak would require only adding an extra tag if the title is not in the current language.

Share this post


Link to post
Share on other sites

I think what @tpr says is right, I guess it could be super complex. 

I am also still a newbie in Processwire and don't know that much about programming as tpr, adrian etc etc

I am always available if anyone needs some help. In a few weeks my internship is over and school starts again for me, hoping to have time left then for PW...

  • Like 1

Share this post


Link to post
Share on other sites

@tpr  - it's implemented, although a little differently because I didn't want "default" taking up so much space in the input. I went with a warning icon and outside of the input so I could add a title tag to it.

I am checking if the "FieldtypePageTitleLanguage" module is installed before checking if there is a title in the user's language. Maybe one of the ML gurus can tell me if there is a better approach:

$this->modules->isInstalled("FieldtypePageTitleLanguage") && !$cp->title->getLanguageValue($this->user->language)

Let me know if this suits your needs.

Screen Shot 2017-01-10 at 4.34.49 PM.png

  • Like 2

Share this post


Link to post
Share on other sites

Thanks, working fine here. As for the snippet I think it's OK too. I usually check for multilanguage with something like this though I'm not sure it's a better approach.

if ($this->languages && $this->pages->find('template=language, check_access=0')->count() > 0)

 

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, tpr said:

Thanks, working fine here. As for the snippet I think it's OK too. I usually check for multilanguage with something like this though I'm not sure it's a better approach.


if ($this->languages && $this->pages->find('template=language, check_access=0')->count() > 0)

 

Thanks - I ended up changing a little anyway. I went with:

$titleMultiLanguage = $this->modules->isInstalled("FieldtypePageTitleLanguage") && $this->fields->get('title')->type == 'FieldtypePageTitleLanguage';

because I figured in this case we need to be sure that the "title" field type is actually set to "FieldtypePageTitleLanguage" or we'll get a non object error when I try to use getLanguageValue() on it. Sound ok?

Share this post


Link to post
Share on other sites

Well... sure :) 

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By d'Hinnisdaël
      Happy new year, everybody 🥬
      I've been sitting on this Dashboard module I made for a client and finally came around to cleaning it up and releasing it to the wider public. This is how it looks.
      ProcessWire Dashboard

      If anyone is interested in trying this out, please go ahead! I'd love to get some feedback on it. If this proves useful and survives some real-world testing, I'll add this to the module directory.
      Download
      You can find the latest release on Github.
      Documentation
      Check out the documentation to get started. This is where you'll find information about included panel types and configuration options.
      Custom Panels
      My goal was to make it really simple to create custom panels. The easiest way to do that is to use the panel type template and have it render a file in your templates folder. This might be enough for 80% of all use cases. For anything more complex (FormBuilder submissions? Comments? Live chat?), you can add new panel types by creating modules that extend the DashboardPanel base class. Check out the documentation on custom panels or take a look at the HelloWorld panel to get started. I'm happy to merge any user-created modules into the main repo if they might be useful to more than a few people.
       Disclaimer
      This is a pre-release version. Please treat it as such — don't install it on production sites. Just making sure 🍇
      Roadmap
      These are the things I'm looking to implement myself at some point. The wishlist is a lot longer, but those are the 80/20 items that I probably won't regret spending time on.
      Improve documentation & add examples ⚙️ Panel types Google Analytics ⚙️ Add new page  🔥 Drafts 🔥 At a glance / Page counter 404s  Layout options Render multiple tabs per panel panel groups with heading and spacing between ✅ panel wrappers as grid item (e.g. stacked notices) ✅ Admin themes support AdminThemeReno and AdminThemeDefault ✅ Shortcuts panel add a table layout with icon, title & summary ✅ Chart panel add default styles for common chart types ✅ load chart data from JS file (currently passed as PHP array) Collection panel support image columns ✅ add buttons: view all & add new ✅
    • By Pip
      Hi everyone!
      I'm trying out the Login/Register module for my site. Noted that the module assigns the newly registered user to login-register role. 
      Once you modify the login-register role's permissions, particularly adding page-edit, the new member role will be set to guest. 
      Thing is I'd like to grant my new users the power to create their own pages. Any advice? 
      Thanks. 
    • By Gadgetto
      SnipWire - Snipcart integration for ProcessWire
      Snipcart is a powerful 3rd party, developer-first HTML/JavaScript shopping cart platform. SnipWire is the missing link between Snipcart and the content management framework ProcessWire.
      With SnipWire, you can quickly turn any ProcessWire site into a Snipcart online shop. The SnipWire plugin helps you to get your store up and running in no time. Detailed knowledge of the Snipcart system is not required.
      SnipWire is free and open source licensed under Mozilla Public License 2.0! A lot of work and effort has gone into development. It would be nice if you could donate an amount to support further development:

      Status update links (inside this thread) for SnipWire development
      2020-07-03 -- SnipWire 0.8.7 (beta) released! Fixes some small bugs and adds an indicator for TEST mode 2020-04-06 -- SnipWire 0.8.6 (beta) released! Adds support for Snipcart subscriptions and also fixes some problems 2020-03-21 -- SnipWire 0.8.5 (beta) released! Improves SnipWires webhooks interface and provides some other fixes and additions 2020-03-03 -- SnipWire 0.8.4 (beta) released! Improves compatibility for Windows based Systems. 2020-03-01 -- SnipWire 0.8.3 (beta) released! The installation and uninstallation process has been heavily revised. 2020-02-08 -- SnipWire 0.8.2 (beta) released! Added a feature to change the cart and catalogue currency by GET, POST or SESSION param 2020-02-03 -- SnipWire 0.8.1 (beta) released! All custom classes moved into their own namespaces. 2020-02-01 -- SnipWire is now available via ProcessWire's module directory! 2020-01-30 -- SnipWire 0.8.0 (beta) first public release! (module just submitted to the PW modules directory) 2020-01-28 -- added Custom Order Fields feature (first SnipWire release version is near!) 2020-01-21 -- Snipcart v3 - when will the new cart system be implemented? 2020-01-19 -- integrated taxes provider finished (+ very flexible shipping taxes handling) 2020-01-14 -- new date range picker, discount editor, order notifiactions, order statuses, and more ... 2019-11-15 -- orders filter, order details, download + resend invoices, refunds 2019-10-18 -- list filters, REST API improvements, new docs platform, and more ... 2019-08-08 -- dashboard interface, currency selector, managing Orders, Customers and Products, Added a WireTabs, refinded caching behavior 2019-06-15 -- taxes provider, shop templates update, multiCURL implementation, and more ... 2019-06-02 -- FieldtypeSnipWireTaxSelector 2019-05-25 -- SnipWire will be free and open source Plugin Key Features
      Fast and simple store setup Full integration of the Snipcart dashboard into the ProcessWire backend (no need to leave the ProcessWire admin area) Browse and manage orders, customers, discounts, abandoned carts, and more Multi currency support Custom order and cart fields Process refunds and send customer notifications from within the ProcessWire backend Process Abandoned Carts + sending messages to customers from within the ProcessWire backend Complete Snipcart webhooks integration (all events are hookable via ProcessWire hooks) Integrated taxes provider (which is more flexible then Snipcart own provider) Useful Links
      SnipWire in PW modules directory SnipWire Docs (please note that the documentation is a work in progress) SnipWire @GitHub (feature requests and suggestions for improvement are welcome - I also accept pull requests) Snipcart Website  

       
      ---- INITIAL POST FROM 2019-05-25 ----
       
    • By Sten
      Hello
      Till now I hacked something with the twig template but it works no more with new PW versions so I look forward to create a module. I am working on a site in multiple languages : French, English, Italian, German, Spanish, Portuguese, Hebrew, Russian. The new posts are entered in any language with a field for language. Till now, I got twig files to get the translations with constants defined for each part of the pages.
      So I'd like to create a module to include theses files added according to the url /fr/en/...
      Have you some observations to do before I begin about the direction to take ?
      Thank you
    • By ukyo
      Mystique Module for ProcessWire CMS/CMF
      Github repo : https://github.com/trk/Mystique
      Mystique module allow you to create dynamic fields and store dynamic fields data on database by using a config file.
      Requirements
      ProcessWire 3.0 or newer PHP 7.0 or newer FieldtypeMystique InputfieldMystique Installation
      Install the module from the modules directory:
      Via Composer:
      composer require trk/mystique Via git clone:
      cd your-processwire-project-folder/ cd site/modules/ git clone https://github.com/trk/Mystique.git Module in live reaction with your Mystique config file
      This mean if you remove a field from your config file, field will be removed from edit screen. As you see on youtube video.
      Using Mystique with your module or use different configs path, autoload need to be true for modules
      Default configs path is site/templates/configs/, and your config file name need to start with Mystique. and need to end with .php extension.
      Adding custom path not supporting anymore !
      // Add your custom path inside your module class`init` function, didn't tested outside public function init() { $path = __DIR__ . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR; Mystique::add($path); } Mystique module will search site/modules/**/configs/Mystique.*.php and site/templates/Mystique.*.php paths for Mystique config files.
      All config files need to return a PHP ARRAY like examples.
      Usage almost same with ProcessWire Inputfield Api, only difference is set and showIf usage like on example.
      <?php namespace ProcessWire; /** * Resource : testing-mystique */ return [ 'title' => __('Testing Mystique'), 'fields' => [ 'text_field' => [ 'label' => __('You can use short named types'), 'description' => __('In file showIf working like example'), 'notes' => __('Also you can use $input->set() method'), 'type' => 'text', 'showIf' => [ 'another_text' => "=''" ], 'set' => [ 'showCount' => InputfieldText::showCountChars, 'maxlength' => 255 ], 'attr' => [ 'attr-foo' => 'bar', 'attr-bar' => 'foo' ] ], 'another_text' => [ 'label' => __('Another text field (default type is text)') ] ] ]; Example:
      site/templates/configs/Mystique.seo-fields.php <?php namespace ProcessWire; /** * Resource : seo-fields */ return [ 'title' => __('Seo fields'), 'fields' => [ 'window_title' => [ 'label' => __('Window title'), 'type' => Mystique::TEXT, // or InputfieldText 'useLanguages' => true, 'attr' => [ 'placeholder' => __('Enter a window title') ] ], 'navigation_title' => [ 'label' => __('Navigation title'), 'type' => Mystique::TEXT, // or InputfieldText 'useLanguages' => true, 'showIf' => [ 'window_title' => "!=''" ], 'attr' => [ 'placeholder' => __('Enter a navigation title') ] ], 'description' => [ 'label' => __('Description for search engines'), 'type' => Mystique::TEXTAREA, 'useLanguages' => true ], 'page_tpye' => [ 'label' => __('Type'), 'type' => Mystique::SELECT, 'options' => [ 'basic' => __('Basic page'), 'gallery' => __('Gallery'), 'blog' => __('Blog') ] ], 'show_on_nav' => [ 'label' => __('Display this page on navigation'), 'type' => Mystique::CHECKBOX ] ] ]; Searching data on Mystique field is limited. Because, Mystique saving data to database in json format. When you make search for Mystique field, operator not important. Operator will be changed with %= operator.
      Search example
      $navigationPages = pages()->find('my_mystique_field.show_on_nav=1'); $navigationPages = pages()->find('my_mystique_field.page_tpye=gallery');
×
×
  • Create New...