Jump to content

Adding product reference in out of stock notification e-mail prestashop 1.6.1.0


Vali Iacobescu

Recommended Posts

Hi,

 

Can someone, please, explain step by step, how to add a product reference number in the out of stock e-mail notification template, because I have products with the same name and I would prefer to see the product reference number, in order to identify the product easier.

 

Thanks!

Link to comment
Share on other sites

Find the following code at around line 518 of modules/mailalerts/mailalerts.php:

			$product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);
			$template_vars = array(
				'{qty}' => $quantity,
				'{last_qty}' => $ma_last_qties,
				'{product}' => $product_name
			);

Then change it to:

			$product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);
			$product = new Product($id_product);
			$template_vars = array(
				'{qty}' => $quantity,
				'{last_qty}' => $ma_last_qties,
				'{product}' => $product_name,
				'{reference}' => $product->reference
			);

You should then be able to use {reference} inside modules/mailalerts/mails/<lang_iso>/productoutofstock.html and productoutofstock.txt.

  • Like 4
  • Thanks 2
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
  • 1 year later...
  • 7 months later...
  • 1 month later...

In Prestashop 1.7.7 you need to navigate into modules/ps_emailalerts/ps_emailalerts.php

Find the following code, around line 573:

$template_vars = array(
                '{qty}' => $quantity,
                '{last_qty}' => $ma_last_qties,
                '{product}' => $product_name,
            );

Then change it to:

$template_vars = array(
                '{qty}' => $quantity,
                '{last_qty}' => $ma_last_qties,
                '{product}' => $product_name,
                '{reference}' => $product->reference
            );

Now, you should be able to use {reference} in your "product out of stock" e-mail templates.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Thanks for this, I'll give it a go.

 

The issue I have, is I don't even have a product name in the email.

 

I wonder if this is to do with only having ENGB on site, as I see the email template for the EN(US) is completely different...

 

There is also an error in the GB template for customer emails too {first name} is spelt wrong - but that's another issue!

Link to comment
Share on other sites

On 3/26/2021 at 11:43 AM, Federico Masiero said:

In Prestashop 1.7.7 you need to navigate into modules/ps_emailalerts/ps_emailalerts.php

Find the following code, around line 573:


$template_vars = array(
                '{qty}' => $quantity,
                '{last_qty}' => $ma_last_qties,
                '{product}' => $product_name,
            );

Then change it to:


$template_vars = array(
                '{qty}' => $quantity,
                '{last_qty}' => $ma_last_qties,
                '{product}' => $product_name,
                '{reference}' => $product->reference
            );

Now, you should be able to use {reference} in your "product out of stock" e-mail templates.

OK thanks, I have now at least managed to get a product name into the email (it's not there in the the Classic / GB template). But {reference} is not working?

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
  • 6 months later...
On 3/13/2018 at 6:38 PM, coMegaWebMaster said:

How to get the reference of the combination products?
The combination names are correct in the email, but the reference is from the main product, I try somethings with $id_product_attribute->reference but it does not work or the return is 0.
Hope someone or rocky can help :)

With kind regrads,
Alexander.

I managed to get the product reference as you indicated, but I need the reference of the combination (prestashop 1.7.6.9).

Any solution? Thx!!

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

  • 2 weeks later...
On 3/24/2022 at 8:43 AM, pShark said:

I managed to get the product reference as you indicated, but I need the reference of the combination (prestashop 1.7.6.9).

Any solution? Thx!!

Doesn't anyone know a solution?

It would be useful to add the EAN of the combination.

Link to comment
Share on other sites

  • 1 year later...
il y a 11 minutes, Teone a dit :

Ciao, sto cercando di inserire nella mail anche il link del prodotto, ma non riesco a recuperare il dato... puoi aiutarmi?

Ciao,

la tua richiesta non ha nulla a che fare con l'argomento iniziale di questo topic, ti preghiamo di creare una richiesta propria

Link to comment
Share on other sites

il y a 12 minutes, Teone a dit :

come non ha nulla a che fare? io sto usando questo codice per recuperare i dati nella mail alert dei prodotti esauriti, grazie  a questo script ho recuoperato il codice di riferimento, ma non riesco a recuperare l'url del prodotto "esaurito"! Ho usato '{link}' => $url, ma non va! 

 

Aprite un topic tutto vostro invece di postare su un argomento che non ha nulla a che fare con la vostra richiesta.

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...