coldrex wrote: ↑Sat Jan 04, 2025 9:47 am
Hello,
I need to add a model name to email subject line (now I have only store name and order ID).
I opened the file: /catalog/controller/mail/order.php and added [text_model] to a subject line.
Looks like this:
Code: Select all
$data['title'] = sprintf($language->get('text_subject'), $order_info['store_name'], $order_info['order_id'], $order_info['text_model']);
Cleared modificators and all caches.
Nothing changed. What I am doing wrong?
You have to use the variable
$order_products (and then
$order_product for each) to get the product model values.
Look at the line where it says:
Code: Select all
foreach ($order_products as $order_product) { ... }
and add there a new variable (e.g.
$models).
Then add each model value to this new variable:
Code: Select all
$models .= $order_product['model] . ', ';
Finally trim it:
You could add them also as array
and then finally
(as I would do it).
And finally add this new variable to your line
Code: Select all
$data['title'] = sprintf($language->get('text_subject'), $order_info['store_name'], $order_info['order_id'], $models);
Note: you have to adopt then also the language variable 'text_subject' otherwise an error will be produced!
Better to use that:
Code: Select all
$data['title'] = sprintf($language->get('text_subject'), $order_info['store_name'], $order_info['order_id']) . ' ' . $models;