New Zenner
- Join Date:
- Jul 2005
- Posts:
- 67
- Plugin Contributions:
- 0
Links to pdf File on Product Page
How do I setup a link to a pdf file off a prduct page? I tried the web link in the editor- it opened a blank box.
Views: 3,303
New Zenner
How do I setup a link to a pdf file off a prduct page? I tried the web link in the editor- it opened a blank box.
Totally Zenned
Either enter the link in the code view of the editor using ```
<a href="http://domain.com/filename.pdf" target="_blank">Link text here</a>
Or, if you're not using the products url for anything else, use that, and change the text in the language file.
Totally Zenned
We used the add a link in the product description,
and we changed the text to a button,
Totally Zenned
Ryk:
Either enter the link in the code view of the editor using ```
<a href="http://domain.com/filename.pdf" target="_blank">Link text here</a>
>
> Or, if you're not using the products url for anything else, use that, and change the text in the language file.
I created a PDF folder under Imgaes /public_html/images/PDFS and I figured out how to use the products URL link to display the pdf.. But how do I now change the text in the language file (assuming its the product_info.php file that I'm supposed to edit) to display it as a PDF image instead of the usual.. for more information visit this webpage text...
Simple steps please..???:smile:
Totally Zenned
Anyone..?
Totally Zenned
Hello Mike
A "pdf" can only be read if the client computer has a pdf reader installed (typically this is Adobe Acrobat).
A PDF is not an image format - it is a "document reader" - hence the name Portable Document Format.
If you have images that are embedded in a pdf, you are first going to have to "extract" the image from the pdf, then save it in an image format (jpg, gif, png, bmp, ...) and then upload that to the image folder and then assign relevant images to their products in the normal way.
There are several ways of extracting the image from a PDF - one is to use the "Click" tool (looks like a "camera" in adobe acrobat), then you "paste" the image in an image editor and save it as a jpg. Or you can do a "ALT+PrtSc" which will "grab" the screen, which you can then edit in an image editor.
Totally Zenned
... Oh... okay, I see what you are trying to do...
I'll see if I can find the relevant language file then post later...
Totally Zenned
Here are the files that contain the text string you wish to alter:-
/includes/languages/english/document_general_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');
/includes/languages/english/document_product_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');
/includes/languages/english/product_free_shipping_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');
/includes/languages/english/product_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');
/includes/languages/english/product_music_info.php
Line #11 : define('TEXT_RECORD_COMPANY_URL', 'For more information, please visit the Record Company's <a href="%s" target="_blank">webpage</a>.');
Line #12 : define('TEXT_ARTIST_URL', 'For more information, please visit the Artist's <a href="%s" target="_blank">webpage</a>.');
So, you would probably do this to the DEFINE...
define('TEXT_MORE_INFORMATION', 'For more information, please click the pdf symbol:- <a href="%s" target="_blank"><img border=0" src="images/YOUR-PDF-SYMBOL.jpg" width="10" height="10"></a>.');
Where:-
images/YOUR-PDF-SYMBOL.jpg is the PATH to, and NAME OF the little pdf icon you created.
width="10" height="10" are the desired display sizes for that icon
Totally Zenned
I just tried this on my store...
I edited:-
/includes/languages/english/product_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');
define('TEXT_MORE_INFORMATION', 'For more information, please click the PDF symbol: <a href="%s" target="_blank"><img border=0" src="images/adobe.jpg" width="29" height="29"></a>.');
See the result at the bottom of THIS PAGE
REMEMBER to save the edited version of product_info.php to your CUSTOM folder (over-rides).
Totally Zenned
fairestcape:
Here are the files that contain the text string you wish to alter:-
/includes/languages/english/document_general_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');/includes/languages/english/document_product_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');/includes/languages/english/product_free_shipping_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');/includes/languages/english/product_info.php
Line #11 : define('TEXT_MORE_INFORMATION', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');/includes/languages/english/product_music_info.php
Line #11 : define('TEXT_RECORD_COMPANY_URL', 'For more information, please visit the Record Company's <a href="%s" target="_blank">webpage</a>.');
Line #12 : define('TEXT_ARTIST_URL', 'For more information, please visit the Artist's <a href="%s" target="_blank">webpage</a>.');So, you would probably do this to the DEFINE...
define('TEXT_MORE_INFORMATION', 'For more information, please click the pdf symbol:- <a href="%s" target="_blank"><img border=0" src="images/YOUR-PDF-SYMBOL.jpg" width="10" height="10"></a>.');
Where:-
images/YOUR-PDF-SYMBOL.jpg is the PATH to, and NAME OF the little pdf icon you created.
width="10" height="10" are the desired display sizes for that icon
Many Thanks..
Worked perfect.. thanks.. just changed the image size to suit...
http://www.nortsandones.com.au/index.php?main_page=product_info&cPath=47_79&products_id=875
Only one issue, not all my produts have actual pdf's associated, some sites just have direct links to the manufacurers site.. Is there another way to do this so that if its pdf, show as above, but if it's just a URL, leave it as it was ?
Totally Zenned
Mike_Dean:
Only one issue, not all my produts have actual pdf's associated, some sites just have direct links to the manufacurers site.. Is there another way to do this so that if its pdf, show as above, but if it's just a URL, leave it as it was ?
hmmmm... difficult... would require some very nifty conditional coding (IF... ELSE) and I'm not a coder!
BUT...
There is a way to achieve this using customised STYLESHEETS for individual products. But it's clunky and requires a customised stylesheet for every product that has such a link (either pdf or text link to mfg)
If you want to try this, here's how:
Edit
/includes/languages/english/product_info.php
just underneath the define you modified for the pdf image to show, create this new define...
define('TEXT_MORE_INFORMATION_TEXT', 'For more information, please visit this product's <a href="%s" target="_blank">webpage</a>.');
...nb: the _TEXT bit
Save the file. (probably already exists in your overrides folder)
Grab a COPY of
/includes/templates/template_default/templates/tpl_product_info_display.php
(If you have this in your over-rides folder, copy that one. Make sure you BACK UP the original in case things go pear-shaped!)
Near the bottom, find:-
<!--bof Product URL -->
<?php
if (zen_not_null($products_url)) {
if ($flag_show_product_info_url == 1) {
?>
<p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php
} // $flag_show_product_info_url
}
?>
<!--eof Product URL -->
Highlight and COPY this whole section, then PASTE it below that section again, and make a couple of small modifications:-
<!--bof Product URL --> to <!--bof Product URL TEXT-->
and
id="productInfoLink" to id="productInfoLinkText"
and
TEXT_MORE_INFORMATION to **TEXT_MORE_INFORMATION_TEXT
**
and finally...
<!--eof Product URL --> to <!--eof Product URL TEXT-->
<!--bof Product URL TEXT-->
<?php
if (zen_not_null($products_url)) {
if ($flag_show_product_info_url == 1) {
?>
<p id="productInfoLinkText" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION_TEXT, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php
} // $flag_show_product_info_url
}
?>
<!--eof Product URL TEXT-->
So, the code now looks like this:-
<!--bof Product URL -->
<?php
if (zen_not_null($products_url)) {
if ($flag_show_product_info_url == 1) {
?>
<p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php
} // $flag_show_product_info_url
}
?>
<!--eof Product URL -->
<!--bof Product URL TEXT-->
<?php
if (zen_not_null($products_url)) {
if ($flag_show_product_info_url == 1) {
?>
<p id="productInfoLinkText" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION_TEXT, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php
} // $flag_show_product_info_url
}
?>
<!--eof Product URL TEXT-->
What we are doing here is creating TWO scenarios for the same thing, giving them different DEFINES and different STYLE ID's, because we are going to control the display of either style ID using customised stylesheets.
Bear in mind, that what we now have is:
a STYLE ID for the PDF (#productInfoLink)
and
a STYLE ID for the text link (#productInfoLinkText).
(We also have associated DEFINES, depending on which STYLE ID we wish to display.)
Create Custom Stylesheets
Using the product ID, you can create a stylesheet that is SPECIFIC ONLY TO THAT PRODUCT.
So, let's say that Product with Zen ID 188 has a PDF associated with it...
You will create a stylesheet called "p_188.css"
You will want it to HIDE the TEXT LINK, but display the PDF link
In this case, your stylesheet will simply be:
**
#productInfoLinkText {display: none;}**
For a product with a webpage (text) link, you do the opposite...
Say that Product with Zen ID 205 has a WEB LINK
You create a stylesheet called "p_205.css"
You will want it to HIDE the PDF LINK, but display the Text link
In this case, your stylesheet will simply be:
#productInfoLink {display: none;}
Now you have the basis for the customised stylesheets.
For all products that need the PDF link, you make copies of p_188.css (and name them with the relevant ID)
and for products that need the weblink, you make copies of p_205.css (and name them with the relevant ID).
As I said, clunky, but it works ! :smile:
Totally Zenned
Many thanks for the very detailed advice.. Much appreciated.. Just need to decided if I want to go down this path now..!!!!
Tell staff why this post should be reviewed.