1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

SOLVED: Email after csv upload

Discussion in 'Community' started by dimoss, Apr 5, 2020.

  1. dimoss

    dimoss Well-Known Member

    Level: Community
    Hi,

    reading another thread and using the list csv plugin I manage to have automated email send after csv import.
    using the following:
    PHP:
    $config = JFactory::getConfig();
    $to = "xxxx@xxx.com";
    $subject = "Some text";
    $msg = "some text!";

    $res = FabrikWorker::sendMail(
       $config->get('emailfrom'),
       $config->get('fromname'),
       $to,
       $subject,
       $msg
    );
    However in the list csv plugin as the code run on every row multiple emails are sent.
    My question is how is it possible only one to be sent per import?
    Thanks.
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Did you try to put it into the "Import complete" part?
     
    dimoss likes this.
  3. dimoss

    dimoss Well-Known Member

    Level: Community
    That's it!
    Wrong placement of the code because I interpreted the tooltip differently :(
    Thanks @troester
     
  4. troester

    troester Well-Known Member Staff Member

    Level: Community
    The IMPORT_COMPLETE_CODE_DESC text was wrong (obviously copied from START_CODE and not changed)
     
    dimoss likes this.
  5. dimoss

    dimoss Well-Known Member

    Level: Community
    Thanks again!
    By the way would it be possible to grab the number of imported rows somehow?
     
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
    I assume it's somewhere (I don't have an example, doesn't it show a message with x rows imported?).
    Try to var_dump $listModel->data or $listModel->getData(), maybe it's there.
     
    cheyennemtnman likes this.
  7. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Can this be done on exporting to a csv file as well?
     
  8. dimoss

    dimoss Well-Known Member

    Level: Community
    Yes, the email function works also as it is for exports using list csv plugin.
     
    cheyennemtnman likes this.
  9. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Thank you!
     

Share This Page