Article form plugin and import CSV

rha2000

Member
Hello

I'm using "Article form plugin" and I want to import data from a CSV. Is there any way to import data into a list and create articles in Joomla realcionados with imported data?

The import is done, but though I use "Article form plugin" I does not create the articles in joomla.

Thanks
 
We don't currently automatically run form plugins when importing data in to a list.

It's something we've thought about doing, and with a quick look at the code, it might not be that hard. I can see a few things in the article plugin which would need tweaking to work properly if called during a CSV import ... hmmm ...

I'm in the middle of something I really have to get finished tonight ... but if I get a little downtime, I may take a look at this.

Meanwhile, if you are in the mood to experiment, you can try this:

In ./components/models/importcsv.php, around line 763, should be this:

PHP:
                if (!in_array(false, FabrikWorker::getPluginManager()->runPlugins('onImportCSVRow', $model, 'list')))
                {
                    $rowid = $formModel->processToDB();
                    FabrikWorker::getPluginManager()->runPlugins('onAfterImportCSVRow', $model, 'list');
                }

... modify it to add a line to call the form plugins ...

PHP:
                if (!in_array(false, FabrikWorker::getPluginManager()->runPlugins('onImportCSVRow', $model, 'list')))
                {
                    $rowid = $formModel->processToDB();
                    FabrikWorker::getPluginManager()->runPlugins('onAfterImportCSVRow', $model, 'list');
                    FabrikWorker::getPluginManager()->runPlugins('onAfterProcess', $formModel, 'form');
                }


I really have no clue if that'll work, but its worth a shot. Note that this will run any plugins on that form which happen "onAfterProcess", like sending out emails, etc. So if there's any you don't want running during the import, you should disable them (unpublish) while you run the import.

If you try this, I STRONGLY suggest you back your site/db up first. And make a copy of the fileyou are editing, so you can replace it with the original if doesn't work.

-- hugh
 
The problem I found is that when you import does not save the title in joomla article.

in "saveAritcle" (plugins / fabrik_form / article / article.php)
...
foreach ($ attribs as $ attrib => $ default)
{
$ elementID = (int) $ params-> get ($ attrib);
$ data [$ attrib] = $ this> findElementData ($ elementID, $ default);
}
...

the code:
$ this> findElementData ($ elementID, $ default);

did not find the title, although the "elementID" is correct.

Any idea?
 
So everything else worked OK? That's encouraging.

The title may have something to do with the generateNewTitle() method.

I'll take a look as soon as I get some time, but I have quite a few paying sub issues I have to deal with atm.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top