leeloo Posted May 4, 2011 Share Posted May 4, 2011 To save space in my database I empty tables :ps_connectionsps_connections_pageps_connections_sourceps_guestbut 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 More sharing options...
shokinro Posted May 4, 2011 Share Posted May 4, 2011 very simple,1. define a new field at top where other fields are defined, for examplepublic $date_lastvisit;2. add field in getFields() function $fields['date_lastvisit'] = (int)($this->date_lastvisit); Link to comment Share on other sites More sharing options...
leeloo Posted May 5, 2011 Author Share Posted May 5, 2011 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 More sharing options...
leeloo Posted May 17, 2011 Author Share Posted May 17, 2011 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 myselfIn 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 More sharing options...
MEG Venture Posted August 9, 2012 Share Posted August 9, 2012 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 More sharing options...
arimasco Posted August 10, 2012 Share Posted August 10, 2012 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now