Inhalte aufrufen

Profilbild

Adding an Email to the Order Details Invoice Print


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
4 Antworten zu diesem Thema

#1 nahjil

nahjil

    Newbie

  • Members
  • Punkt
  • 6 Beiträge

Geschrieben: 04 August 2015 - 23:12

Two questions.

First is the view at View/Order/Details.Print.cshtml the one I need to edit in order to print the invoice from /Order/Print when you click on the Print button from edit order in the admin panel to add an email address after the Customers address?

Second is the email address part of the Order.BillingAddress object or do I need to get it from somewhere else?  Thanks



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 05 August 2015 - 12:01

1. Yes. Looks like View/Order/Details.Print.cshtml is used by frontend and backend (Admin/OrderController/Print uses an empty area parameter).
2. I would give Customer.Email priority (if it's not empty).

  • nahjil gefällt das

Marcus Gesing

Smartstore AG


#3 nahjil

nahjil

    Newbie

  • Members
  • Punkt
  • 6 Beiträge

Geschrieben: 05 August 2015 - 17:18

So I have limited experience with this framework. (Extremely limited though I'm learning). How would I go about accessing the Customer object? Does this controller method even have the current customer, I don't have the backend code anywhere sorry.  I can tell that it has the current order object and access to the catalog. Would it be as simple as putting @using Smartstore.Core.Domain.Customer with the other using statements or is there some other method in which I should approach this?

 

 

    @model IEnumerable<OrderDetailsModel>
    @using SmartStore.Core.Domain.Orders;
    @using SmartStore.Core.Domain.Catalog;
    @using SmartStore.Web.Models.Order;
    @using SmartStore.Services.Localization;
    @using SmartStore.Core.Html;

 

Is the set of using statements in View/Order/Details.Print.cshtml



#4 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 05 August 2015 - 20:52

OrderDetailsModel has the property BillingAddress.Email, so it's perhaps easier to use this. If you need customer data anyway you have to
extend OrderDetailsModel by properties like CustomerEmail and so on. This should be done in Web.OrderController.PrepareOrderDetailsModel.
The method has an order parameter and you can access the customer instance by order.Customer.

  • nahjil gefällt das

Marcus Gesing

Smartstore AG


#5 nahjil

nahjil

    Newbie

  • Members
  • Punkt
  • 6 Beiträge

Geschrieben: 05 August 2015 - 21:42

Just need the email they used for billing anyway. Thanks you have been a great help.