How to configure and adapt Aimeos based shops as developer
Forum rules: Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#1985 by Luke
18 Oct 2015, 13:46
Hi,

I am trying to alter the display of the product emails that get sent to the client upon successful purchase of a product - but I'm have a lot of trouble isolating the templates to edit!

It seems that when you generate a product email it just uses the same template as the product display page which is used on the frontend of the site too - rather than using it's own template. How would I go about altering a specific template just for the email and including it. It seems this framework uses a lot of 'magic' to include its templates and makes it quite confusing to know what to alter!

I'm sure it is quite simple and I've over looking something obvious - any help would be appreciated.

Thanks
#1986 by aimeos
18 Oct 2015, 17:24
Luke wrote:I am trying to alter the display of the product emails that get sent to the client upon successful purchase of a product - but I'm have a lot of trouble isolating the templates to edit!

It seems that when you generate a product email it just uses the same template as the product display page which is used on the frontend of the site too - rather than using it's own template. How would I go about altering a specific template just for the email and including it. It seems this framework uses a lot of 'magic' to include its templates and makes it quite confusing to know what to alter!


Normally, it's pretty straight-forward: One component/subpart has two templates (body and header).
In this case you are right, the "summary" templates are shared between the "basket standard", "checkout standard" and the HTML delivery and payment e-mails and there can't be different templates configured for them. We will change this in the next major release.

In the meantime, you could create a new class which extends from the subpart class you want to change the template to a different one (e.g. https://github.com/aimeos/aimeos-core/blob/2015.10/client/html/src/Client/Html/Email/Payment/Html/Summary/Detail/Default.php) and overwrite the "getBody()" method using a different template path (see https://github.com/aimeos/aimeos-core/blob/2015.10/client/html/src/Client/Html/Common/Summary/Detail/Default.php for example). Please place your new class and template in the same directory structure in an Aimeos extension (https://aimeos.org/developer/extensions/), then it will work as expected.
#1987 by Luke
18 Oct 2015, 19:24
Hi thanks for the reply .

I have put my new file in
/home/me/html/our-client/ext/ai-aimeos-our-client/client/html/src/Client/Html/Email/Payment/Default.php

But it doesnt get picked up at any point - the path is the exact same as the one which gets picked up in the extension so I dont know what I've done wrong..

P.S I have cleared the cache etc nothing seems to work :cry:
#1988 by aimeos
19 Oct 2015, 09:33
Luke wrote:I have put my new file in
/home/me/html/our-client/ext/ai-aimeos-our-client/client/html/src/Client/Html/Email/Payment/Default.php

But it doesnt get picked up at any point - the path is the exact same as the one which gets picked up in the extension so I dont know what I've done wrong..


You can not copy the existing class to a new location but have to *extend* the class instead, giving your new class a new name, e.g. "Client/Html/Email/Payment/Summary/Detail/Myproject.php". Afterwards, you can configure that your new class should be used: https://aimeos.org/docs/Configuration/Core/client/html/email/payment/html/summary/detail/name
#1990 by Luke
20 Oct 2015, 11:22
Hi,

I still don't really understand what is going wrong / what I am doing wrong. I posted a reply yesterday but somehow it didn't save :?

Anyway - I understand how this is theoretically meant to work - very similar to the way Magento works I think. I just can't get it to actually work :|

So I've made a new class like so :
class Client_Html_Email_Payment_Html_Summary_Detail_Client
extends Client_Html_Common_Summary_Detail_Default
{
}

Which is in the folder directory
Client/Html/Email/Payment/Html/Summary/Detail/Client.php

And in the config shop file i have put

'client' => array(
'html' => array(
'email' => array(
'payment' => array(
'html' => array(
'summary' => array(
'detail' => 'client',
** Client name has been replaced with 'Client'

Please let me know what I am missing, I'm very confused as to what I am doing wrong!

Thanks for all the help you've given me so fa it is appreciated :ugeek: :geek:
#1991 by aimeos
20 Oct 2015, 11:44
Luke wrote:
Code: Select all'client' => array(
        'html' => array(
            'email' => array(
                'payment' => array(
                    'html'  => array(
                        'summary' => array(
                            'detail' => 'client',



There's only one minor error in you configuration. It must be:
Code: Select all....
                        'summary' => array(
                            'detail' => array(
                               'name' => 'Client',

because the configuration key is "client/html/email/payment/html/summary/detail/name".