Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2017-02-18 04:42:41

chris
Member
Registered: 2013-01-25
Posts: 27

Digital downloads that are NOT photos

I am attempting to setup CART to provide digital downloads of a PDF that I have created, and am at a complete loss as to the setup. Again, this is not a photo. I would like to know where to store the file on the server and what I need to setup in cart to get this to work. Everything that I have done so far has been for naught.

Thanks for any help.

Offline

#2 2017-02-18 05:04:25

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Digital downloads that are NOT photos

I don't believe you'll be able to set this up for an instant download, like you can for a picture in a gallery.

But you could create a product page and use a write-in button to sell the pdf. Once you've received payment confirmation you'd need to fulfill the order manually, or perhaps set up a password protected page that contains the link to the file.

You can then store the file anywhere on the server.

Maybe others will have better ideas...


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#3 2017-02-18 07:14:31

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Digital downloads that are NOT photos

You can provide non-images as digital purchases, but they must mirror the name of a photo within a gallery.  For example, a gallery could have an images named the-document.jpg, with pricing set up to allow digital purchases.  You'd then need to upload a file title the-document.pdf into the photos-for-purchase subdirectory of the gallery, and make sure to remove any corresponding the-document.jpg in photos-for-purchase.

Offline

#4 2017-02-18 07:31:20

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Digital downloads that are NOT photos

oooh. That's intriguing. Could this be done in a Theater single image page using write-in buttons?


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#5 2017-02-18 08:19:27

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Digital downloads that are NOT photos

To be honest, I have no idea.  The digital downloads mechanism for galleries is designed to pick up the first file that matches the filename without extension.

Offline

#6 2017-02-18 08:21:29

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Digital downloads that are NOT photos

Hi Ben,

I can report that this sort of works with a write-in button.
I created an album using a theater template set to single image
the name of the image file is the same name as the pdf file. The pdf file is placed in a photos-for-purchase folder I created in the album.

I can complete the purchase and get the download link. The only issue is that the link goes to name-of-file.jpg.
The file downloads as name-of-file.jpg however it cannot be opened as such. If I change the extension on the file to .pdf, I can open the pdf.

I know this is probably way beyond the intention of the write in buttons, but it sure would be handy if the pdf could be downloaded with the proper extension.
Is there another attribute that can be added to the write-in button that would specify the extension of the data-item file?
(I tried adding the extension to the data-item)


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#7 2017-02-20 07:55:47

chris
Member
Registered: 2013-01-25
Posts: 27

Re: Digital downloads that are NOT photos

This is all very interesting information, and while somewhat helpful, I too would like to find out if there is an attribute that can be used to specify the extension.

Offline

#8 2017-02-20 08:21:58

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Digital downloads that are NOT photos

There is not an attribute for this.  I'll look into this to see whether the wrong extension is a bug.

Offline

#9 2017-02-20 19:46:03

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Digital downloads that are NOT photos

I've had a play around with the code.  Support for digital purchases of files other than JPEG renditions from Lightroom is a little weak for write-in buttons.

Firstly, there is a bug in resolving the found file name, as you had found.  This was the result of an earlier bug fix.  I'll have a fix for this in a future cart update, possibly a silent update if this is the only fix being added.  In the mean time, this can be resolved by editing the file module-cart/application/helpers/ApplicationHelper.php and changing the lines from line 692 from this:

//$file_name = basename($from);  // This is empty when the digital purchase is not found
$file_name = basename($item->photo_path);

To this:

$file_name = basename($from);  // This is empty when the digital purchase is not found
if (!$file_name) {
	$file_name = basename($item->photo_path);
}

Secondly, the downloaded filename must match the name of the data-thumbnail attribute.  For example, a thumbnail of the-document.jpg would correspond to the-document.pdf

Thirdly, the data-item doesn't affect the name of the file that is looked for or downloaded.  It probably should, and take precedence over (and make unnecessary) the data-thumbnail attribute.

Fourthly, should you use the option to enable offline digital purchases for non-jpg files, the naming problem will persist.

Offline

#10 2017-02-21 00:34:54

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Digital downloads that are NOT photos

Brilliant! works perfectly. The only problem is that now I need to write an ebook wink


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#11 2017-02-21 05:41:23

chris
Member
Registered: 2013-01-25
Posts: 27

Re: Digital downloads that are NOT photos

Wonderful information, Ben, and Rod, a big thanks for the testing. I can't wait to implement this.

Offline

Board footer

Powered by FluxBB