Skip to Content

Why UID is using instead of email for the customer While Order confirmation Email Generation Process in B2B Site

By default, B2B Site using the uid of Customer while generating the order confirmation email. But I want to Use customer email to send the order confirmation.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 21, 2016 at 07:29 PM

    Hello,
    I think from OOTB the order confirmation email should be sent using user(customer)'s email .
    As you can see from "b2bapprovalprocess-spring.xml", the bean:

     <bean id="informOfOrderApproval"
               class="de.hybris.platform.b2b.process.approval.actions.InformOfOrderApproval"
               parent="abstractProceduralB2BOrderApproveAction">
          <property name="fromAddress" value="b2b@hybris.com"/>
          <property name="b2bEmailService" ref="b2bEmailService"/>
     </bean>
    
    

    In "b2bEmailService(DefaultB2BEmailService)", the method "createOrderApprovalEmail()" is to create this kind of email. And for the email's recipient, it is like this:

     email.addTo(user.getEmail());
    

    However, you can implement your own emailService bean in the "informOfOrderApproval", by extending "DefaultB2BEmailService", and override "createOrderApprovalEmail()" to make sure the email is sent to the customer's email address.
    Hopefully this could help you a little bit.

    Thanks & Regards,
    Hongxian

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 03, 2016 at 08:06 AM

    Hello , This we can resolve from the code In DefaultCustomerEmailResolutionService this class hybris people are verifying the customer uid as email address in the method validateAndProcessEmailForCustomer . they are considering the customer Uid as Email address . So in the catch block you can check again whether the user has any email address either from his addresses or from currentUser and return it if the uid is not equal to Email addresss. like below.

    email = customerModel.getAddresses().iterator().next().getEmail(); if (StringUtils.isBlank(email)) { final B2BCustomerModel b2BCustomerModel = (B2BCustomerModel) userService.getCurrentUser(); email = b2BCustomerModel.getEmail(); } if (StringUtils.isNotBlank(email)) { LOG.info("Found one Email Address for Customer :: " + email); }

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.