Jump to content

Recommended Posts

Phplistsync Module synchronize the customers of Prestashop with PHPList, a well known newsletter software written in PHP.

All the new customers added in Prestashop are copied to the PHPList database. The customers that have chosen to not receive any newsletters are copied to PHPList anyway but they are flagged as "disabled". This is important in order to preserve the coherence between databases.
Every modification made on the customers choice regarding the newsletter notification will change the state of this flag in PHPList at each synchronization.

Is a first release, so please be aware of possible bugs.

Here is the link to the module:
http://www.prestashop.com/forums/viewthread/19859/programmazione_moduli_design_e_temi/modulo_phplistsync/

Thanks

Share this post


Link to post
Share on other sites
  • 3 weeks later...
  • 2 weeks later...

Star, too kind from you!
No I haven't planned to set up a donation box, should I have done? ;) hehehe

I consider your proposal like one of the most gentle appreciation to my work! Thank you very much!
In any case you don't have to worry, enjoy my module for free, I'm happy to know that someone has found it very useful.
Think that, at the moment, I don't even need it personally! ahaha

I'll call you for a drink if I ever come to the beautiful California! ;)


Newest thanks to you as well!

Share this post


Link to post
Share on other sites

Hi,

Is there a way we can put a selection link or button for the prefer HTML format on the front of the news sub block and connect it to the phplist module?

Very appreciate your work.

9281_c1Y4HLzBPEsvqxDoYZfQ_t

Share this post


Link to post
Share on other sites

Hi Newest,
the option to prefer HTML format or plain text format is something that has not been considered in Prestashop's users information.

Another issue is that the block newsletter works in a total stand alone way.
A new table different from the one containing the customers of your shop is created when you install this block and the emails subscribed through this block are just saved as a sample email archive.
The Phplistsync module synchronize Phplist with the customer that have choose to receive newsletters on their profile and not with this list of addresses of "unknown" people.

I didn't consider this newsletter block because in Italy, as it is, is also out law since it should have a discalimer informing the subscriber about his privacy rights.

Also if a customer subscribe himself to the newsletter and then register his account choosing to not receive any newsletter the situation is confused because on the customer table the receipt of newsletter is disabled and on the other table i enabled... what's the right one?

I think the best thing to do is to take things from the opposite side.
Phplistsync is useful because we need to keep the customer DB synchronized with the newsletter application when a new subscriber register himself in your shop in order to became a customer (in this case we need to register the users in both Prestashop and Phplist).
If you just want to handle email addresses of people that just want to be informed about your commercial activities you don't need to involve Prestashop, you just need to register the users in your newsletter application, so Phplist.
To do this you could modify the newsletter block in order to post your users data directly to a subscriber page that you have created in Phplist, in this way you can also handle the HTML or plain text option with all the other features of Phplist subscription steps.

Share this post


Link to post
Share on other sites
Hi Newest,

I think the best thing to do is to take things from the opposite side.
Phplistsync is useful because we need to keep the customer DB synchronized with the newsletter application when a new subscriber register himself in your shop in order to became a customer (in this case we need to register the users in both Prestashop and Phplist).
If you just want to handle email addresses of people that just want to be informed about your commercial activities you don't need to involve Prestashop, you just need to register the users in your newsletter application, so Phplist.
To do this you could modify the newsletter block in order to post your users data directly to a subscriber page that you have created in Phplist, in this way you can also handle the HTML or plain text option with all the other features of Phplist subscription steps.


Thank you. Will try your suggestion. Thanks

Share this post


Link to post
Share on other sites
Star, too kind from you!
No I haven't planned to set up a donation box, should I have done? ;) hehehe

I consider your proposal like one of the most gentle appreciation to my work! Thank you very much!
In any case you don't have to worry, enjoy my module for free, I'm happy to know that someone has found it very useful.
Think that, at the moment, I don't even need it personally! ahaha

I'll call you for a drink if I ever come to the beautiful California! ;)


Newest thanks to you as well!


