Jump to content

Modificar el Formulario de Contacto Prestashop


MrHeberRamos

Recommended Posts

Tengo problemas para modificar el formulario. Me guié de unos de los post que se resolvió este tema pero me genera dudas en el código PHP... contact-from.php.

 

Bueno le dejo primero los códigos Originales y después los modificados.

 

CODIGOS ORIGINALES.

  • mails/es/cintact.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>Mensaje desde {shop_name}</title>

</head>

<body>

<table style="font-family: Verdana,sans-serif; font-size: 11px; color: #374953; width: 550px;">

<tbody>

<tr>

<td align="left"><a title="{shop_name}" href="{shop_url}"><img style="border: none;" src="{shop_logo}" alt="{shop_name}" /></a></td>

</tr>

<tr>

<td> </td>

</tr>

<tr>

<td style="background-color: #db3484; color: #fff; font-size: 12px; font-weight: bold; padding: 0.5em 1em;" align="left">Mensaje desde tu tienda {shop_name}</td>

</tr>

<tr>

<td> </td>

</tr>

<tr>

<td align="left">Email: <a href="mailto:{email}"><strong>{email}</strong></a> <br /><br />Mensaje: {message}</td>

</tr>

<tr>

<td> </td>

</tr>

<tr>

<td style="font-size: 10px; border-top: 1px solid #D9DADE;" align="center"><a style="color: #db3484; font-weight: bold; text-decoration: none;" href="{shop_url}">{shop_name}</a> desarrollado por <a style="text-decoration: none; color: #374953;" href="http://www.prestashop.com/">PrestaShop™</a></td>

</tr>

</tbody>

</table>

</body>

</html>

  • themes/leo_electronics/contact-form.tpl

{capture name=path}{l s='Contact'}{/capture}

{include file="$tpl_dir./breadcrumb.tpl"}

 

<h1>{l s='Customer Service'} - {if isset($customerThread) && $customerThread}{l s='Your reply'}{else}{l s='Contact us'}{/if}</h1>

 

{if isset($confirmation)}

<p>{l s='Your message has been successfully sent to our team.'}</p>

<ul class="footer_links">

<li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li>

</ul>

{elseif isset($alreadySent)}

<p>{l s='Your message has already been sent.'}</p>

<ul class="footer_links">

<li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li>

</ul>

{else}

<p class="bold">{l s='For questions about an order or for more information about our products'}.</p>

{include file="$tpl_dir./errors.tpl"}

<form action="{$request_uri|escape:'htmlall':'UTF-8'}" method="post" class="std" enctype="multipart/form-data">

<fieldset>

<h3>{l s='Send a message'}</h3>

<p class="select">

<label for="id_contact">{l s='Subject Heading'}</label>

{if isset($customerThread.id_contact)}

{foreach from=$contacts item=contact}

{if $contact.id_contact == $customerThread.id_contact}

<input type="text" id="contact_name" name="contact_name" value="{$contact.name|escape:'htmlall':'UTF-8'}" readonly="readonly" />

<input type="hidden" name="id_contact" value="{$contact.id_contact}" />

{/if}

{/foreach}

</p>

{else}

<select id="id_contact" name="id_contact" onchange="showElemFromSelect('id_contact', 'desc_contact')">

<option value="0">{l s='-- Choose --'}</option>

{foreach from=$contacts item=contact}

