Jump to content

[Solved] Fill new field in ps_customer with ps_connections datas


leeloo

Recommended Posts

To save space in my database I empty tables :
ps_connections
ps_connections_page
ps_connections_source
ps_guest

but I lose the information from the date of last customer visit.
So I created a field date_lastvisit in the table ps_customer.

I would fill my field date_lastvisit according datas from ps_connections for each customer.
How to change the file classes/Customer.php so that the date of last customer visit either recorded in the field date_lastvisit of the ps_customer table ?

Thank you all for the answers to be given.

Link to comment
Share on other sites

I already did that.
What I need to do now is get the date of last customer visit (in the table ps_connections) and save it the table ps_customer.

Fo each customer, how to insert automatically the date of last customer visit from the table ps_connections to ps_customer (in a new function ?) .

Link to comment
Share on other sites

  • 2 weeks later...

Hi,
In my file : classes/Customer.php I put :

public         $date_lastvisit;




In function getFields() I put :

$this->today_date = Tools::displayDate(date('Y-m-d H:i:s'), intval($order->id_lang), 1);
fields['date_lastvisit'] = ($this->today_date);



The date of last visit is updated in field date_lastvisit of customer table only when the customer update his personnal datas.
But I want the date of last visit to be updated as soon as customer connection is established.
Please can someone help me?


Solved by myself
In authentification.php, i added :

           Db::getInstance()->Execute('
           UPDATE `'._DB_PREFIX_.'customer`
           SET date_lastvisit=NOW()
           WHERE id_customer="'.intval($customer->id).'"
           ');    



after

Module::hookExec('authentication');



Field date_lastvisit is now automatically updated after each customer connexion.

Link to comment
Share on other sites

  • 1 year later...

Any help would be greatly appreciated.

 

In my customers tab, some of the last visit fields are empty (actually most of them) and some is not. Any ideas on how to solve this?

 

Specs:

Prestashop v. 1.4.4.0

Data mining for statistics v1.0 installed (Save page views for each customer:yes)

Tab "Stats"> settings>automatic cleaning:never

 

Thanks

Link to comment
Share on other sites

Am not I too late asking about county field here.

 

I am a new bie here,

 

I would like to

 

1. add additional field to my presta registration.,

2. this field is county

 

This field will a county field, that should be optionaly field coresponding to the county list in the dbasae.

 

Could someone here help me to do this...??

 

I have tried edit some , in authentication.tpl, but nothing still happened...

 

Is there some thing logicaly solving to do that..

 

thx..vy mu :rolleyes:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...