Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Downloadable Item - Hyperlink Query


DataMouse

Recommended Posts

Hi all

 

I have a store which is working great (www.datamouse.biz/catalog), and allows downloads from the store without issue.

 

however, i would like to add an image next to the text for the order.

 

When the download link is active, I would like to show one image - when inactive, another.

 

I've had a look how the URL is constructed in download.php, but cannot figure out how to do this and have the image as a download link too.

 

Can anyone help, please?

 

Thanks

 

 

DM

Link to comment
Share on other sites

  • 2 weeks later...

MAKE A BACKUP

 

If I understand what you want, the code in /catalog/includes/modules/downloads.php looks like this:

 

<?php
// The link will appear only if:
// - Download remaining count is > 0, AND
// - The file is present in the DOWNLOAD directory, AND EITHER
// - No expiry date is enforced (maxdays == 0), OR
// - The expiry date is not reached
  if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
	echo '			<td class="main"><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . $downloads['products_name'] . '</a></td>' . "\n";
  } else {
	echo '			<td class="main">' . $downloads['products_name'] . '</td>' . "\n";
  }
?>

You'd need to alter it to something like:

 

<?php
// The link will appear only if:
// - Download remaining count is > 0, AND
// - The file is present in the DOWNLOAD directory, AND EITHER
// - No expiry date is enforced (maxdays == 0), OR
// - The expiry date is not reached
  if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
	echo '			<td class="main"><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . tep_image(DIR_WS_IMAGES . 'active.gif','Click to download') . '</a></td>' . "\n";
  } else {
	echo '			<td class="main">' . tep_image(DIR_WS_IMAGES . 'inactive.gif','Download Unavailable') . '</td>' . "\n";
  }
?>

This code will display the image /images/active.gif as an active download link.

 

And will display the image /images/inactive.gif if the link is inactive.

 

Is that what you want?

:unsure:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...