Search code examples
emailsap-commerce-cloud

eCommerce with Hybris: Email Template Generation


Hello Experts, I am newbie to Hybris Ecommerce and currently i am working on generating hybris email template for B2C.I am following the below link :

http://flexblog.faratasystems.com/index.php/ecommerce-with-hybris-sending-emails/

Email Context Object :

public class OneMillionPurchaseEmailContext extends AbstractEmailContext
{
    // ...

    @Override
    public void init(final BusinessProcessModel businessProcessModel, final EmailPageModel emailPageModel)
    {
        // ...
        put(FROM_EMAIL, emailPageModel.getFromEmail());
        put(FROM_DISPLAY_NAME, emailPageModel.getFromName());
        put(DISPLAY_NAME, "BDI Customer Service");
        put(EMAIL, getCustomerEmailResolutionService().getEmailForCustomer(getCustomer()));
        // ...
    }

    @Override
    protected BaseSiteModel getSite(final BusinessProcessModel businessProcessModel)
    {
        return ((StoreFrontProcessModel) businessProcessModel).getSite();
    }

    @Override
    protected CustomerModel getCustomer(final BusinessProcessModel businessProcessModel)
    {
        return ((StoreFrontCustomerProcessModel) businessProcessModel).getCustomer();
    }
}

In the above code,Can anyone guide me from where we have to call this email context Object class?It would be appreciated if anyone can guide or provide any links or docs for email template generation configuration process.


Solution

  • This is called from platform/acceleratorservices/process/email/context/impl/DefaultEmailContextFactory.java Then this is used in platform/acceleratorservices/email/impl/DefaultEmailGenerationService.java which is in a standard hybris extension. In order for the Factory to resolve your context, you must have a bean in your -spring.xml configuration for OneMillionPurchaseEmailContext .

    For more information, i would recommend the hybris wiki