Closed (fixed)
Project:
Commerce File
Version:
7.x-2.x-dev
Component:
Code
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Jun 2011 at 12:02 UTC
Updated:
1 Aug 2013 at 11:01 UTC
Jump to comment: Most recent file
Comments
Comment #1
michob commentedI'm looking at doing a similar thing with video... I'm wondering what the workflow is for the user in your case - do they have to upload the files first and manually select them to be "commercialized" or is the process automatic for each file? I'm hoping for the latter for my application but from everything I've read so far, it seems like using the Feeds method is manual (or via a cron job).
thanks!
Comment #2
discipolo commentedyep, its almost automatic - he has to import the uploaded mediafiles using feeds (could be automatized)
Comment #3
discipolo commentedi also tried to extend commerce_file to let me pick existing producttypes with media asset fields.
i havent really gotten beyond the settings form though. its only a little stub using code from the exif module.
Comment #4
discipolo commentedhijacking this feature since i would prefer this approach.
i added a widget to the patch (includes previous changes, against current git) i still need some help getting the fid and writing it into the field.
Comment #5
discipolo commentedwho would have thought, i got it working. probably have to clean it up a lot though (locale or defaults for instance) but as a proof of concept this should be a starting point
Comment #6
recrit commentedMedia field will not be supported until it can provide a private file scheme that is needed to sell files. - @see http://drupal.org/node/1069582. The Drupal core file field has this support natively which is why Commerce File Field is a wrapper around that.
@discipolo: Your patch changes a lot more than just add media support - remove licensing settings, overrides options widget field types with solely media, etc.
Alternatives:
The filefield_sources module provides an easy way to reference existing files (http://drupal.org/project/filefield_sources); however, it is currently limited to only referencing files associated with the field, ie not all files on the system. Also it would need to take into account the allowed file schemes.
Comment #7
discipolo commentedaha, i see
mediafiles get saved to the right location, even using the field upload. but there is something wrong with the displaylinks. will investigate further.
Comment #8
recrit commentedI did some testing and have figured out how @discipolo could have had the files being stored correctly in the private file system.
The media module uses the following for the file scheme instead of the 'allowed_schemes' defined in the field settings. Also line 253 of media.fields.inc states "// @todo: Not implemented" above the allowed_schemes setting.
Since it uses the default, the only way to have media module store a file in the private file system is to set the default for the entire site to be "private". This is not ideal for performance reasons. The best case is to have a public default and then only the file you want private to be in the private file system.... thats the power of the new D7 file system.
To sum it up, the media module still does not directly support different file schemes even though its an option on the settings form.
Comment #9
damienmckennaWould like to see this progress.
Comment #10
discipolo commentedso maybe someone can tell me how to access the settings already in code in includes/media.fields.inc
function media_field_widget_settings_form or
function media_field_widget_form
and put them in includes/media.pages.inc lines 235 & 272 instead of $scheme = variable_get('file_default_scheme', 'public') . '://'; ?
Comment #11
discipolo commentedjust for reference:
here is that patch cleaned up and commented. should not destroy anything now.
and as to how to make media working:
can someone explain to me whether it isn`t sufficent to change
media/includes/media.fields.inc line 44 to read 'allowed_schemes' => variable_get('file_default_scheme', 'public'),
Comment #12
recrit commentedmedia/includes/media.fields.inc line 44 -- that needs to be an array since its defining the default selected options for the allowed schemes.
commerce_file_media-1186162-x.patch -- The added functionality is more of a specific integration to media module, so I would suggest creating a new module for it... media_product or something else. As for Commerce File, if it ever does integrate with other file modules it would be a generic interface that doesn't cater to a single module.
Comment #13
discipolo commentedi also managed to make media save to private filesystem by simply adding radiobuttons to the uploadbrowser using the instructions from http://drupal.org/node/1139266#comment-4532552 but using the form from
media_field_widget_settings_form($field, $instance) --> $form['allowed_schemes']
instead of the directory. i did this because i couldnt figure out how to get at the widget settings.
should´nt that be viable?
(this is my last media post in this queue, promise!)
Comment #14
gusaus commentedI 'think' this also would be the missing piece for an audio download store. Interested in helping in any non-programming sort of way.
Comment #15
audster commentedsubscribe
Comment #16
torgospizzaSubscribing. I would like to test the patch in #11 - we sell almost exclusively mp3 downloads and video files, with a subscription / premium content model coming soon. I'd love to be able to offer existing media assets as bonus or premium content. Thanks for all the effort on this so far.
Comment #17
cpelham commentedThanks for working on this!
Comment #18
recrit commentedthe work on getting media module to actually use Drupal core's private file system is taking place in the media issue queue #1069582: How to use an alternate stream wrapper when saving media files?.
As for integration into Commerce File, I honestly do not see what the need is for it.
[1] referencing existing files - You can reference existing files using File Field Sources with Commerce File or any core file field for that matter. Currently it only provides referencing files that were added through that field instance, there are some issues in file field sources queue to open up IMCE source to all files, etc... so could be promising to reference any file uploaded via media.
[2] display - The display of the content to the end user could be handle with file field formatter support - I'm currently working on image formatters (#1225760: Allow image display formatters). However, keep in mind if the original image is displayed on a page, then it counts as download. Likewise, mp3's can be played in a player formatter such as jwplayer... I believe it would count as a download even if they only played a few seconds - would have to test to be sure of this.
[3] existing media - If you have am existing media file, all commerce file field needs is the fid. Some have done some feeds works to accomplish this - #1162602: Feeds support for Commerce File. I will be working on adding feeds targets into Commerce File. Keep in mind if any file is added to a Commerce File field, then download of it is restricted any where it is used.
With all of that in mind... if someone can convince me of keeping this open, then we can re-open. Marking as postponed for now.
Comment #19
discipolo commentedHi, I feel I might have a persuasive argument for allowing commerce_file_fields to use the media widget for upload:
having installed
http://drupal.org/project/commerce_downloads
i am still required to upload images individually. now
http://drupal.org/project/commerce_bpc
seems like a wonderful solution for adding multiple products.
in order to make it useful for a digital download store, commerce_file would have to work as "combinations field" and be able to select multiple files.
the most handy way would seem to use the media modules widget for either
- selecting files from the library
- uploading them via plupload
or have i overlooked a way this could be achieved with filefield_sources already?
Comment #20
toby53 commentedI would like to attach files I upload via SCP (secure copy) to the commerce product files.
As discussed before (and many other places) filefield sources / IMCE does not currently support the attachment of "un-managed" files.
What is currently recommended ? We need to go live within a month.
Comment #21
discipolo commented@toby filefield sources does allow you to
or did i misunderstand you?
in general i found FileField Sources Plupload which provides filefieldsources with a massupload option. also i wrote a BPC extension module for using commerce file fields as combination fields in bpc.
so this feature request seems to be resolved. my current approach is documented here:
http://drupal.org/node/1294788
Comment #22
toby53 commentedThanks for all your work on this project - I'll checkout the links.
Yes we use SCP instead of FTP here. The issue is that they are not "managed" files existing on the server so filefield sources / IMCE cannot seem to use them when attempting to attach them to commerce products (you can attach uploaded files just fine).
Our goal is create commerce products and attach a number of commerce files that exist in a deep directory structure like products/suncode/release1.2/documentation/selfstudy_docs.
I would also like to assign a taxonomy to the files based on their directory structure so they can be displayed in different views.
Comment #23
discipolo commentedsounds like you might have to wait for mediamover module then.
Comment #24
bojanz commentedI have published 7.x-2.x (see https://drupal.org/node/1395488#comment-7658191) which allows you to do anything here since it uses a regular filefield.