Forums / Templates, Stylesheets, Page Layout / truncate file download name help please?

truncate file download name help please?

Locked

Views: 607

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
23 Sep 2009, 12:28 PM
#1
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

truncate file download name help please?

im trying to use the zen_trunc_string on the tpl modules downloads page so that i can limit the characters in my filenames for download as they are stretching the tables on that page and altering the layout.

the original was this:

      $is_downloadable = ( (file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']) && (($downloads->fields['download_count'] > 0 && $download_timestamp > time()) || $downloads->fields['download_maxdays'] == 0)) ) ? true : false;

and i have changed it to this:

$is_downloadable = ( (file_exists((zen_trunc_string(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename'], 25))) && (($downloads->fields['download_count'] > 0 && $download_timestamp > time()) || $downloads->fields['download_maxdays'] == 0)) ) ? true : false;

but it doesnt seem to be working? am i doing something wrong?

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion

23 Sep 2009, 10:45 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: truncate file download name help please?

Yes, you are doing something wrong. You are truncating the filename before the cart checks to see if it exists - that check for file_exists will always return false.

You need to be editing much further down the file, where it is actually displaying the filename on the page:

<td class=""><?php echo $downloads->fields['orders_products_filename']; ?></td>

Neville
An assumption is what you arrive at when you get tired of thinking...

24 Sep 2009, 9:20 AM
#3
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: truncate file download name help please?

wow, what a ridiculous mistake lol thanks so much, i think i need to stop working so late lol

thanks again :clap:

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion