Zen Cart Logo
Forums / General Questions / Delete Downloadable Product After Download

Delete Downloadable Product After Download

Locked

Views: 1,306

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
15 Sep 2009, 10:19 PM
#1
littlegdesigns2004 avatar

littlegdesigns2004

New Zenner

Join Date:
Oct 2004
Location:
Wisconsin,USA/Bermuda
Posts:
41
Plugin Contributions:
0

Delete Downloadable Product After Download

I am building a website that sells downloadable photos, but I want each photo/product to be downloaded only once and then automatically delete. Has anyone ever tried this or have some ideas on how to implement this?

I realize it is a bit unusual but I don't want to just disable the photo after download because the file sizes are quite large because of the high resolution so I want to free up space and I want the photos to be unique and limited to one of each.

Website: https://www.MyBermudaVacation.com
Zen Cart v.1.3.8

Thanks in advance.

16 Sep 2009, 8:28 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Delete Downloadable Product After Download

I want each photo/product to be downloaded only once and then automatically delete
Downloaded once can be handled by settings
Deleting once sold will be a manual function use your FTP client
What if the customer does not have a successful download on first go??

17 Sep 2009, 4:30 PM
#3
littlegdesigns2004 avatar

littlegdesigns2004

New Zenner

Join Date:
Oct 2004
Location:
Wisconsin,USA/Bermuda
Posts:
41
Plugin Contributions:
0

Re: Delete Downloadable Product After Download

I will think on the deletion portion of my plan, but if a product can only be downloaded once and the download is unsuccessful then the customer would contact me. If the product is deleted after download and the download is unsuccessful then they would contact me as well. I would still have a copy of all the products, so either way an unsuccessful download would require them to contact me. I might as well save some space, right?

What settings do I change so that the product is only available for download once? Just for clarification purposes, I don't mean once per customer...I mean a quantity of just one for the entire store.

Thanks for your quick reply.

17 Sep 2009, 9:02 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Delete Downloadable Product After Download

What settings do I change so that the product is only available for download once? Just for clarification purposes, I don't mean once per customer...I mean a quantity of just one for the entire store.
You do not address the # of downloads
Do this through stock settings and make the product with only 1 available for purchase...

On the auto removal

I would still have a copy of all the products, so either way an unsuccessful download would require them to contact me. I might as well save some space, right?
As you will have to FTP any new items to your account - You can also delete sold items at the same time.
No need for auto removal

18 Sep 2009, 3:34 PM
#5
littlegdesigns2004 avatar

littlegdesigns2004

New Zenner

Join Date:
Oct 2004
Location:
Wisconsin,USA/Bermuda
Posts:
41
Plugin Contributions:
0

Re: Delete Downloadable Product After Download

As far as I knew, downloads didn't use stock. How do I set the downloadable product to use the stock? And to make the product "disappear" from the catalog once the quantity goes to 0?

Manually deleting items means I have to go through all the orders for the past however long since I last updated and make sure I am only deleting the sold items. If I only update every 6 months then that could get to be quite a chore. The auto deletion is looking like a pretty good idea because it will save not only time but a ton of headaches. I just need some help on implementing it.

18 Sep 2009, 4:22 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Delete Downloadable Product After Download

Something to note: If you delete the file immediately when the customer starts their download, then it's quite likely they'll only get the first 20 bytes of the file before the server says "oops, sorry, there's nothing here to serve anymore, so ... sorry, goodbye".

Downloads do not adjust stock levels in v1.3.8a.

18 Sep 2009, 8:17 PM
#7
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,841
Plugin Contributions:
0

Re: Delete Downloadable Product After Download

littlegdesigns2004:

As far as I knew, downloads didn't use stock.

Correct, downloads do NOT decrement stock....

19 Sep 2009, 10:23 PM
#8
littlegdesigns2004 avatar

littlegdesigns2004

New Zenner

Join Date:
Oct 2004
Location:
Wisconsin,USA/Bermuda
Posts:
41
Plugin Contributions:
0

Re: Delete Downloadable Product After Download

Good point on the download, but if it was set to delete the file 24 hours later that would circumvent that problem.

If downloads do not use stock then does anyone have any ideas on how I can make each download a "one time then it disappears" kind of thing?

Thanks for all the help. Sometimes a different viewpoint on something makes the goal so much clearer. :)

20 Sep 2009, 4:04 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Delete Downloadable Product After Download

Assuming you don't care about server security, you could set your download folder up with permissions (ie: 777) that allow deletion (which also allows modification).
Then you could write a script that queries the database for orders that have been placed, for which downloadable files have been purchased, and where the download count has expired, and then loop through the filenames for those files, and have it delete them. You could have that script run automatically every time someone clicks a link on your store (not recommended, as it will take some time to process), or run manually when you click a (new) link (you would add) in your admin area, or you could experiment with writing the script to be able to run from the command line as a cron job. It all depends on your skill and/or resources.

If your server is one that requires the use of "777" permissions to make folders such as your images folder "writable", then leaving your download folder also writable does put you at a bit of a security vulnerability risk. Just something to keep in mind if you continue to explore the road you're toying with.