Jump to content

atributtes in mailalerts


opionai

Recommended Posts

Hello good afternoon.

 

I have this code to send a notice to the administrator
 

public function sendEmailProductOutOfStock($id_customer, $id_product, $id_product_attribute, $id_shop=null, $id_lang=null, $guest_email=null)


$context = Context::getContext();

if (is_null($id_shop))
$id_shop = (int)$context->shop->id;
if (is_null($id_lang))
$id_lang = (int)$context->language->id;

$customer = new Customer($id_customer);
$customer_email = $customer->email;
$customer_firstname = $customer->firstname;
$customer_lastname = $customer->lastname;
$guest_email = pSQL($guest_email);

$id_customer = (int)$id_customer;
$customer_email = pSQL($customer_email);

if ($id_customer==0)
$customer_email = $guest_email;

$product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);


if (empty($this->_merchant_mails))/* Algunas veces no guarda en $this->_merchant_mails los correos, si es así, los recuperamos de la configuración del módulo*/
$mails = str_replace(',', self::__MA_MAIL_DELIMITOR__, strval(Configuration::get('MA_MERCHANT_MAILS')));
else
$mails = $this->_merchant_mails;

$template_vars = array(
'{id_customer}' => $id_customer,
'{customer_firstname}' => $customer_firstname,
'{customer_lastname}' => $customer_lastname,
'{customer_email}' => $customer_email,
'{product}' => $product_name,


);
$from = $customer_email;
$fromName = ($customer_firstname.' '.$customer_lastname);
if (!empty($mails)){
$merchant_mails = explode(self::__MA_MAIL_DELIMITOR__, $mails);
foreach ($merchant_mails as $merchant_mail)
{
Mail::Send(
$id_lang,
'new_request_availability',
sprintf(Mail::l('Solicitud de disponibilidad del producto: %s', $id_lang), $product_name),
$template_vars,
$merchant_mail,
null,
//strval(Configuration::get('PS_SHOP_EMAIL')),
//strval(Configuration::get('PS_SHOP_NAME')),
$from, 
$fromName,
null,
null,
dirname(_FILE_).'/mails/',
null,
$id_shop
);
}
}
else{
Mail::Send(
$id_lang,
'new_request_availability',
sprintf(Mail::l('Solicitud de disponibilidad del producto: %s', $id_lang), $product_name),
$template_vars,
strval(Configuration::get('PS_SHOP_EMAIL')),
null,
// strval(Configuration::get('PS_SHOP_EMAIL')),
// strval(Configuration::get('PS_SHOP_NAME')),
$from, 
$fromName,
null,
null,
dirname(_FILE_).'/mails/',
null,
$id_shop
);

}

 

But I would like to know how I can put in this same mail a list with the attributes type like this

 

Un.  Name                  Atribute

8      Name article - Talla - Talla 2 
10    Name article - Talla - Talla 3 
0      Name article - Talla - Talla 5 
0      Name article - Talla - Talla 6 
15     Name article - Talla - Talla 12 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...