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: