uc_file - Description text in [file-downloads] token

Project: 
Ubercart
Category: 
feature request
Priority: 
normal
Assigned: 
Unassigned
Status: 
closed

Shawn,

Was wondering if it'd be possible to include, in the list of file downloads for the outgoing email, the descriptive text for each download link? Some of our products have 4-6 links and it's pretty hard to discern which is which. Adding the text to the token would be a huge help.

Re: uc_file - Description text in [file-downloads] token

I'm still up in the air what to do about this. Its currently set to just display the URL path for those who don't have HTML email. I'm thinking about ditching this in favor of something else. For now, you can edit uc_file_token_values to have return the markup you'd like. The variable $file_download contains the uc_file_users row associated with the download. From that you should be able to pull the data you need for the links.

Re: Re: uc_file - Description text in [file-downloads] token

Man, I wish I had known it was that simple! Thanks for the tip. It's just one extra line, and I think it's necessary especially at our level where we have a ton of emailed links going out and people can get easily confused.

<?php
$description
= t(db_result(db_query("SELECT description FROM uc_file_products WHERE pfid = %d AND fid = %d", $file_download->pfid, $file_download->fid)));
                   
$output_file_downloads .= '<a href="'.$download_url.'">'.$download_url.'</a> -'.$description."\n";
?>

Re: Re: Re: uc_file - Description text in [file-downloads] token

Glad to help. Just make sure you keep a mental note about the changes when you upgrade to beta. I think the thing to do here is come up with some sort of configurable template that can be edited to fit the store's need. I'll put this one my beta battle plans.

Re: Re: Re: uc_file - Description text in [file-downloads] token

To update you on the progress of things, I've now wrapped up the file-downloads in a theme function, theme_uc_file_downloads_token. If you're not aware of it, you can override theme functions for each Drupal theme. See the documentation for reference on how to do this.

Re: Re: Re: Re: uc_file - Description text in [file-downloads] t

Wow, cool. I will check it out, probably update to the latest bazaar in a couple days. Want to wait for things to slow down again.

I also changed it so that instead of emailing the LINK to people, it emails a linked Filename and then the description next to it to make things easier.

If I can still do this with the new token theme, then that is fantastic Smiling Thanks!