<option value="{$contact.id_contact|intval}" {if isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>

{/foreach}

</select>

</p>

<p id="desc_contact0" class="desc_contact"> </p>

{foreach from=$contacts item=contact}

<p id="desc_contact{$contact.id_contact|intval}" class="desc_contact" style="display:none;">

{$contact.description|escape:'htmlall':'UTF-8'}

</p>

{/foreach}

{/if}

<p class="text">

<label for="email">{l s='E-mail address'}</label>

{if isset($customerThread.email)}

<input type="text" id="email" name="from" value="{$customerThread.email|escape:'htmlall':'UTF-8'}" readonly="readonly" />

{else}

<input type="text" id="email" name="from" value="{$email|escape:'htmlall':'UTF-8'}" />

{/if}

</p>

{if !$PS_CATALOG_MODE}

{if (!isset($customerThread.id_order) || $customerThread.id_order > 0)}

<p class="text select">

<label for="id_order">{l s='Order Reference'}</label>

{if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1}

<select name="id_order" >

<option value="0">{l s='-- Choose --'}</option>

{foreach from=$orderList item=order}

<option value="{$order.value|intval}" {if $order.selected|intval}selected="selected"{/if}>{$order.label|escape:'htmlall':'UTF-8'}</option>

{/foreach}

</select>

{elseif !isset($customerThread.id_order) && !isset($isLogged)}

<input type="text" name="id_order" id="id_order" value="{if isset($customerThread.id_order) && $customerThread.id_order > 0}{$customerThread.id_order|intval}{else}{if isset($smarty.post.id_order)}{$smarty.post.id_order|intval}{/if}{/if}" />

{elseif $customerThread.id_order > 0}

<input type="text" name="id_order" id="id_order" value="{$customerThread.id_order|intval}" readonly="readonly" />

{/if}

</p>

{/if}

{if isset($isLogged) && $isLogged}

<p class="text select">

<label for="id_product">{l s='Product'}</label>

{if !isset($customerThread.id_product)}

{foreach from=$orderedProductList key=id_order item=products name=products}

<select name="id_product" id="{$id_order}_order_products" class="product_select" style="width:300px;{if !$smarty.foreach.products.first} display:none; {/if}" {if !$smarty.foreach.products.first}disabled="disabled" {/if}>

<option value="0">{l s='-- Choose --'}</option>

{foreach from=$products item=product}

<option value="{$product.value|intval}">{$product.label|escape:'htmlall':'UTF-8'}</option>

{/foreach}

</select>

{/foreach}

{elseif $customerThread.id_product > 0}

<input type="text" name="id_product" id="id_product" value="{$customerThread.id_product|intval}" readonly="readonly" />

{/if}

</p>

{/if}

{/if}

{if $fileupload == 1}

<!-- <p class="text">

<label for="fileUpload">{l s='Attach File'}</label>

<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />

<input type="file" name="fileUpload" id="fileUpload" />

</p> -->

{/if}

<p class="textarea">

<label for="message">{l s='Message'}</label>

<textarea id="message" name="message" rows="15" cols="10">{if isset($message)}{$message|escape:'htmlall':'UTF-8'|stripslashes}{/if}</textarea>

</p>

<p class="submit">

<input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button_large" onclick="$(this).hide();" />

</p>

<div>

<center>

<TABLE align="center" >

<TR>

<TD> Email :</TD>

<TD> [email protected] </TD>

</TR>

<TR>

<TD rowspan="3"> Direccion :</TD>

<TD> Av. Argentina 215 PAB. AV 12-14 PJE.11 C.C.<br> </dd> </TD>

</TR>

<TR>

<TD> NICOLINI – LIMA CALLE GAMMA 256 PROV. </TD>

</TR>

<TR>

<TD> CONSTITUCIONAL DEL CALLAO - PERÚ</TD>

</TR>

<TR>

<TD rowspan="3"> Telefono :</TD>

<TD> FIJO : 01 734-0136</TD>

</TR>

<TR>

<TD> NEXTEL : 99402*5125</TD>

</TR>

<TR>

<TD> RPC : 982761898</TD>

</TR>

 

</TABLE>

</center>

</div>

</fieldset>

</form>

{/if}

  • public_html/leo_electronics/contact-from.php

require(dirname(__FILE__).'/config/config.inc.php');

Tools::displayFileAsDeprecated();

 

Tools::redirect('index.php?controller=contact'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');

 

 

AHORA LOS MODIFICADOS:

  • mails/es/cintact.htmL

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>Mensaje desde {shop_name}</title>

</head>

<body>

<table style="font-family: Verdana,sans-serif; font-size: 11px; color: #374953; width: 550px;">

<tbody>

<tr>

<td align="left"><a title="{shop_name}" href="{shop_url}"><img style="border: none;" src="{shop_logo}" alt="{shop_name}" /></a></td>

</tr>

<tr>

<td> </td>

</tr>

<tr>

<td style="background-color: #db3484; color: #fff; font-size: 12px; font-weight: bold; padding: 0.5em 1em;" align="left">Mensaje desde tu tienda {shop_name}</td>

</tr>

<tr>

<td> </td>

</tr>

<tr>

<td align="left">

Nombre: <b>{nombre}</b><br>

Apellidos: <b>{apellidos}</b><br>

Telefono: <b>{telefono}</b><br>

Email: <a href="mailto:{email}"><strong>{email}</strong></a>

<br /><br />Mensaje: {message}</td>

</tr>

<tr>

<td> </td>

</tr>

<tr>

<td style="font-size: 10px; border-top: 1px solid #D9DADE;" align="center"><a style="color: #db3484; font-weight: bold; text-decoration: none;" href="{shop_url}">{shop_name}</a> desarrollado por <a style="text-decoration: none; color: #374953;" href="http://www.prestashop.com/">PrestaShop™</a></td>

</tr>

</tbody>

</table>

</body>

</html>

  • themes/leo_electronics/contact-form.tpl

{capture name=path}{l s='Contact'}{/capture}

{include file="$tpl_dir./breadcrumb.tpl"}

 

<h1>{l s='Customer Service'} - {if isset($customerThread) && $customerThread}{l s='Your reply'}{else}{l s='Contact us'}{/if}</h1>

 

{if isset($confirmation)}

<p>{l s='Your message has been successfully sent to our team.'}</p>

<ul class="footer_links">

<li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li>

</ul>

{elseif isset($alreadySent)}

<p>{l s='Your message has already been sent.'}</p>

<ul class="footer_links">

<li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li>

</ul>

{else}

<p class="bold">{l s='For questions about an order or for more information about our products'}.</p>

{include file="$tpl_dir./errors.tpl"}

<form action="{$request_uri|escape:'htmlall':'UTF-8'}" method="post" class="std" enctype="multipart/form-data">

<fieldset>

<h3>{l s='Send a message'}</h3>

<p class="select">

<label for="id_contact">{l s='Subject Heading'}</label>

{if isset($customerThread.id_contact)}

{foreach from=$contacts item=contact}

{if $contact.id_contact == $customerThread.id_contact}

<input type="text" id="contact_name" name="contact_name" value="{$contact.name|escape:'htmlall':'UTF-8'}" readonly="readonly" />

<input type="hidden" name="id_contact" value="{$contact.id_contact}" />

{/if}

{/foreach}

</p>

{else}

<select id="id_contact" name="id_contact" onchange="showElemFromSelect('id_contact', 'desc_contact')">

<option value="0">{l s='-- Choose --'}</option>

{foreach from=$contacts item=contact}

<option value="{$contact.id_contact|intval}" {if isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>

{/foreach}

</select>

</p>

<p id="desc_contact0" class="desc_contact"> </p>

{foreach from=$contacts item=contact}

<p id="desc_contact{$contact.id_contact|intval}" class="desc_contact" style="display:none;">

{$contact.description|escape:'htmlall':'UTF-8'}

</p>

{/foreach}

{/if}

<p class="text">

<label for="email">{l s='E-mail address'}</label>

{if isset($customerThread.email)}

<input type="text" id="email" name="from" value="{$customerThread.email|escape:'htmlall':'UTF-8'}" readonly="readonly" />

{else}

<input type="text" id="email" name="from" value="{$email|escape:'htmlall':'UTF-8'}" />

{/if}

</p>

{if !$PS_CATALOG_MODE}

{if (!isset($customerThread.id_order) || $customerThread.id_order > 0)}

<p class="text select">

<label for="id_order">{l s='Order Reference'}</label>

{if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1}

<select name="id_order" >

<option value="0">{l s='-- Choose --'}</option>

{foreach from=$orderList item=order}

<option value="{$order.value|intval}" {if $order.selected|intval}selected="selected"{/if}>{$order.label|escape:'htmlall':'UTF-8'}</option>

{/foreach}

</select>

{elseif !isset($customerThread.id_order) && !isset($isLogged)}

<input type="text" name="id_order" id="id_order" value="{if isset($customerThread.id_order) && $customerThread.id_order > 0}{$customerThread.id_order|intval}{else}{if isset($smarty.post.id_order)}{$smarty.post.id_order|intval}{/if}{/if}" />

{elseif $customerThread.id_order > 0}

<input type="text" name="id_order" id="id_order" value="{$customerThread.id_order|intval}" readonly="readonly" />

{/if}

</p>

{/if}

{if isset($isLogged) && $isLogged}

<p class="text select">

<label for="id_product">{l s='Product'}</label>

{if !isset($customerThread.id_product)}

{foreach from=$orderedProductList key=id_order item=products name=products}

<select name="id_product" id="{$id_order}_order_products" class="product_select" style="width:300px;{if !$smarty.foreach.products.first} display:none; {/if}" {if !$smarty.foreach.products.first}disabled="disabled" {/if}>

<option value="0">{l s='-- Choose --'}</option>

{foreach from=$products item=product}

<option value="{$product.value|intval}">{$product.label|escape:'htmlall':'UTF-8'}</option>

{/foreach}

</select>

{/foreach}

{elseif $customerThread.id_product > 0}

<input type="text" name="id_product" id="id_product" value="{$customerThread.id_product|intval}" readonly="readonly" />

{/if}

</p>

{/if}

{/if}

{if $fileupload == 1}

<!-- <p class="text">

<label for="fileUpload">{l s='Attach File'}</label>

<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />

<input type="file" name="fileUpload" id="fileUpload" />

</p> -->

{/if}

{*DESDE AQUI SE INICIA EL CODIGO ADICIONALDO*}

<p>

<label for="nombre">{l s='Nombre'}</label>

<input type="text" id="nombre" name="nombre" value="{if isset($smarty.post.nombre)}{$smarty.post.nombre|escape:'htmlall'|stripslashes}{/if}" />

</p>

<p>

<label for="apellidos">{l s='Apellidos'}</label>

<input type="text" id="apellidos" name="apellidos" value="{if isset($smarty.post.apellidos)}{$smarty.post.apellidos|escape:'htmlall'|stripslashes}{/if}" />

</p>

<p>

<label for="telefono">{l s='Telefono'}</label>

<input type="text" id="telefono" name="telefono" value="{if isset($smarty.post.telefono)}{$smarty.post.telefono|escape:'htmlall'|stripslashes}{/if}" />

</p>

{*FIN DEL CODIGO ADICIONALDO*}

<p class="textarea">

<label for="message">{l s='Message'}</label>

<textarea id="message" name="message" rows="15" cols="10">{if isset($message)}{$message|escape:'htmlall':'UTF-8'|stripslashes}{/if}</textarea>

</p>

<p class="submit">

<input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button_large" onclick="$(this).hide();" />

</p>

<div>

<center>

<TABLE align="center" >

<TR>

<TD> Email :</TD>

<TD> [email protected] </TD>

</TR>

<TR>

<TD rowspan="3"> Direccion :</TD>

<TD> Av. Argentina 215 PAB. AV 12-14 PJE.11 C.C.<br> </dd> </TD>

</TR>

<TR>

<TD> NICOLINI – LIMA CALLE GAMMA 256 PROV. </TD>

</TR>

<TR>

<TD> CONSTITUCIONAL DEL CALLAO - PERÚ</TD>

</TR>

<TR>

<TD rowspan="3"> Telefono :</TD>

<TD> FIJO : 01 734-0136</TD>

</TR>

<TR>

<TD> NEXTEL : 99402*5125</TD>

</TR>

<TR>

<TD> RPC : 982761898</TD>

</TR>

 

</TABLE>

</center>

</div>

</fieldset>

</form>

{/if}

  • public_html/leo_electronics/contact-from.php (BUENO AQUÍ NO REALICE NINGUNA MODIFICACIÓN YA QUE NO ENTENDÍ EL CÓDIGO)

require(dirname(__FILE__).'/config/config.inc.php');

Tools::displayFileAsDeprecated();

 

Tools::redirect('index.php?controller=contact'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');

 

También modifique el CONTACT.TXT

 

 

Has recibido un mensaje de un cliente desde tu tienda: {shop_name}

 

Detalles del mensaje:

 

Nombre: {nombre}

 

Apellidos: {apellidos}

 

Telefono: {telefono}

 

Email: {email}

 

Mensaje: {message}

 

{shop_url} desarrollado por PrestaShop™

 

AYUDA POR FAVOR ....

 

Aquí la URL de la pagina: tvdelperu.com/leo_electronics.

Edited by MrHeberRamos (see edit history)
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...