That is so nice of you Sir,

Thank you very much.

Share this post


Link to post
Share on other sites

Hi mannybiker,

I am new here. I know phplist is a very good program. Thank you for doing it.

I have a question. I just work for this company for 2 days. I am very new, I need to shine, you know. My boss wants to move the newsletter block to the center AND the footer. Do you know how can i move the newsletter block to the center of the home page? And to the footer? I am very appreciated your help.

Share this post


Link to post
Share on other sites

google-friend, try to check if what you are searching is in the Back End, tab Modules, menu Position in the left up corner. There you can change the position of your blocks.

Share this post


Link to post
Share on other sites
google-friend, try to check if what you are searching is in the Back End, tab Modules, menu Position in the left up corner. There you can change the position of your blocks.


Thank you. I tried all ways. But I think it can not move to the center page. I am able to move it to the home page, butno luck to move to center page.


Thank you for your help.

Share this post


Link to post
Share on other sites
  • 1 month later...

please help.....I'm getting this message when I'm trying to configure...Warning: Invalid argument supplied for foreach() in /vhost/vhost8/b/b/e/bbe-boutique.co.uk/www/modules/phplistsync/phplistsync.php on line 76
using version 1.2.0.1 - 0.071s

Share this post


Link to post
Share on other sites

Hi mannybiker

your module is very interesting

I have installed it, as well as phplist.

imports of csv file went ok

When i used “check db” it tells me one customer needs to be added and no customer needs to be updated. everything is ok up to here.

however when i do “synchronize db” I get an insert error. The user has full rights on the db

any idea ???

thanks in advance

puo respondere in Italiano, Inglese o Francese. grazie

Share this post


Link to post
Share on other sites

Belle&Blackley;, at line 76 the script try to list, on the listbox showed in the configuration form, the lists of distribution available in phplist (the default one should be "test").
Since this is the first action done on the phplist DB, the problem could be that the query, that should read the list information on the DB, goes wrong somewhere, probably because it does not find the Phplist DB. Try to double check the install procedure, there some constants that need to be set _PHPLIST_DB_ and _PHPLIST_PREFIX_ and also verify that de phplist db is installed on the same instance of Prestashop DB and it has the same access rights.

Hope this help.

Share this post


Link to post
Share on other sites

Ciao jhugues,

innanzi tutto grazie per l'interesse e complimenti per tutte le lingue conosciute. ;)

Il problema sembra arriare da questo insert:

INSERT INTO _PHPLIST_DB_+_PHPLIST_PREFIX_user_user (email, confirmed, uniqid, blacklisted, entered, htmlemail, disabled, foreignkey)
VALUES ("$user['email']", 1, Uniqid(), $active, NOW(), 1, $active, $user['id_customer']);

dove:
$user['email'] = in base al valore recuperato dal DB Prestashop e dal campo email (stringa)
Uniqid() = un ID unico generato dalla funzione nel modulo (stringa)
NOW() = data e ora corrente (datetime)
i$active = in base al valore recuperato dal DB Prestashop e dal campo newsletter, 0 se non inscritto, 1 nel caso contrario (numerico)
$user['id_customer'] = in base al valore recuperato dal DB Prestashop e dal campo id_customer (stringa)

Per prima cosa verificherei che i campi della tabella phplist_user_user (se hai mantenuto i prefissi di default) siano presenti e che siano dello stesso tipo indicato, controlla che sia stato creato il campo foreignkey durante il primo import (controlla la procedura di install che ho scritto al punto 8)

Poi potresti provare a eseguire il comando di insert qui sopra modificando manualmente le variabili con dei valori di prova per vedere che errore viene generato (io uso MySQL Query Bowser) tipo:

INSERT INTO phplist_user_user (email, confirmed, uniqid, blacklisted, entered, htmlemail, disabled, foreignkey)
VALUES ("test@test.com", 1, "81d7ba7f1b672821c6c16a15836d4b5f", 1, 2009-05-30 00:14:04, 1, 1, 15);

