Forums / General Questions / Links to pdf File on Product Page

Links to pdf File on Product Page

Locked
Results 1 to 12 of 12
This thread is locked. New replies are disabled.
15 Feb 2007, 22:37
#1
paulssports avatar

paulssports

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.
15 Feb 2007, 23:47
#2
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Posts:
3,644
Plugin Contributions:
6

Re: Links to pdf File on Product Page

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.
16 Feb 2007, 00:02
#3
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
1

Re: Links to pdf File on Product Page

We used the add a link in the product description,
and we changed the text to a button,
15 Apr 2008, 10:47
#4
mike_dean avatar

mike_dean

Totally Zenned

Join Date:
Feb 2006
Posts:
531
Plugin Contributions:
0

Re: Links to pdf File on Product Page

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:
16 Apr 2008, 10:32
#5
mike_dean avatar

mike_dean

Totally Zenned

Join Date:
Feb 2006
Posts:
531
Plugin Contributions:
0

Re: Links to pdf File on Product Page

Anyone..?
16 Apr 2008, 10:57
#6
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Posts:
2,957
Plugin Contributions:
0

Re: Links to pdf File on Product Page

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.
16 Apr 2008, 11:04
#7
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Posts:
2,957
Plugin Contributions:
0

Re: Links to pdf File on Product Page

... Oh... okay, I see what you are trying to do...

I'll see if I can find the relevant language file then post later...
16 Apr 2008, 11:22
#8
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Posts:
2,957
Plugin Contributions:
0

Re: Links to pdf File on Product Page

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
16 Apr 2008, 11:35
#9
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Posts:
2,957
Plugin Contributions:
0

Re: Links to pdf File on Product Page

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).
16 Apr 2008, 11:46
#10
mike_dean avatar

mike_dean

Totally Zenned

Join Date:
Feb 2006
Posts:
531
Plugin Contributions:
0

Re: Links to pdf File on Product Page

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 ?
16 Apr 2008, 12:55
#11
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Posts:
2,957
Plugin Contributions:
0

Re: Links to pdf File on Product Page

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:

1.
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)

2.
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:-

[PHP]<!--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 -->[/PHP]

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-->

[PHP]<!--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-->[/PHP]

So, the code now looks like this:-

[PHP]<!--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-->[/PHP]

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.)

3.
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:
17 Apr 2008, 08:45
#12
mike_dean avatar

mike_dean

Totally Zenned

Join Date:
Feb 2006
Posts:
531
Plugin Contributions:
0

Re: Links to pdf File on Product Page

Many thanks for the very detailed advice.. Much appreciated.. Just need to decided if I want to go down this path now..!!!!