run form plugins when importing CSV

mahmoodee

Member
Hello,
I have used J2store form plugin to create products .
I want create products when import csv to list , so I add this code to ./components/models/importcsv.php to run j2store form plugin when import csv
Code:
FabrikWorker::getPluginManager()->runPlugins('onAfterProcess', $formModel, 'form');
But it work only for the last row in CSV .
It is creating product only for the last row , so how I can run form plugin for each CSV row , not only for last row .
thank you
 
The best place to do anything with a CSV import or export is with the 'listcsv' plugin (you'll have to install it from our downloads section, or discover/install it if you've done a github update).

This plugin allows you to run code at every stage of the import - before it starts, before and after every row import (with the ability to skip a row import), and after it finishes.

You should be able to do ...

Code:
$listModel = $this->getModel();
$formModel = $listModel->getFormModel();

... and then do whatever you need to do from there.

-- hugh
 
The best place to do anything with a CSV import or export is with the 'listcsv' plugin (you'll have to install it from our downloads section, or discover/install it if you've done a github update).

This plugin allows you to run code at every stage of the import - before it starts, before and after every row import (with the ability to skip a row import), and after it finishes.

You should be able to do ...

Code:
$listModel = $this->getModel();
$formModel = $listModel->getFormModel();

... and then do whatever you need to do from there.

-- hugh

I have downloaded listCSV plugin.
Do you mean I must create file like (create_client_user.php example) to create products.
It is difficult for me to do that ,
I am searching on a way to run form j2store plugin when import csv without writing new code .
Is there a way in listCSV plugin to run form j2store plugin ?
thank you
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top