Purtroppo non potendo riprodurre il tuo problema non riesco a darti indicazioni più precise.
Spero di esserti stato di aiuto.

Share this post


Link to post
Share on other sites

Bongiorno et grazie per la sua risposa,

Prosegue in Inglese perche ci sono altri che possono avere interessi in questo problemo.

I have found that if I remove the "Unique" attribute of the email index in phplist table (and select INDEX) I eliminate the problem.
I looks like it is not possible to enter a user with the same email, although this should not be a problem since Phplist checks for doubles when sending the mail.

To improve the module, I would recommend you test for the $return code (back from the sql request) to determin what the error was and act upon it or at least tell us what the error is.

As I said your module is great complement to PS and I like the way you built it. Simple and graceful like many Italian designs!

Share this post


Link to post
Share on other sites

Hi jhugues and thanks again for your kindly appreciation.
I'm happy to know that you have found the problem.

From my point of view the fact that you cannot have a duplicate email it is correct, since in prestashop people could only subscribe once with a certain email.
I also tried to do my work without modifing the code from phplist and prestashop, since I tried to create a module that works in most cases and without asking to the users to use a non-standard version of the programs or DBs involved in the job. I think you could understand my opinion.

In anycase you are right regarding the return code, it is something that I wanted to add when I created the error function. The insert error was just a placeholder to put then a real error code, but I haven't found the time to do it yet! Very sorry about that! I will try to implement it in the next release.

Thanks for your interest!

Share this post


Link to post
Share on other sites

I totally agree with you with the fact that one should try to avoid modifying the db or ps code.

I am looking forward to the next release of your module.

In the meantime I am happily using it !

Thanks

Jean.

Share this post


Link to post
Share on other sites
  • 4 months later...

je parle mal l'anglais et l'italien
comment faire pour regler ce probleme voici le message

Table 'ps.phplistdbphplist_user_user' doesn't exist

select id from phplistdbphplist_user_user where uniqid = "3218215c6a4206d675615001e1a298d6"

il y a a faire

Install the built-in Newsletter v2.0 module in order to export the csv file of your custormers for the first
Phplist DB initialisation.

mais je n'ai pas compris comment faire

si qq peut m'expliquer merci

cdlt
pat

Share this post


Link to post
Share on other sites

Salut patgame,

à l'installation de phplists il ne crée pas déjà ses tables des utilisateurs, donc il faut faire un premerir import.
Pour faire cela tu dois installer le module de default qui s'appel Newsletter et qui te permet d'exporter les inscrits de ton site Prestashop (meme un inscrit de test sufit) dans un fichier csv.
Apres tu pourras utiliser ce fichier dans la procedure d'import que tu trouve dans le panel d'administration de phplists entre les fonctions pour les utilisateurs.
Cette procedure va te demander quel methode utiliser, tu dois choisir importer les email avec differents valeurs pour les attributes et apres tu choisi ton fichier csv et tu suives la procedure.
A la fin tu auras importé donc tes inscrit et phplists sera initialisé pour se synchronizer avec Prestashop.
Le resultat final de l'operation est d'avoir créé les tables necessaires dans la base de données de Phplists, dont phplist_user_user fait partie.

Une chose bizarre que j'ai vu sur ton post c'est "Table ‘ps.phplistdbphplist_user_user’ doesn’t exist" où ps.phplistdbphplist_user_user par default devrait etre phplistdb.phplist_user_user.

Dans le fichier du module phplistsync.php t'as en haut ces deux lignes:

const _PHPLIST_DB_ = 'phplistdb';
const _PHPLIST_PREFIX_ = 'phplist_';

Si t'as pas modifier l'installation de default de Phplists tu devrais les laisser comme ça

Share this post


Link to post
Share on other sites

I don't get how to use this please help...

1: Have a Phplist installed on the same Prestashop webserver and use the same MySQL instance for both the DB's.


My PS database is called "aagadmin_db" and the phplist database is called "aagadmin_plst1"
Is that what I am supposed to do??

