uc_file - Description text in [file-downloads] token

Project:Ubercart Contributions
Component:Code
Category:
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

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.

Shawn Conn's picture
Offline
Administrator
Joined: 08/07/2007
Juice: 916
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.

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: uc_file - Description text in [file-downloads] token
Assigned to:Shawn Conn» torgosPizza

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";
?>

--
Help directly fund development: Donate via PayPal!

Shawn Conn's picture
Offline
Administrator
Joined: 08/07/2007
Juice: 916
Re: Re: Re: uc_file - Description text in [file-downloads] token
Assigned to:torgosPizza» Shawn Conn

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.

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Shawn Conn's picture
Offline
Administrator
Joined: 08/07/2007
Juice: 916
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.

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: Re: uc_file - Description text in [file-downloads] t
Assigned to:Shawn Conn» torgosPizza

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!

--
Help directly fund development: Donate via PayPal!

affinity's picture
Offline
Joined: 08/22/2008
Juice: 39
Update on this?
Assigned to:torgosPizza» affinity

Hi, I would like to know if there is an update on this, and a step by step process for implementing the change? I'm afraid I'm not a PHP expert, not even a novice, so any help would be appreciated. Where can I get the code, and where should I place it, and are there any adjustments I need to make in the outgoing email, e.g new tokens etc.?

Many thanks!

UPDATE: Please ignore above, as I found the full answer here