Jump to content

Customize text in mail alert


Recommended Posts

all email that your prestashop sends to customers are in /mails/ directory.

you've got there subdirectories /en/ /fr/ etc which are available languages in your store. So, you have to open language directory and then select mail which you want to edit and add own texts there :-)

Link to comment
Share on other sites

no, problem is in maialert.php ( compilation items )

 

$customization_text = '';

if (isset($customized_datas[$product['product_id']][$product['product_attribute_id']]))

{

 

foreach ($customized_datas[$product['product_id']][$product['product_attribute_id']] as $customization)

{

if (isset($customization['datas'][_CUSTOMIZE_TEXTFIELD_]))

foreach ($customization['datas'][_CUSTOMIZE_TEXTFIELD_] as $text)

$customization_text .= $text['name'].': '.$text['value'].'<br />';

 

if (isset($customization['datas'][_CUSTOMIZE_FILE_]))

$customization_text .= count($customization['datas'][_CUSTOMIZE_FILE_]).' '.$this->l('image(s)').'<br />';

 

$customization_text .= '---<br />';

}

 

$customization_text = rtrim($customization_text, '---<br />');

}

 

$items_table .=

'<tr style="background-color:'.($key % 2 ? '#DDE2E6' : '#EBECEE').';">

<td style="padding:0.6em 0.4em;">'.$product['product_reference'].'</td>

<td style="padding:0.6em 0.4em;">

<strong>'

.$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').(!empty($customization_text) ? '<br />'.$customization_text : '').

'</strong>

</td>

<td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice($unit_price, $currency, false).'</td>

<td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['product_quantity'].'</td>

<td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice(($unit_price * $product['product_quantity']), $currency, false).'</td>

</tr>';

}

Link to comment
Share on other sites

  • 9 months later...

thanks for your quick reply. The problem is not with the translation, the problem is that on my website have products with customized text.

 

Please see the attachment

 

I would like to receive email in my custom text such as in an email to the customer.

 

Thanks

post-588927-0-87027100-1389783710_thumb.jpg

Link to comment
Share on other sites

  • 1 month later...

Hi,

i have a different problem with mail alerts...

 

I can't translate the email's object.

The files /mails/it/lang.php it's ok with my translations, but the module doesn't use it.

 

If i change the file /themes/mytheme/mails/it/lang.php and add the objects like

$_LANGMAIL['New voucher regarding your order %s'] = 'Nuovo buono sconto riguardante il tuo ordine %s';

 

it works fine.  Ok i am happy but....

 

whenever i translate the body of the mail form BO localization > translations > mail translations the lang.php file is reset and lost my mods.

 

How can i do?

Thank you to all!

 

P.s.: 1.5.6.1

Link to comment
Share on other sites

Guest Conprestador

Hi,

i have a different problem with mail alerts...

 

I can't translate the email's object.

The files /mails/it/lang.php it's ok with my translations, but the module doesn't use it.

 

If i change the file /themes/mytheme/mails/it/lang.php and add the objects like

$_LANGMAIL['New voucher regarding your order %s'] = 'Nuovo buono sconto riguardante il tuo ordine %s';

 

it works fine.  Ok i am happy but....

 

whenever i translate the body of the mail form BO localization > translations > mail translations the lang.php file is reset and lost my mods.

 

How can i do?

Thank you to all!

 

P.s.: 1.5.6.1

 

It makes a difference if you choose

 

localization --> translations --> Email template translations" -->  "core (no theme selected)"

 

or

 

localization --> translations --> Email template translations" --> <your_themes>

Link to comment
Share on other sites

Guest Conprestador

thanks for your quick reply. The problem is not with the translation, the problem is that on my website have products with customized text.

 

Please see the attachment

 

I would like to receive email in my custom text such as in an email to the customer.

 

Thanks

 

mailalerets.php contains some bugs.

 

line 5 of above code by djimila should be

	foreach ($customized_datas[$product['product_id']][$product['product_attribute_id']][$order->id_address_delivery] as $customization)

Instead of line 17 you should write

    $customization_text .= '---<br />';
    }
    if (method_exists('Tools', 'rtrimString'))
    $customization_text = Tools::rtrimString($customization_text, '---<br />');
                    else
                        $customization_text = preg_replace('/---<br \/>$/', '', $customization_text);
            }
Link to comment
Share on other sites

×
×
  • Create New...