2: Copy the phplistsyc folder in your Prestashop/modules directory.


I have done this.

3: Open the file Phplistsync with an editor text in order to set _PHPLIST_DB_ and _PHPLIST_PREFIX_ constants, leave the default values if you have not changed the default DB prefix and DB name for Phplist.


Again, my PS database is called "aagadmin_db" and the phplist database is called "aagadmin_plst1." My PrestaShop database has the prefix 'ps_'. I assume that i can leave the default values and don't need to change anything, correct?

4: Install the module via the Prestashop administration panel.


I have installed the module in the Back Office without issues.

5: Install the built-in Newsletter v2.0 module in order to export the csv file of your custormers for the first Phplist DB initialisation.


Here is where it gets tricky. What if I do not have anybody in the ps_newsletter database yet? Do I have to import this particular database everytime??? What about the ps_customer database?

6: In Phplist admin panel create a list if you do not want to use the default one "test"


This is self-explanatory.

7: In Phplist admin panel proceed to import users and choose the first option "import emails with different values for attributes", select the list to add the emails to, the .csv file you have exported from Prestashop, type ; as field delimiter and select "Make confirmed immediately", then click import button.


Again, which csv are we talking about? The one from ps_newsletter or the ps_customers database? What if I don't have anything in the ps_newsletter database?

Where do I import the ps_customer database since all my customers (over 5300) are all listed in there and none are in the ps_newsletter yet, since the shop is not live yet. Do I have to copy all the emails from the ps_customer database and import them in the ps_newsletter database?

I am confused, please help.

Share this post


Link to post
Share on other sites

Hi sm3004,

1. You need to have both the dbs on the same MySql server, if you use phpadmin you shoudl see them within the list of DB

3. You don't need to care about PS's db name, instead you need to change PHPLIST_DB = "aagadmin_plst1" and the PHPLIST_PREFIX in order to match with the prefix you have given to your Phplists tables inside the db during its installation (defautl "phplist_").

4. ATTENTION, phplistsync does not sync with ps_newsletter but with the registered users that have agreed with receiving newsletter in the ps_customer, there is a difference between the two that make things confused. See this post http://www.prestashop.com/forums/viewreply/100849/

5. This step is needed since a fresh installation of Phplist does not create the useful tables for users until you create at least one user. For this reason a simple way to initialise this table is to import a csv created from the export of the registered users available inside your PS site. If you don't have any users you could just subscribe a test user to your brand new PS installation and then export it to csv. One user is enough for this purpose.

7. Again ps_customer. ps_newsletter is not taken in charge.

Hope this help.

Share this post


Link to post
Share on other sites

I don't know what I am doing wrong. I have installed it exactly as described, yet when I add a new customer by signing up on the website, the PHPlist does not sync with ps_customers.

- 1: Have a Phplist installed on the same Prestashop webserver and use the same MySQL instance for both the DB's.


They are both on the same MySQL server as you suggested... See the first screenshot for reference...

- 3: Open the file Phplistsync with an editor text in order to set _PHPLIST_DB_ and _PHPLIST_PREFIX_ constants, leave the default values if you have not changed the default DB prefix and DB name for Phplist.


I renamed _PHPLIST_DB_ to 'aagadmin_plst1' as you suggested and set _PHPLIST_PREFIX_ to 'phplist_' which is what I use as the prefix

- 5: Install the built-in Newsletter v2.0 module in order to export the csv file of your custormers for the first Phplist DB initialisation.


I had this already installed, so I didn't have to reinstall it. Is this what is causing the problem?

- 6: In Phplist admin panel create a list if you do not want to use the default one "test"


I deleted test and created a new one.

- 7: In Phplist admin panel proceed to import users and choose the first option "import emails with different values for attributes", select the list to add the emails to, the .csv file you have exported from Prestashop, type ; as field delimiter and select "Make confirmed immediately", then click import button.


Did this exactly as described.

