I'm using an example payment and manually updating the order to be complete afterwards, but no file licenses are ever issued.

I'm using rc1 of drupal commerce.

Comments

recrit’s picture

Status: Active » Postponed (maintainer needs more info)

I've tested with RC1 and everything works.
Please give more details on your setup - settings of commerce file field on product, any commerce files on your line items (check table field_data_commerce_file_line_item_files for any instances), accessing as user 1, etc

artatac’s picture

Status: Postponed (maintainer needs more info) » Active

I am finding the same. I created a new product type via admin/commerce/products/types/add called downloadprod > added a new field
filedownload field_filedownload Commerce File Commerce File
in ACCESS LIMITS
License duration - unlimited
and the other 2 fields left blank for unlimited > save
I then went to admin/commerce/products/add/downloadprod and created a product and attached a pdf via the new field.
I then created a product display and then bought it. I received an email confirming the purchase but not a second email with a link in it. I did note that the order status was 'pending' so I forced it the completed - but no extra email.
you can test it via http://venturacottage.homedns.org/commerce2607/node/4 and I can suply login details if it is of help.
DRupal is 7.4 and Commerce is 7.x-1.x-dev (which I can upgrade if you feel is the issue)
Thanks

recrit’s picture

There is no default email that gets sent out unless you set it up in a Rule. Example payment method is just that - an example, so it will put the order as pending unless you update the Rule for example payment to push the order to complete while testing.

Once an order is completed, check the files tab in your user account to see if you have the file there.

artatac’s picture

Ok thanks
I shall have to sit down and learn more about rules or find some examples

Best wishes for a great module

mikerz’s picture

Okay,

I didn't see any instances of field_data_commerce_file_line_item_files in my sql, but I did see the structure for "commerce_file_license_line_items_line_item"

This is what I did, I created a new Product Type "Special Item" and gave it a field of "Commerce File"

I created a new instance of "Special Item" called "hat1," and I uploaded a file for the commerce file field.

I logged on as user 2 (just a standard authenticated user), and purchased the newly created "hat1" (I made a display type for it with the standard "add to cart" button showing up)

I purchased the item with example payment

Next, I logged on as administrator and changed the order to "completed" (and verified that the item was listed)

No commercial file licenses were made, and no files were listed for the user.

artatac’s picture

I have also retested this and at /user/1/licensed-files there are no licenced files after buying a download product

recrit’s picture

i believe i tracked this down and just pushed some commits. You will have to pull from the git repo b/c the dev tar only builds once a day or something.
I tested this with a new product type and had the files issued after marking the order completed.

@mikerz:
Please verify that you have the commerce file field on the line item type - view admin/commerce/config/line-items/product/fields

recrit’s picture

Status: Active » Needs review
artatac’s picture

yes see below
Commerce File commerce_file_line_item_files Commerce File Commerce File edit delete

recrit’s picture

@artatac - great.. so the field is at least added correctly. Can you test the latest in the repo to see it if works for you?

artatac’s picture

downloaded http://drupalcode.org/project/commerce_file.git/snapshot/3ac6d221a853cf1... and replaced current module > ran update.php > go following error

Notice: Undefined index: #description in _commerce_file_field_license_elements() (line 537 of D:\xampp\htdocs\commercedownload\sites\all\modules\commerce_file\includes\commerce_file.fields.inc).
Notice: Undefined index: #description in _commerce_file_field_license_elements() (line 537 of D:\xampp\htdocs\commercedownload\sites\all\modules\commerce_file\includes\commerce_file.fields.inc).

created new downloadable prod and display

Still no files available

Regards

Joe (can give you admin access if it helps)

recrit’s picture

artatac’s picture

OK pleased to report that once I go into admin/commerce/orders/3/edit and alter the order to completed then the new file appears at /user/1/licensed-files

Thank you :-)

What I now need to work on is that even though I am using the demo payment module - I would have expected it to treat that as paid and updated the status automatically to completed. Thus making the file available in licensed files and also I presume I could then (try) to generate an email with a link in it rather like Ubercart used to do.

recrit’s picture

Great! Before marking as fixed, I'll wait for mikerz to report back.

For example payment during development,
The default checkout rule is "Update the order status on checkout completion". You can alter or clone it to a new rule with a higher weight so it fires after that one. Altering it to move it to completed status instead of pending.

There are a few events you could add a rule to...
If you know you would be selling only digital content:
You could trigger the rule on "After updating an existing order". Add conditions to check the previous status was not completed and that the new status is completed. Add an action to send the email pointing them to log in and visit user/{their uid}/licensed-files.

If you have mixed products, you can trigger the event on "After saving a new commerce file license" since one would be created on order completed if its their first time buying the file.

