This module interfaces with the awesome uc_file modules (File Downloads in core) to allow users who have previously purchased a File Download product to access new additions.
In other words, Product A has downloads attached to it - when an admin adds another downloadable file to the product, they can choose to add the new file to the Queue. When the Queued file is Processed, a list of all users and order numbers that contain this product is shown as each user (the owner of the product) is granted access to the new file. So now, everyone who has already purchased Product A now has access to the brand new file.
This is working in a live production environment, and tested fairly heavily. If you have any feature requests let me know. There are a few TODO's in the module, which is pretty well commented. I'll be working on these and updating the module accordingly as each new feature is completed.
| Attachment | Size |
|---|---|
| uc_file_retro.tar.gz | 3.4 KB |



Queue not being processsed
Hi there - this is an awesome contrib, thanks - but I can't get it to work.
I installed the module and added an additional file download to a product. I checked 'Queue for retroactive purchase' and a line showed up in the uc_file_retro_queue table
However, I can't get the queue to process.
When I click on the 'Click here to process the File Queue' link I get a 404 error.
I looked at your code and saw that on line 70 it reads:
drupal_set_message(t('<a href="/admin/store/products/files/queue">Click here</a> to process the File Queue.'));This assumes that Drupal is installed in the webroot. In my case Drupal is installed in a subfolder of webroot (called 'cms') so the link was broken. So I manually went to
www.mysite.com/cms/admin/store/products/files/queue
...but 'Process Queue' is empty and 'Queued File History' says 'No file history yet'
So the data seems to be there in the DB yet the form isn't being populated, at least in my installation (unix/UC Beta 5)
Any thoughts? Would love to get this working!
Thanks...
Re: Queue not being processsed
Ahh, a silly oversight on my part. This will have to change in the paths of the menu functions as well, otherwise those pages will not show up. Stupid noob mistake! I'll post a fixed version here in a sec.
EDIT: I have seen this issue with products that utilize attributes. I wasn't thinking ahead when I wrote it, so in the case that someone purchases an attribute / adjusted product (instead of SKU-Product they buy SKU-Product-Medium) which doesn't match the value in uc_product then the list won't show up.
I'm looking into this now. Are you using attributes on your product? And also, what did you select in the drop down for your product's file download feature? "Any" or a specific SKU?
Hi I am not using
Hi
I am not using attributes. However I did have SKU set to 'Any' when I added the download to the product. Silly noob! Sorry.
So I tried again, deleting the file from the product and re-adding it with the same SKU as the product. Then I manually went to the File Process page and the item was in the queue. All good. But then I clicked on 'Process' and got the following error:
user warning: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' query: SELECT * FROM uc_orders AS o JOIN uc_order_products AS ors ON ors.order_id = o.order_id LEFT JOIN uc_file_products AS fp ON ors.model = fp.model WHERE ors.model LIKE '' AND fp.pfid LIKE 9 AND o.order_status != 'in_checkout' GROUP BY o.uid in /home/blahblah/public_html/mysite/cms/includes/database.mysql.inc on line 172.
I appreciate your help - I'm a noob too and have spent the best part of three days writing a very simple contrib so I know what a pain it is!
Thanks...
Re: Hi I am not using
Weird, what versions of PHP and MySQL are you using? I don't get that error at all, but it looks like some restriction on the field type in your database table.
Can you change, in the uc_file_retro_queue, table, the "status" field to have a collation of utf8_general_ci instead of utf8_unicode_ci? I'm not sure what to change in the install since I'm specifying the character encoding already... maybe it's the length of the field?
Collation type
Hi there
So i did an uninstall and re-install of the contrib.
Immediately after reinstall, I checked the table on phpMyAdmin. The following fields in the table uc_file_retro_queue have a collation set (the rest are blank): model, description, qstatus. In each case the collation was set to utf8_general_ci after install.
Just for kicks I changed those three fields to utf8_unicode_ci and gave it a whirl but then I got errors immediately on going to Process Queue:
user warning: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' query: SELECT * FROM uc_file_retro_queue AS q JOIN uc_files AS f ON f.fid = q.fid JOIN uc_products AS p ON p.model = q.model LEFT JOIN node AS node ON p.nid = node.nid WHERE q.qstatus = 'in_queue' ORDER BY q.model ASC in /home/blahblah/public_html/mysite/cms/includes/database.mysql.inc on line 172.
Before I changed the collation, the item showed up in the list waiting to be processed and the error was generated when I clicked 'Process.' After changing the collation to unicode the list was completely unpopulated and the error showed up immediately upon going to the Process Queue page.
I'm using PHP 5.2.2 and mySQL 4.1.22
Just to be clear:
If collation of uc_file_retro_queue is set to unicode, the Process Queue list is unpopulated and I get the error immediately.
If the colloation of uc_file_retro_queue is set to general, the Process Queue list IS populated but then on clicking 'Process' I get the error.
Cheers....
----EDIT
I just noticed that model and description in uc_file_products are utf8_unicode_ci, whereas most of the other UC tables are utf8_general_ci, as is your uc_file_retro_queue table. Hmmmm.
I just noticed that model
I just noticed that model and description in uc_file_products are utf8_unicode_ci, whereas most of the other UC tables are utf8_general_ci, as is your uc_file_retro_queue table.
That's probably the issue. Try changing those to general and see if the error persists. If it clears up the issue, please post an issue in the Issue Tracker for the uc_file.module. That's Shawn Conn's module and he'd be the one in charge of squashing that bug / inconsistency
Yup, that was it....
I changed the collation for model and description in uc_file_products from utf8_unicode_ci to utf8_general_ci and everything's working ticketyboo - the only thing now is the broken links to the File Process tab...
Thanks for your patience and help!
Re: Yup, that was it....
I can't post the update now, but the easiest thing to do is to change the line where the link is generated to this:
<?phpdrupal_set_message(t('<a href="'.base_path().'/admin/store/products/files/queue">Click here</a> to process the File Queue.'));
?>
That way the base_path gets echoed, that should make everything consistent.
Re: Yup, that was it....
Should be:
drupal_set_message(t('<a href="'.base_path().'admin/store/products/files/queue">Click here</a> to process the File Queue.'));No slash before admin, otherwise you get a double slash....
Cheers!
Re: Re: Yup, that was it....
Cool, I wasn't sure about that (hadn't tested it yet). Will fix that before I post the new version. Thanks for helping me hash out these issues
Re: I just noticed that model
Yeah, I've gone a head and removed the explicit collation setting for all my .install files. Ryan should be making changes to all other ubercart .install files soon as well.