- 8: You will be prompted to choose what to do with the new field attribute. Select from the dropdown menu "Foreign Key" for "id_customer", "Create New" for both "lastname" and "firsname" and "Skip2 for "ip_address" then confirm the import.


Did this exaclty as described except there is also a field called 'newsletter_date_add' as the fifth choice after ip_address, I set this to Skip as well....


After I imported, I had 4369 members in the list... I then went and created a new customer by signing up to the website and checked PHPMyadmin and the customer was added to the ps_customer database as a new record with the field 'newsletter' set to 1 (meaning they are subscribed.

Now when I go to the Phplistsync module in the back office of prestashop and select Check DB and Synchronize DB, i get the message stating: "No customers need to be added to Phplist." and "No customers need to be updated in Phplist," although there clearly was a new person added to the ps_customer list. See screenshot # 2.

When I check in the admin area of phplist, I still have 4369 members in that list, although there should be 4370.

What am I doing wrong or is this module not compatible with PrestaShop 1.2.5?

18205_kIQHDSMyCIcrSMF2QRCN_t

18206_DN5lavyArwe0YzXWdXFp_t

Share this post


Link to post
Share on other sites

Afraid I don't know enough about this to module nor do I have the time right now, but I'm on PrestaShop 1.2.5 and it seems to be working just fine here. I have phplist and prestashop installed on the same database, with prefixes phplist_ and st_ for prestashop. Did you try reinstalling the Newsletter2.0 module? Haven't looked into it, but I don't think it has anything to do with registering on the site. That's the only thing you did different from my instalation though.

Good luck.

Share this post


Link to post
Share on other sites

Hi sm3004, and sorry for the delay but I'm quite busy in this period.

What I'm suppose is that there is a problem accessing the db, either for rights or path. Unfortunately I haven't put yet error messages on the module, so in my opinion it say that there is no customer to add because it does not find the data. Please doble check that the user that acces to the db has the rights for both the dbs.
This because you should see the list name in the combo box in the back office panel if the module found the right tables in the db. (see screenshot)

I don't think this could cause a problem, but it's just different from my testing environment: db are not hierarchically related, as in my screenshot.

phplistsync.jpg

Share this post


Link to post
Share on other sites
  • 3 months later...

Hello,
Is it possible to send an unsubscribe link at the bottom of the mails, will this go back to the site and unsubscribe them from list and prestashop also?
thanks.

Share this post


Link to post
Share on other sites

Hi airbag, I think your issue is a bit more complex to handle since the unsubscribe link is inserted by Phplist. I this case it should be Phplist to make the useful modifications to the Prestashop's DB, but this means you'll need to create some procedure inside the Phplist code.
On the other hand you could insert an unsubscribe link that points to a script within Prestashop that sync both dbs, but this time the problem is how to create the link with the right parameters inside the sent email, paying attention to verify that all the process is well secured against abuses.

Share this post


Link to post
Share on other sites

@mannybiker, many thanks for your time to reply, and this extension.

I am going to look into what you discussed. I agree.... making something that works is very different than making something that works.. and is not abusable by others!

Share this post


Link to post
Share on other sites

airbag, I don't know exactly how it works in Phplist, but this "unsubscribe link" is a feature that it has so I'm pretty sure it handles this with all the security level needed. For this reason I think the easiest way to do what you need is to work on the opposite side this time, not on Prestashop but on PHPlist. I haven't analysed the code, but I would try to search for the code in PHPlist that handle the unsubscribe function from a link and then add some custom code (theorically you will need to add just few lines, something to read the unique id of your customer if it's not already in some variable and something to make the update on the PS DB), at the end of this procedure, that will implement the update in the Prestashop's DB.

Share this post


Link to post
Share on other sites
  • 7 months later...
  • 3 years later...

Here is the fix:

 

1. Replace entries NULL to integers (like 1 or 2) in foreignkey column in phplist database prefix_user_user

 

2. in file phplistsync.php line 213 change from

    self::_PHPLIST_DB_.self::_PHPLIST_PREFIX_.'user_user'

