Hello good afternoon.
I have this code to send a notice to the administrator
//nuevo envio correo
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
);
}
}//nuevo
But I would like to know how I can put in this same mail a list with the attributes type like this
16 Baby Benito Pérez Galdós - Talla - Talla 3
32 Baby Benito Pérez Galdós - Talla - Talla 4
0 Baby Benito Pérez Galdós - Talla - Talla 5
0 Baby Benito Pérez Galdós - Talla - Talla 6
1 Baby Benito Pérez Galdós - Talla - Talla 7
0 Baby Benito Pérez Galdós - Talla - Talla 8
1 Baby Benito Pérez Galdós - Talla - Talla 9













