I wanted to have different download messages for different products. Right now, I have two product types.

1. Paid Product Download with a password protected PDF File.
2. Free Sample Download of another products that is not password protected.

For the first type, I wanted a download message that included the password and other information.

For the free product (2) I wanted to have the standard message.

Two files needed to be modified.

includes\languages\custom\english.php
includes\templates\custom\templates\tpl_modules_downloads.php

where "custom" is my template name I'm using as part of the Zen Cart Template Override System.
https://www.zen-cart.com/tutorials/i...hp?article=230


On line 593 of english.php I copied and duplicated the line
PHP Code:
define('HEADING_DOWNLOAD''To download your files click the download button and choose "Save to Disk" from the popup menu.'); 
This is the download message that the customer sees when they purchase and that they see in their order history.

I named the duplicate 'HEADING_DOWNLOAD_1' and changed the description to how I wanted it to read -- disclosing the password needed to open the file to the customer.

I could define a number of different Downloand Messages by repeating the above step.

Next I modified the tpl_modules_downlaod.php file. Here is my actual code at about line 20 with a conditional statement. Right now I can define one of my products uniquely as starting with the word "Data," so I simply used that single word to define the condition. The last 8 lines or so were not been changed, they are just shown so you can see where the code fits.

PHP Code:
<?php
    
if(stristr($downloads->fields['products_name'],'Data')) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="downloads">
<caption><h4><?php echo HEADING_DOWNLOAD_1?></h4></caption>
<?php  } else { ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="downloads">     
<caption><h4><?php echo HEADING_DOWNLOAD?></h4></caption>
<?php
        
}
?>
  <tr class="tableHeading">
      <th scope="col" id="dlFileNameHeading"><?php echo TABLE_HEADING_PRODUCT_NAME?></th>
      <th scope="col" id="dlByteSize"><?php echo TABLE_HEADING_BYTE_SIZE?></th>
      <th scope="col" id="dlButtonHeading"><?php echo TABLE_HEADING_DOWNLOAD_FILENAME?></th>
      <th scope="col" id="dlDateHeading"><?php echo TABLE_HEADING_DOWNLOAD_DATE?></th>
      <th scope="col" id="dlCountHeading"><?php echo TABLE_HEADING_DOWNLOAD_COUNT?></th>
      <th scope="col" id="dlButtonHeading">&nbsp;</th>
          </tr>
So the conditional if statement tests if the product name contains "Data" and if so the download message defined by HEADING_DOWNLOAD_1 is displayed. Otherwise the standard HEADING_DOWNLOAD message is displayed.

You can easily expand on this if you have multiple products and want different download messages for each.