overriding Spree logo with company logo - where should the new logo go?

1,719 views
Skip to first unread message

Joseph Osako

unread,
Feb 7, 2013, 11:51:58 AM2/7/13
to spree...@googlegroups.com
Having been given suitable course correction in my previous posts here, I have been focusing on getting Spree set up locally, which I've managed. I have now (perhaps somewhat prematurely) been focusing on getting the store modified to the design I want for the final site. To this end, I have studied up on using Deface to override the different elements of the site.

I am presently looking to replace the default Spree logo with that of our company, and found that it is quite simple to do, except that I do not know where to store the logo file itself. I have the following code:

Deface::Override.new(:virtual_path => "spree/shared/_header",
                     :name => "logo",
                     :replace_contents => "#logo",
                     :text =>
"<img src=\"app/assets/images/logo.png\" alt=\"Master Joe's Toybox logo\" />"

Which does indeed replace the logo, but only with the alt text, not the image. What I need to know is, what would be a viable path to save logo.png to, so that it can be served to the browser? I had been given the impression that app/assets/images would be correct, but it doesn't seem to work.

--
Rev. First Speaker Schol-R-LEA LCF POEE JAM LCF MGT GS KoR BiWM TGIF

Joseph Osako

unread,
Feb 7, 2013, 5:53:54 PM2/7/13
to spree...@googlegroups.com
As an aside, I should mention that I have tried overriding it by replacing the spree_50.png image file in the local app/assets/images/admin/bg/ path (as recommended in the Spree Guides here: http://guides.spreecommerce.com/asset_customization.html#overriding-images), but that also didn't seem to have the desired effect.

Matthew Brookes

unread,
Feb 7, 2013, 6:18:08 PM2/7/13
to spree...@googlegroups.com
Try: app/assets/images/store

(app/assets/images/admin is for the backend)

Matthew Brookes

unread,
Feb 7, 2013, 6:26:38 PM2/7/13
to spree...@googlegroups.com

Then in config/initializers/spree.rb you can add config.logo = "store/yourlogo.png"

Ryan Bigg

unread,
Feb 7, 2013, 6:55:33 PM2/7/13
to spree...@googlegroups.com
You don't need Deface to customise the logo at all. Change the logo configuration setting to point to your new logo and Spree will use that accordingly


--
You received this message because you are subscribed to the Google Groups "Spree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spree-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Joseph Osako

unread,
Feb 7, 2013, 7:21:59 PM2/7/13
to spree...@googlegroups.com
OK, I've discarded the Deface code and changed the configuration settings as described, trying a number of versions of the path to make sure I hadn't missed anything, but none of the attempts so far have succeeded - it just keeps using the Spree logo, which isn't what I would expect if it were just a path issue (I would think you'd get a broken image in that case). What am I missing? I've tried restarting WEBrick, but that had no effect either.

Joseph Osako

unread,
Feb 7, 2013, 7:54:55 PM2/7/13
to spree...@googlegroups.com
Ah, it seems I was a bit hasty in dismissing the effect of restarting
WEBrick; I've now got it to the point where it is, at least, dropping
the logo, and instead putting up an 'alt text' consisting of the name
of the logo file without the extension. Interestingly, even though I
in the code I have:

Spree.config do |config|
config.site_name = "Master Joe's Toybox"
config.logo = "images/store/mjtb-logo.png"
end

in the generated source (as seen from the browser), it comes out as

src="/assets/images/store/mjtb-logo.png"

which at least seems to indicate that the path should be the correct
one... though why it has the leading '/' is puzzling, as that would
normally imply that it is a relative address off of the webroot, IIUC.
--
J Osako

Matthew Brookes

unread,
Feb 8, 2013, 7:42:21 AM2/8/13
to spree...@googlegroups.com

Try doing what I suggested in my previous mail.

Joseph Osako

unread,
Feb 8, 2013, 9:42:27 AM2/8/13
to spree...@googlegroups.com
Well, yes, that's exactly what I just was discussing trying, two posts down. Perhaps I wasn't clear in what I wrote, I am sorry if there was any confusion.

Matthew Brookes

unread,
Feb 8, 2013, 1:40:13 PM2/8/13
to spree...@googlegroups.com

Nope, no confusion. Read what I wrote, read what you wrote, diff them if you need to.

Joseph Osako

unread,
Feb 8, 2013, 6:47:54 PM2/8/13
to spree...@googlegroups.com
Ah, got it working now. Thank you for pointing out my mistake.
Reply all
Reply to author
Forward
0 new messages