Spree Commerce Customization
How to change the logo?
Create an image with 116x50 pixels named “
spree_50.png” and put it atapp/assets/images/logo/.Using a new file to overwrite the original one.
Create a new file
app/models/spree/app_configuration.rb.copy the content of
(user)/.rvm/gems/ruby02.X.X/gems/spree_core/app/model/spree/app_configuration.rb“`
Modify the default preference:
preference :logo, :string, default: 'logo/spree_50.png'change
spree_50.pngtoxxx.png
Decorator design pattern
Add a decorative file:
app/models/spree/app_configuration_decorator.rbthen, add
xxx.pngas your logo image.
Spree::AppConfiguration.class_eval do
preference :logo, :string, default: 'logo/xxx.png'
end
The decorator design pattern is a better solution for changing the default logo for Spree site.
Deployment
bundle exec rake railties:install:migrations
bundle exec rake db:migrate
bundle exec rake db:seed
bundle exec rake spree_sample:load
Demo Site
The demo site:
- Demoshop
- Admin page, login as: admin@test.com/spree123
The code base is here
No comments:
Post a Comment