Page 1 of 1

Digital products: Downloads broken, plugin without output

Posted: 14 Nov 2017, 09:12
by Sebastian
Hello,

I tried to configure digital downloads and came across some problems and questions.

First – what works perfectly:
  • I get an email with a download link after I update the payment status.
  • In the account order history, the download link is then shown, too.
Which errors occur:
  • I can download my files (PDF and ZIP), but cannot open them. Both files are broken. They have the same file size as the original files, though.
  • The plugin 'Aimeos Shop - Account download' does not render any output.
Upcoming questions:
  • Where are the uploaded files stored?
My work steps:
Initially I added a new attribute with Domain 'Media', Status 'enabled' and Type 'Download', which I then assigned to each of my products inside tab 'Characteristics'.
In the tab 'Downloads' of my products, I uploaded the file and set the Status to 'enabled'. The name is taken from the file name, the Path is set to e.g. '4/9/4952577a0c20ac41f374b91e8f3e3e48.pdf'.

When searching for 'anhang-a.pdf' in the database, that string is found in three tables:
  • mshop_attribute
  • mshop_index_text
  • mshop_order_base_product_attr
But I don't see a file path in any of these tables.

Environment:
TYPO3: 8.7.8 (non-composer mode)
aimeos: 17.10.0
aimeos_dist: 17.10.0
PHP: 7.0.22
Server: Apache/2.4.27 (Unix)

Did I configure something wrong or missed a setting?
Could you explain where download media files are stored? In 'uploads/tx_aimeos/' only the product images are found.

Re: Digital products: Downloads broken, plugin without outpu

Posted: 14 Nov 2017, 21:08
by aimeos
Sebastian wrote:
  • I can download my files (PDF and ZIP), but cannot open them. Both files are broken. They have the same file size as the original files, though.
  • The plugin 'Aimeos Shop - Account download' does not render any output.
Can you generate a MD5 or SHA1 hash over the original file and the downloaded one? Are the hashes different?
Yes, The 'Aimeos Shop - Account download' plugin has no visual output. Only the file is handed over to the browser.
Sebastian wrote:
  • Where are the uploaded files stored?
The files are stored in ./uploads/tx_aimeos/files/ subdirectories.
Sebastian wrote: Initially I added a new attribute with Domain 'Media', Status 'enabled' and Type 'Download', which I then assigned to each of my products inside tab 'Characteristics'.
In the tab 'Downloads' of my products, I uploaded the file and set the Status to 'enabled'. The name is taken from the file name, the Path is set to e.g. '4/9/4952577a0c20ac41f374b91e8f3e3e48.pdf'.
Do you want the file to be available to all users at the catalog detail page or only for customers paying for it?

Re: Digital products: Downloads broken, plugin without outpu

Posted: 15 Nov 2017, 08:19
by Sebastian
aimeos wrote: Yes, The 'Aimeos Shop - Account download' plugin has no visual output. Only the file is handed over to the browser.

Do you want the file to be available to all users at the catalog detail page or only for customers paying for it?
Ah, I mistook the plugin for a list view of downloadable files. The file should only be available to paying customers. As I can achieve that with the account order history, that's fine.
aimeos wrote: Can you generate a MD5 or SHA1 hash over the original file and the downloaded one? Are the hashes different?
I generated MD5, SHA1 and SHA-256 hashes using onlinemd5.com. The hashes from the original file and the downloaded version are different, the byte size is exactly the same.
aimeos wrote: The files are stored in ./uploads/tx_aimeos/files/ subdirectories.
Found the files. They are stored inside a hidden subfolder '/uploads/tx_aimeos/.secure/'. I'm able to open these files with generated names like '4952577a0c20ac41f374b91e8f3e3e48.pdf', too. Upload works correct then.

So there seems to be a problem when these stored files are downloaded and the original file name is returned.

Re: Digital products: Downloads broken, plugin without outpu

Posted: 15 Nov 2017, 22:06
by aimeos
Is there maybe some additional output on the download page generated by TYPO3?

Re: Digital products: Downloads broken, plugin without outpu

Posted: 17 Nov 2017, 08:23
by Sebastian
aimeos wrote:Is there maybe some additional output on the download page generated by TYPO3?
The download page only contains the content element 'Login' and the plugin 'Aimeos Shop - Account download'.

I'm using the Aimeos Shop distribution in a fresh installation of TYPO3. The only changes I made were product additions and the installation of RealURL (which I deactivated later, this should not be not the cause).

Re: Digital products: Downloads broken, plugin without outpu

Posted: 18 Nov 2017, 13:26
by aimeos
Like we've guessed, TYPO3 adds some code from the page around the downloaded file. We got it to work by removing the Login plugin and added an extension setup template to the page in the backend with this content:

Code: Select all

config.additionalHeaders.1000.header = Cache-control: no-store

page = PAGE
page {
    typeNum = 0
    headerData >
    config {
        disableAllHeaderCode = 1
        disableCharsetHeader = 1
        disablePrefixComment = 1
    }
    10 = CONTENT
    10 {
        table = tt_content
        select.orderBy = sorting
        select.languageField = sys_language_uid
    }
}

tt_content.stdWrap >
tt_content.list = COA
tt_content.list.20 = CASE
tt_content.list.20.key.field = list_type
tt_content.list.templateName >
tt_content.list.templateRootPaths >
tt_content.list.partialRootPaths >
tt_content.list.layoutRootPaths >

Re: Digital products: Downloads broken, plugin without outpu

Posted: 22 Nov 2017, 08:06
by Sebastian
Thank you! Now all downloaded files can be opened.