polu Posted January 7 Share Posted January 7 (edited) Hola, llevo 3 horas intentando añadir el asunto del mensaje al archivo de los emails contact.html, no he conseguido nada, he intentado editar contactform.php pero sin resultados. He añadido una variable a la $var_list, pero no consigo conectar con la db para que me la reconozca. La tabla con la que quiero conectar es: ps_contact_lang y quiero que en el asunto me muestre el contenido del campo: name He hecho lo siguiente: He añadido {name} a la $var_list: $var_list = [ '{name}' => '', '{firstname}' => '', '{lastname}' => '', '{order_name}' => '-', '{attached_file}' => '-', '{message}' => Tools::nl2br(Tools::htmlentitiesUTF8(Tools::stripslashes($message))), '{email}' => $from, '{product_name}' => '', ]; y luego he establecido una condición con el nombre y el campo de la tabla: if (isset($contact_lang ->id_contact)) { $var_list['{name}'] = $contact_lang->name; } ¿alguien me puede orientar un poco? Edited January 7 by polu SOLUCIONADO (see edit history) Link to comment Share on other sites More sharing options...
ventura Posted January 7 Share Posted January 7 No necesitas nada, el objeto contact ya esta instanciado en esa función. Solo sería necesario utilizar $contact->name; en el array $var_list 1 Link to comment Share on other sites More sharing options...
polu Posted January 7 Author Share Posted January 7 Ok, muchas gracias ventura, funciona perfectamente, me has quitado un peso de encima Link to comment Share on other sites More sharing options...
polu Posted January 7 Author Share Posted January 7 en contact.html, todo bien, me muestra el asunto y el mensaje pero en contact_form.html no me muestra el mensaje: Asunto: Servicio al cliente Mensaje: (hidden) Link to comment Share on other sites More sharing options...
ventura Posted January 7 Share Posted January 7 Cambia esta parte $var_list['{message}'] = self::MESSAGE_PLACEHOLDER_FOR_OLDER_VERSION; por esto $var_list['{message}'] = Tools::nl2br(Tools::htmlentitiesUTF8(Tools::stripslashes($message))); 1 Link to comment Share on other sites More sharing options...
polu Posted January 8 Author Share Posted January 8 Gracias una vez más Ventura, veo que has utilizado la función stripslashes(), si no me equivoco, para ayudar el envío por html. Saludos. 😉👋👋👋 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