donpablito Posted October 9, 2018 Share Posted October 9, 2018 Hola a todos, por favor, estoy personalizando un modulo que accede ya a la tabla ps_customer. Pueden ayudarme a transformar este codigo php que funciona, para cambiarlo en el formato de prestashop 1.7? $DBName = "nombreDB"; $DBHost = "mysql.hostinger.es"; $DBUser = "usuarioDB"; $DBPass = "passord"; $timestamp = date('Y', time()) . "/" . date('m', time()) . "/" . date('d', time()) . " - " . date('H', time()) . ":" . date('i', time()) . ":" . date('s', time()); $sql = "SELECT firstname,lastname,email,active from ps_customer where activation_link = '" . $link . "' "; $dbconn = @mysqli_connect($DBHost,$DBUser,$DBPass,$DBName) or exit("SERVER Unavailable - " . $sql ); $result = @mysqli_query($dbconn,$sql) or exit("QUERY FAILED! " . $sql) ; while ($rs=mysqli_fetch_array($result)) { $customer_first = $rs['firstname']; $customer_last = $rs['lastname']; $customer_email = $rs['email']; $customer_active = $rs['active']; } se que la primera parte no la necesito si modifico la SELECT. Necesito accedere con el campo link y recuperar los 4 campos de abajo. Gracias de antemano Link to comment Share on other sites More sharing options...
gusman126 Posted October 10, 2018 Share Posted October 10, 2018 Lo mejor es usar las class del propio prestashop en el fichero php añade las lineas include_once('../../config/config.inc.php'); include_once('../../init.php'); usa bien la ruta Luego si quieres ver o leer los datos de un cliente $cliente = new Custumer(ID_CUSTUMER); //aqui pones el id del cliente echo $cliente->firstname; echo $cliente->lastname; etc... Link to comment Share on other sites More sharing options...
donpablito Posted October 14, 2018 Author Share Posted October 14, 2018 Gracias por respnder, siempre se agradece. El problema es qeue yo tengo solo un campo de la tabla que se llama Activation_link entonces como puedo yo hacer eso? $nombre.cliente = firstname de la tabla ps_customer donde Activationlink = $activationlink &apellido cliente = lastname ..................... $email.cliente = email.................. lo de la include lo tengo entendido. Link to comment Share on other sites More sharing options...
gusman126 Posted October 15, 2018 Share Posted October 15, 2018 Vale, veo que activationlink, es un campo añadido a la tabla entonces usa $req = "SELECT firstname,lastname,email,active from "._DB_PREFIX_."customer where activation_link = '" . $link . "'" $rows = 0; $rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($req); return ($rows); Link to comment Share on other sites More sharing options...
donpablito Posted October 16, 2018 Author Share Posted October 16, 2018 Lo intento ahora mismo, pero a que te refiere por USA BIEN LA RUTA? include_once('../../config/config.inc.php'); include_once('../../init.php'); que pongo en el lugar de los......? no tengo subcarptes, (public_html/config/config.inc.php).. y el modulo está en (public_html/modules/activation-----) Link to comment Share on other sites More sharing options...
donpablito Posted October 16, 2018 Author Share Posted October 16, 2018 la verdad que no esoy capaz.... puedo pasarte el codigo por correo? Link to comment Share on other sites More sharing options...
gusman126 Posted October 16, 2018 Share Posted October 16, 2018 Si tienes el fichero PHP dentro de /modules/fichero.php La ruta que he puesto es correcta, es la que uso cuando hago un módulo y por JavaScript llama un AJAX a un fichero PHP en la carpeta del módulo 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