PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

edit the newsletter csv export file?

11 replies to this topic
#1
Lpeek

    PrestaShop Newbie

  • Members
  • Pip
  • 20 posts
Does anyone know where the code is for the export of csv files in the newsletter module? I cant find anything anywhere, and theres is no reference to it in the blockNewsletter module???

I need to change what fields are exported in the csv file as the defult prestashop settings dont work with any email marketing software like mail chimp or constant contact.
Trashy Art - Handmade Kitsch Jewellery from the UK.

#2
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
The _getBlockNewsletter function in modules/newsletter/newsletter.php gets the newsletter data and the _postProcess function writes the CSV file.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#3
FunnyBunnyHelena

    PrestaShop Newbie

  • Members
  • Pip
  • 19 posts
I am sorry for bringing up this old topic, but I want to modify too..

But I have NO clues about PHP, sorry.

I want to have the output list of ONLY email addresses and nothing else.
I use Eudora and I have yet to figure out how to import things there. I only get one box that asks for PST files.

#4
Patric Codron

    PrestaShop Superstar

  • PrestaTeam
  • 9152 posts
If you want to export the e-mails of the regitered persons, you can use the dedicated module :
Back Office >> Modules
Newsletter (section Tools)
Configure >>
Patric CodronCommunity Manager | Manager de CommunautéPrestaShop

Posted Image Merci de respecter les règles du forum PrestaShop.com :)
Posted Image Please comply with the PrestaShop.com forum rules :)

#5
FunnyBunnyHelena

    PrestaShop Newbie

  • Members
  • Pip
  • 19 posts
But that's what I am doing, and the result file contains fields I do not wish to be there, I just want a file with email addresses only, no other data. (such as name, date, ip )

#6
MrBaseball34

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 1109 posts
Geez man, it's a CSV file, open it in Excel and remove the fields you don't want, then save it again.

#7
FunnyBunnyHelena

    PrestaShop Newbie

  • Members
  • Pip
  • 19 posts
I don't have Excel installed.. :P

#8
MrBaseball34

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 1109 posts
OK, then to make it only export the emails, you must modify the newsletter.php file. Can you handle that?

Change this code, around line 112:

private function _getBlockNewsletter()
{
$rq = Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'newsletter`');
$header = array('id_customer', 'email', 'newsletter_date_add', 'ip_address');
$result = (is_array($rq) ? array_merge(array($header), $rq) : $header);
return $result;
}

to this:

private function _getBlockNewsletter()
{
$rq = Db::getInstance()->ExecuteS('
SELECT email
FROM `'._DB_PREFIX_.'newsletter`');
$header = array('email');
$result = (is_array($rq) ? array_merge(array($header), $rq) : $header);
return $result;
}


#9
MrBaseball34

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 1109 posts
I find that code very strange because I don't see a table called ps_newsletter in ANY of my installations. v1.25, v1.3.0.1 or v1.3.1.

#10
FunnyBunnyHelena

    PrestaShop Newbie

  • Members
  • Pip
  • 19 posts
Thank you for your help.

#11
Patric Codron

    PrestaShop Superstar

  • PrestaTeam
  • 9152 posts

From 1280843968:

I find that code very strange because I don't see a table called ps_newsletter in ANY of my installations. v1.25, v1.3.0.1 or v1.3.1.


This is because you do not have the Newsletter block module installed.

I would recommand using OpenOffice Calc (free) instead of Excel to manage CSV files.
Patric CodronCommunity Manager | Manager de CommunautéPrestaShop

Posted Image Merci de respecter les règles du forum PrestaShop.com :)
Posted Image Please comply with the PrestaShop.com forum rules :)

#12
MrBaseball34

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 1109 posts
Well, I thought we did but, whatever...Thanks.