recrit’s picture

Status: Needs review » Fixed

@mikerz: try the latest dev and reopen if you still have an issue

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jessicakoh’s picture

Status: Closed (fixed) » Active
StatusFileSize
new132.87 KB

How to re-create the missing "commerce_file_line_item_files"

I already ran the "Features - Commerce Download". The license is still not being issued after payment completion.

Commerce File snapshot: http://drupalcode.org/project/commerce_file.git/commit/ba438da

inolen’s picture

Just installed, having the same problem as above. The rules is triggered, however a check in commerce_file_license_issue_line_item() fails around line 816 (// exit is no files).

lloydhazlett’s picture

Same issue here also - rule is triggered and commerce_file_license_issue_line_item() is called, but it never enters the line item field items processing loop at commerce_file.entities.inc:860 where the licenses should be created. Tested on latest commerce_file dev with ctools 7.x-1.0-rc1, entity 7.x-1.x-dev and rules 7.x-2.0-rc1 and as user 1.

inolen’s picture

Did anyone happen to figure out a fix for this? Was hoping when I circled back around to this tomorrow there may be a fix (since it seems like something was already checked in to fix it), but if not I guess I'll dive in tomorrow.

AimAdvantage’s picture

Component: Miscellaneous » Access Control

Having a similar issue-

Everything is working through checkout.

However- When I return to my profile to see my orders, the file name is under orders but there is no link to the file to download the mp3.

Very simply- trying to give access to mp3 music files after paypal payment.

The order shows up in the user's profile, however, the file link or access is not there like it was in Ubercart. Any help on this?

Here is the dev link for the store for MP3 downloads-

http://www.rondavidmooreministries.com/RDMstore

any help on this would be great
Thanks-
Aaron

13rac1’s picture

I added watchdogs throughout the code to locate the (incorrect) commerce_file_license_issue_line_item() function exit point. On my site, it is exiting early at this return:

  $line_item_field_name = _commerce_file_get_field_names('line_item_files');
  $license_entity_type = COMMERCE_FILE_LICENSE_ENTITY_NAME;
  $license_info = _commerce_file_collate_license_info();

  // wrap the line
  $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
  $line_item_wrapper = _commerce_file_clean_line_item_wrapper($line_item_wrapper);

  // exist if no files
  if (empty($line_item_wrapper->{$line_item_field_name})) {
    return;
  }
recrit’s picture

@eosrei:
can you check your database table field_data_commerce_file_line_item_files and see if there are any entries. That is the field that is on the line item entity which snapshots the files from the product during checkout.

recrit’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev

marking as dev since lloydhazlett reported using dev.
All - please make sure you are using a clean install of the dev version - beta1 is not supported nor is any beta1 to dev upgrade

recrit’s picture

tagging

inolen’s picture

Finally got back to this tonight.

I was working with a fresh install of 7.x-1.x-dev and I noticed that I didn't have the field_data_commerce_file_line_item_files table.

So, I wanted to try to reinstall the module but I couldn't with Devel due to a rules include, couldn't reinstall through modules interface due to a locked field dependency (that seemed a bit odd), so I wrote a small script to reinstall and then the table showed up and all was well:

require_once DRUPAL_ROOT . '/sites/all/modules/commerce_file/commerce_file.rules.inc';
$modules = array('commerce_file');
module_disable($modules, FALSE);
drupal_uninstall_modules($modules);
module_enable($modules, FALSE);

I definitely originally installed with 7.x-1.x-dev, so I'm not really what happened to make that table not get created originally.

jessicakoh’s picture

@inolen

Thank you so much for the tips. I got mine running.

scottrouse’s picture

This isn't working at all for me. I've got the module installed on a site in progress, and licenses are not being issued for purchased files. I've tested on a local install and verified that no license is being issued. Here are the steps to reproduce:

  1. Clean install of Drupal 7.8 on my local (MAMP) installation
  2. Install the following modules:
    • Commerce 7.x-1.0
    • Commerce File 7.x-1.x-dev
    • Address Field 7.x-1.0-beta2
    • ctools 7.x-1.0-rc1
    • Entity API 7.x-1.0-beta10
    • Rules 7.x-2.0
    • Views 7.x-3.0-rc1
  3. Enable: ctools, cart, checkout, commerce, commerce ui, customer, customer ui, line item, line item ui, order, order ui, payment, payment method example, payment ui, price, product, product pricing, product pricing ui, product reference, product ui, commerce file, address field, entity api, entity tokens, rules, rules ui, views, views ui (https://skitch.com/scottrouse/gbcsy/http-commerce.local-admin-modules)
  4. Define private file system path (https://skitch.com/scottrouse/gbci3/fullscreen)
  5. Add a commerce file field to the sample Product (https://skitch.com/scottrouse/gbcib/fullscreen and https://skitch.com/scottrouse/gbci1/http-commerce.local-admin-commerce-p...)
  6. Add a sample product with a file (https://skitch.com/scottrouse/gbcsk/http-commerce.local-admin-commerce-p...)
  7. add a product reference field to the sample Article content type (https://skitch.com/scottrouse/gbcsq/fullscreen)
  8. Add an "Article" that references my sample product/file (https://skitch.com/scottrouse/gbcsh/http-commerce.local-node-1-edit-dest...)
  9. Purchase my product with an anonymous user (https://skitch.com/scottrouse/gbcar/fullscreen)
  10. Set the order status to completed (https://skitch.com/scottrouse/gbcaq/http-commerce.local-admin-commerce-o...)
  11. No licenses are issued (https://skitch.com/scottrouse/gbcah/http-commerce.local-admin-commerce-f...)

The Rules admin screen shows a number of errors (https://skitch.com/scottrouse/gbc2n/fullscreen) including Error: Unknown condition commerce_file_license_condition_limit_is_unlimited for Control access to licensed file downloads. I also have the following message in my error log:

The reaction rule Control access to licensed file downloads (commerce_file_license_download_access) fails the integrity check and cannot be executed. Error: Unknown condition commerce_file_license_condition_limit_is_unlimited.

The field_data_commerce_file_license_file table is empty.

jessicakoh’s picture

@scottrouse

Have you tried running #26's code in Devel's Run PHP Code?

tvilms’s picture

Hi, I've been following this thread. I can verify that I just followed @jessicakoh's pointer to #26 and ran @inolen's script. The missing DB table was created during the module uninstall+reinstall process. File download buyers are now able to access the licenses after completing the purchase. Thanks @jessicakoh for specifying to run the script in Devel's Run PHP Code block - your tip in #29 together with #26 cleared it up for me.

scottrouse’s picture

I ran the script on my local dev site that I created using the steps in #28. Nothing changed. Same database tables, same results (no licenses issued), same Watchdog and Rules errors. As I mentioned in #28, the field_data_commerce_file_license_file existed after following my install steps, but no licenses are ever entered into that table when products are purchased (and orders are marked as completed).

It seems to me that the Rules/Watchdog errors I mentioned may help to resolve this, but I'm not sure where to go from here with them.

recrit’s picture

Issue tags: +7.x-1.0-beta3

re-tagging to 7.x-1.0-beta3

jessicakoh’s picture

jessicakoh’s picture

@scottrouse

I am not asking you erase your existing website and start from scratch. Try a fresh installation. Then compare rules and the table. You might have missed out something.

Alternatively, you can try the ready made commerce file package (commerce download?).

scottrouse’s picture

I understand. In #28, I was referring to a fresh local installation. I completed and documented my steps very carefully (complete with screen shots) in order to prove that the module does not function properly.

I can give the commerce file package a try, but, even it works, that doesn't solve my outstanding issue on the existing site.

Is there something else you suggest I try for the almost-completed site to try to get licenses to be issued? Or is there some more information I can provide about that installation that may help resolve the problem?

Much thanks,
Scott

jessicakoh’s picture

I would still suggest trying out the commerce file package.

If that works, you'll have a model to compare to. Look into "Product Type".

scottrouse’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta2
Priority: Major » Normal

I did manage to resolve my issue with the script at #26. Thank you.

I've leave this issue open, I guess, since it still didn't work "out of the box."

Also, changing this to beta2 since it's much more recent than the dev version.

recrit’s picture

Status: Active » Fixed

for reference, i have created an initial pass at documentation at http://drupal.org/node/1356212
I am closing this issue since there have been some changes to the install and uninstall of this module. Please test the dev on a fresh install and open any new issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mediapal’s picture

Hi,

I stuck here with the example payment.

Everything works so far: anonymous user put some files in the cart. Going thru the checkout procedure and pay with "example payment"

When the user login the order status shows "complete" but no files to download. The admin has to take the order to the status "pending" and again to
"complete" and after this the user gets the files ready to download.

Here comes the funny part: Is the user login already and doe´s another order again, then, and only then the files are ready to download, as those suppose to.

I tried on a local and a live server: no different. I tried, like mention in an earlier post to set in the rules the default action from "pending" to "complete",
nothing would change.

Has anybody an idea whats wrong here?

Kirk

recrit’s picture

in case anyone stumbles to here .. #40 above was addressed at #1405740: File License Problem After Paying