26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/synergy.rb', line 26
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c)
end
Time::DATE_FORMATS[:default] = "%d.%m.%Y - %H:%M"
Date::DATE_FORMATS[:default] = "%d.%m.%Y"
Time.zone = "Moscow"
I18n.default_locale = :ru
if Spree::Config.instance
Spree::Config.set(:default_locale => :ru)
Spree::Config.set(:default_country_id => 168)
Spree::Config.set(:allow_ssl_in_production => false)
Spree::Config.set(:disable_bill_address => true)
Spree::Config.set(:admin_interface_logo => "admin/logo.png")
checkout_zone = Zone.first
Spree::Config.set(:checkout_zone => checkout_zone.name) if checkout_zone
Spree::Config.set(:store_email => '[email protected]') unless Spree::Config[:store_email]
Spree::Config.set(:store_phone => '+7 (495) 1234567') unless Spree::Config[:store_phone]
end
::ADDRESS_FIELDS.clear << ["lastname", "firstname", "secondname", "country", "state", "city", "zipcode", "address1", "phone"]
::ADDRESS_FIELDS.flatten!
String.class_eval do
def to_url
self.parameterize
end
end
Calculator::CashOnDelivery.register
PaymentMethod::SberBankInvoice.register
confirm_event = StateMachine::Event.new(Order.state_machine, :confirm_without_payment)
confirm_event.transition :to => 'confirm'
Order.state_machine.events << confirm_event
next_event = StateMachine::Event.new(Order.state_machine, :next)
next_event.transition :from => 'cart', :to => 'address'
next_event.transition :from => 'address', :to => 'delivery'
next_event.transition :from => 'delivery', :to => 'payment'
next_event.transition :from => 'payment', :to => 'confirm'
next_event.transition :from => 'confirm', :to => 'complete'
Order.state_machine.events << next_event
end
|