New file:
includes/modules/pages/product_info/main_template_vars_manufacturers.php
Code:
<?php
/**
* This file provides the URI of the manufacturer that is associated with this product
* permitting display to be based on a specific manufacturer or group of manufacturers.
* mc12345678 3/21/2017
**/
$man_array = array(1,2); // values correspond to manufacturers_id and are those that are to be displayed.
$man_url = '';
if (in_array(zen_get_products_manufacturers_id((int)$_GET['products_id']), $man_array) {
$man_sql = 'SELECT manufacturers_url FROM ' . TABLE_MANUFACTURERS_INFO . ' WHERE manufacturers_id = :manufacturers_id: AND languages_id = :languages_id: LIMIT 1';
$man_sql = $db->bindVars($man_sql, ':manufacturers_id:', zen_get_products_manufacturers_id((int)$_GET['products_id']), 'integer');
$man_sql = $db->bindVars($man_sql, ':languages_id:', (isset($_SESSION['languages_id']) ? $_SESSION['languages_id'] : 1), 'integer');
$man = $db->Execute($man_sql);
foreach ($man as $manurl) {
$man_url = $manurl['manufacturers_url']; // if this is used in pre ZC 1.5.5, then need to modify this to be a loop on while(!$man->EOF) and that $man_url = $man->fields['manufacturers_url']
}
}
Then inside of your includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_default.php
Locate where you would like to have this URL presented and can then add within the "HTML space":
Code:
<!-- BOF Manufacturer's URL -->
<?php if (zen_not_null($man_url)) {
?><a href="<?php echo $man_url; ?>"><?php echo $man_url; ?></a><?php
}
?><!-- EOF Manufacturer's URL -->
Which will only create a clickable link of the url with the url presented. Change the second echo to whatever is desired to be displayed to the user and add any class, span, div, etc other tags around or within the link as applicable.
If you use other product types (document, music, etc...) then the same file above and similar modification would need to be applied to the applicable file type folder and template file.
Bookmarks