Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    I'd like to modify the mail template

    General Discussion
    2
    3
    524
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      KevLav last edited by

      In the file Webkul\Admin\Mail\NewOrderNotification.php you have the code.

           * Build the message.
           *
           * @return $this
           */
          public function build()
          {
              return $this->to($this->order->customer_email, $this->order->customer_full_name)
                      ->from(config('mail.from'))
                      ->subject(trans('shop::app.mail.order.subject'))
                      ->view('shop::emails.sales.new-order');
          }
      

      I'd like to overwrite this to my own view.

      How can I do this?

      Things i've tried:

      • Trying to overwrite events
      <?php
      
      namespace Laveto\Aroma\Providers;
      
      use Illuminate\Support\ServiceProvider;
      use Illuminate\Support\Facades\Event;
      use \Webkul\Admin\Providers\EventServiceProvider as WebkulEventServiceProvider;
      
      class EventServiceProvider extends WebkulEventServiceProvider
      {
          /**
           * Bootstrap services.
           *
           * @return void
           */
          public function boot()
          {
              Event::listen('checkout.order.save.after', 'Laveto\Aroma\Listeners\Order@sendNewOrderMail');
          }
      }
      
      • Overwrite admin service provider (and trying to remove the $this->app->register(EventServiceProvider::class)). And keep of the rest of the code the same.
      1 Reply Last reply Reply Quote 0
      • J
        Jyoti last edited by

        @KevLav
        Override the view file of mail. Refer this - https://forums.bagisto.com/topic/221/how-to-override-view-file-in-bagisto

        1 Reply Last reply Reply Quote 0
        • K
          KevLav last edited by

          Thanks, although this does work great. Can I edit it in my own package? *if not this is fine, but it's just a bit nicer. Since i've used my own package for all other things.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post