Thanks for an excellent module! I have installed Commerce File and Commerce License (7.x-1.0-beta2) and configured some products as type Downloadable.

Everything seems to be working fine - except when a user clicks on their purchased file, they get a 'page not found' error. This applies for the user as well as for admin in the Licence view in the back end.

I'd be grateful for any ideas!

Here's the details of our setup:

I've set permissions to 'view own license' for authenticated users and even tried 'Bypass license control' for Commerce File for authenticated users.

I see the list of purchased downloadable files in the My Files tab, as well as on the Checkout complete form.

However, when I click on the file I get a 'page not found' error.

The URLs of the files in the list of purchased downloadable files look like this:
mysite.com/file/1666/download?token=ZVMg7t_EY-YSc_ccL5AR0UP9saGb2ZTGhXm6YHg4Fv0

I notice something funny going on with where files are actually uploaded to.

Initially I set the sites' Private file system path to ../private. When I upload a file in my Downloadable product, it does indeed go there. However, if I edit the product and hover over the file's name in the Files field, the URL shown by my browser is of the form mysite.com/system/files/my-file-name.zip. So that's a different path. Hmmm!

However, if I change the Private file system path to system/files the files do indeed upload to there... and when editing the product, the file link address displayed is to the same system/files folder.

But I still get a file not found error in both cases.

(It may perhaps be significant that I am using a sub-folder set in the Files field edit screen, so that the actual path is system/files/downloads. But that shouldn't matter?!!)

I'd be glad of any ideas for how to resolve this! Thanks in advance.

Comments

bojanz’s picture

Did you check #2183975: Commerce File links to a non-existent file/%file/download when used with File Entity?
If you have File Entity 1.x installed then it is conflicting with this module and causing the 404.

bojanz’s picture

Status: Active » Postponed (maintainer needs more info)
jigish.addweb’s picture

This problem is generated because of file entity module not compatible with your commerce file module.

You need to alter your menu with your custom module

function YOURCUSTOMMODULENAME_menu_alter(&$items){
        if (empty($items['file/%file/download'])) { //replace with this line
                $items['file/%file/download'] = array(
                  'page callback' => 'commerce_file_download_page',
                  'page arguments' => array(1),
                  'access callback' => 'commerce_file_access',
                  'access arguments' => array('download', 1),
                  'type' => MENU_CALLBACK,
                );
        }
}

Hope this helps!

toptomato’s picture

I’m having this exact same problem right now and am suppose to launch in 3 days(!).

fyi - my file entity module is turned off.

i don’t understand the last comment here,
@jigish.chauhan

You need to alter your menu with your custom module

can you elaborate or explain more clearly. which menu? which module?

any further help would be greatly appreciated!

jigish.addweb’s picture

Create your custom module and put following function i.e. Your custom module name is "custom" then put following function.

function custom_menu_alter(&$items){
        if (empty($items['file/%file/download'])) { //replace with this line
                $items['file/%file/download'] = array(
                  'page callback' => 'commerce_file_download_page',
                  'page arguments' => array(1),
                  'access callback' => 'commerce_file_access',
                  'access arguments' => array('download', 1),
                  'type' => MENU_CALLBACK,
                );
        }
}

Hope this helps you.

Thanks!

torgosPizza’s picture

jsidigital’s picture

Yes! #5 fixed this problem without having to disable file_entity or commerce_file.

Thank you @jigish.chauhan!

DamienMcKenna’s picture

Version: 7.x-2.0-beta1 » 7.x-2.x-dev