Jump to content

alerte remise en stock


Recommended Posts

Bonjour,

 

j'ai le module ps_emailalerts pour informer le client d'une remise en stock d'un produit.

J'aimerai savoir par article combien il y a d'inscrit pour connaitre la demande de chaque produit.

J'ai regardé dans la base de donnée et j'ai trouvé ou sont stockés les infos.

Je sais extraire les infos de la bdd avec une reqeuete par exemple les mails et id_product ou id_product_attribute mais auriez vous une idée pour remplacer dans le tableau les id_product par le nom de l'article et sa variante pour me simplifier la vie ?

 

Merci d'avance

 

prestashop 1.7

 

 

 

 

Link to comment
Share on other sites

Voila un truc qui marche ;

 

SELECT
COUNT(m.id_product) AS quantité,
l.name
FROM mod136_mailalert_customer_oos m, mod136_product_lang l
WHERE (m.id_product=l.id_product) GROUP BY m.id_product ORDER BY quantité DESC;

Link to comment
Share on other sites

To create a query that replaces id_product and id_product_attribute with the product name and its variant (if applicable), you'll need to join tables. Please refer to the below query for reference

SELECT ea.email, p.id_product,pl.name AS product_name,pa.id_product_attribute,GROUP_CONCAT(agl.name, ': ', al.name SEPARATOR ', ') AS attributes
FROM
ps_emailalert ea LEFT JOIN ps_product p ON ea.id_product = p.id_product
LEFT JOIN
ps_product_lang pl ON p.id_product = pl.id_product AND pl.id_lang = 1
LEFT JOIN
ps_product_attribute pa ON ea.id_product_attribute = pa.id_product_attribute
LEFT JOIN
ps_product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
LEFT JOIN
ps_attribute a ON pac.id_attribute = a.id_attribute
LEFT JOIN
ps_attribute_lang al ON a.id_attribute = al.id_attribute AND al.id_lang = 1
LEFT JOIN
ps_attribute_group_lang agl ON a.id_attribute_group = agl.id_attribute_group AND agl.id_lang = 1
GROUP BY
ea.email, p.id_product, pa.id_product_attribute
ORDER BY
product_name, attributes;

Link to comment
Share on other sites

Hello, I tried what you propose, but the table emailalert doesn't exist.

I have only emailsubsciption.

 

but it is ok my query I ve done juste above works.

Thank's

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