PS_Dude Posted March 3, 2014 Share Posted March 3, 2014 Is it possible (easily) to add a pdf (or other) icon to documents in the Download tab of each product? These are the docs that are added in the "attachments" section of products in the back office. Thanks. Link to comment Share on other sites More sharing options...
AnonymousUser Posted March 3, 2014 Share Posted March 3, 2014 (edited) We did this on our shop. What we did was:In product.tpl under the line {foreach from=$attachments item=attachment} We added : {if ($attachment.mime == "application/pdf")} class="pdf" {/if} to the "a" tag of the PDF.Then, in product.css we added this code: a.pdf { background:url(../img/pdf_icon.png) 0 0 no-repeat; padding:0 0 0 22px !important; } With the png just being a 16x16 PDF icon we made and placed in the theme img folder. Edited March 3, 2014 by AnonymousUser (see edit history) Link to comment Share on other sites More sharing options...
PS_Dude Posted March 4, 2014 Author Share Posted March 4, 2014 Hmmm... can't get this to work. Thinking it may be my placement of the a.pdf tag in the .css file. Knowing now where this code is tho, I also then tried to hardcode an IMG tag to always show a pdf icon, but that shows a broken image icon. I believe it's finding the image file though because if I change the image path to intentionally point to something invalid, it shows a "?" icon. Link to comment Share on other sites More sharing options...
AnonymousUser Posted March 4, 2014 Share Posted March 4, 2014 Hmmm... can't get this to work. Thinking it may be my placement of the a.pdf tag in the .css file. Knowing now where this code is tho, I also then tried to hardcode an IMG tag to always show a pdf icon, but that shows a broken image icon. I believe it's finding the image file though because if I change the image path to intentionally point to something invalid, it shows a "?" icon. It may be a CSS specificity issue. May try and see if something like "#product a.pdf" works as your CSS selector. Link to comment Share on other sites More sharing options...
PS_Dude Posted March 9, 2014 Author Share Posted March 9, 2014 So I've not been able to figure this out with CSS, but hardcoded it for now... essentially just using an img tag. However, I'll probably attach docs other than pdf in the future so I'd like to figure it out. It did not seem to be recognizing the pdf mime type, so I thought I'd try to detect the ".pdf" extension. I just don't know enough (or any smarty yet), so I'll go read up on that first. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now