to

 self::_PHPLIST_DB_.'.'.self::_PHPLIST_PREFIX_.'user_user'

3. in file phplistsync.php line 98 change from

SELECT c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`, c.`newsletter`
	        FROM `'._DB_PREFIX_.'customer` c WHERE c.id_customer not in (SELECT p.foreignkey from '.self::_PHPLIST_DB_.'.'.self::_PHPLIST_PREFIX_.'user_user p)');
	

to

SELECT c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`, c.`newsletter`
        FROM `'._DB_PREFIX_.'customer` c WHERE c.id_customer not in (SELECT p.foreignkey from '.self::_PHPLIST_DB_.'.'.self::_PHPLIST_PREFIX_.'user_user p) AND c.email not in (SELECT p.email FROM '.self::_PHPLIST_DB_.'.'.self::_PHPLIST_PREFIX_.'user_user p)');

All done.

  • Like 1

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Here is the fix:

 

1. Replace entries NULL to integers (like 1 or 2) in foreignkey column in phplist database prefix_user_user

 

2. in file phplistsync.php line 213 change from

    self::_PHPLIST_DB_.self::_PHPLIST_PREFIX_.'user_user'

to

 self::_PHPLIST_DB_.'.'.self::_PHPLIST_PREFIX_.'user_user'

3. in file phplistsync.php line 98 change from

SELECT c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`, c.`newsletter`
	        FROM `'._DB_PREFIX_.'customer` c WHERE c.id_customer not in (SELECT p.foreignkey from '.self::_PHPLIST_DB_.'.'.self::_PHPLIST_PREFIX_.'user_user p)');
	

to

SELECT c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`, c.`newsletter`
        FROM `'._DB_PREFIX_.'customer` c WHERE c.id_customer not in (SELECT p.foreignkey from '.self::_PHPLIST_DB_.'.'.self::_PHPLIST_PREFIX_.'user_user p) AND c.email not in (SELECT p.email FROM '.self::_PHPLIST_DB_.'.'.self::_PHPLIST_PREFIX_.'user_user p)');

All done.

 

 

Hi,

 

I'dont understand the first step: 

 

1. Replace entries NULL to integers (like 1 or 2) in foreignkey column in phplist database prefix_user_user

 

Thank you

Share this post


Link to post
Share on other sites

Hi,

 

I'dont understand the first step: 

 

1. Replace entries NULL to integers (like 1 or 2) in foreignkey column in phplist database prefix_user_user

 

Thank you

 

By default, in phplist database, field foreignkey is added as NULL. Phpsync module doesn't like that. So go to phplist database, foreignkey field and check if there are any NULL entries. Change them to 0. You can also specify that foreignkey field is set to INT(10) type and default entry is 0 not NULL. All of this can be done with any database manager, like phpmyadmin.

 

Step1. Login to phpmyadmin and go to phplist database

post-355311-0-17101800-1391580684_thumb.png

Step2. Go to phplist_user_user table

post-355311-0-90638000-1391580734_thumb.png

Step3. Go to foreignkey column and change any existing NULL to 0

post-355311-0-93030000-1391580793_thumb.png

Step4. Go to table structure settings

post-355311-0-36655600-1391580827_thumb.png

Step5. Find foreignkey and select Change

post-355311-0-74093900-1391580869_thumb.png

Step6. Change it to field type as shown

post-355311-0-60667200-1391580914_thumb.png

 

Come to think of it, module can be edited to handle NULL appropriately. To avoid this hassle.

Share this post


Link to post
Share on other sites
  • 3 months later...
  • 1 month later...

I coudn't find link for download module  :(  Could someone point me to the latest version ?

Hi MichaUu, this is because the module is no more a free module. It has been implemented with new features and controls and made compatible with the latest Prestashop version. If you could be interested here is the link to the Prestashop marketplace:

http://addons.prestashop.com/en/export-modules/16817-phplistsync.html

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More