Created
September 17, 2013 01:06
-
-
Save bryanmtl/6588851 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Shipment.class_eval do | |
def send_shipped_email | |
unless Rails.env.production? | |
::Spree::ShipmentMailer.shipped_email(self.id).deliver | |
end | |
end | |
end | |
Spree::Order.class_eval do | |
def deliver_order_confirmation_email | |
unless Rails.env.production? | |
begin | |
::Spree::OrderMailer.confirm_email(self.id).deliver | |
rescue Exception => e | |
logger.error("#{e.class.name}: #{e.message}") | |
logger.error(e.backtrace * "\n") | |
end | |
end | |
end | |
def after_cancel | |
restock_items! | |
unless Rails.env.production? | |
::Spree::OrderMailer.cancel_email(self.id).deliver | |
unless %w(partial shipped).include?(shipment_state) | |
self.payment_state = 'credit_owed' | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment