Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit email views in shoppe

I can't seem to find the shoppe tag in stackoverflow.


I'm using Shoppe gem for rails.

I want to know if there is a way to edit the views for the emails that are being sent when an order is placed in shoppe.

I would like to add an attachment to the email when you accept the order.

Thanks!

like image 721
Johhan Santana Avatar asked Dec 14 '25 06:12

Johhan Santana


2 Answers

It seems that you can just re-define Shoppe's mailer method:

module Shoppe
  class OrderMailer < ActionMailer::Base

    def received(order)
      @order = order
      attachment(content_type: 'image/jpeg', body: File.read('image.jpg'))
      mail :from => Shoppe.settings.outbound_email_address, :to => order.email_address, :subject => I18n.t('shoppe.order_mailer.received.subject', :default => "Order Confirmation")
    end
  end
end

Puts that somewhere into your app/initializers. Remember to set your content-type properly.

like image 164
EugZol Avatar answered Dec 15 '25 18:12

EugZol


This is the best and fastest solution for anyone who just wanting to change the actual text like i did.

You can just go directly to the file of the email and edit it. all i did was visit The exact File Here and recreate that file and its path into my own application and changed the words to my pleasing.

https://github.com/tryshoppe/shoppe/blob/master/app/views/shoppe/order_mailer/accepted.text.erb

like image 28
Fdwillis Avatar answered Dec 15 '25 20:12

Fdwillis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!