Last active
November 9, 2022 19:35
-
-
Save peterjaap/6dc68f12a9ce38f6d826ada89747fa3f to your computer and use it in GitHub Desktop.
These queries fix the order item list in customized order/invoice email templates. Basically you need to change order to order_id and invoice to invoice_id and add area="frontend" if it's not set. Check whether you need to fix it with the SELECT queries, run the UPDATE queries to fix them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT COUNT(*) FROM email_template WHERE template_text LIKE '%order=%'; | |
SELECT COUNT(*) FROM email_template WHERE template_text LIKE '%invoice=%'; | |
SELECT COUNT(*) FROM email_template WHERE template_text LIKE '%sales_email_order_items%' AND template_text NOT LIKE '%area="frontend"%'; | |
SELECT COUNT(*) FROM email_template WHERE template_text LIKE '%sales_email_order_invoice_items%' AND template_text NOT LIKE '%area="frontend"%'; | |
UPDATE email_template SET template_text = REPLACE(template_text, "order=$order", "order_id=$order_id") WHERE template_text LIKE '%order=%'; | |
UPDATE email_template SET template_text = REPLACE(template_text, "invoice=$invoice", "invoice_id=$invoice_id") WHERE template_text LIKE '%invoice=%'; | |
UPDATE email_template SET template_text = REPLACE(template_text, 'handle="sales_email_order_items"', 'area="frontend" handle="sales_email_order_items"') WHERE template_text LIKE '%sales_email_order_items%' AND template_text NOT LIKE '%area="frontend"%'; | |
UPDATE email_template SET template_text = REPLACE(template_text, 'handle="sales_email_order_invoice_items"', 'area="frontend" handle="sales_email_order_invoice_items"') WHERE template_text LIKE '%sales_email_order_invoice_items%' AND template_text NOT LIKE '%area="frontend"%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment