Page 1 of 2

A Download extension that could use links... (SOLVED)

Posted: Tue Apr 14, 2015 8:15 pm
by STARS
I'm still in a shock... I can't believe there's NO download extension out there that could simply use "links" instead of grabbing files directly from the server.

I would really like to set the download "links" from my cloud server rather than putting all those files to my web host.

Isn't really there an extension that could do such a thing or simply a way to modify the default download scripts?!!

You would really save me if you could shed some light!

Re: A Download extension that could use links...

Posted: Wed Apr 15, 2015 9:47 am
by IP_CAM
I assume, OC Users usually sell either real goods, or then downloadable goods. So, seemengly, as you wrote, nobody so far ever seemed to confronted with such a Task, just selling links.

I would encourage you to let the fellows here see your Site. It could make it easier, to decide, for some, if it's worth the task. You know, all those 'feelings' ... ???

just a feeling, too ;)
Good Luck
Ernie

Re: A Download extension that could use links...

Posted: Wed Apr 15, 2015 3:01 pm
by STARS
Well Ernie, you're dead right and that's why I said from the cloud server. I already have my products backed up on one of the cloud servers and no one would ever catch them until I share the links. I mean it's already secure and also there's no need to have that 32bit hash characters to prevent users from guessing your products.

I'm running my website offline for the time being but I'm gonna have it on a server with a limited space and bandwidth not to mention my mp3 digital products would take lots of space. that's why I can't have my website online before setting the links. I'm stuck!
You know I was kinda like, why not use the notepad ? I could simply put the links in the notepad and the problem's solved. but, it's so amateur and time-consuming. besides, customers wouldn't like that.

My friend was totally shocked when he heard that opencart has no link support. He told me, just come to think of it I have written a program and I wanna sell it. then I make some tutorials and put it on youtube to let my users learn how to use it. why on earth would I have my tutorials attached with my product while I could simply put the links there ?

You know that's one reason. It has also other utilities:

1. SEO friendly: definitely getting links from somewhere else can be more seo friendly.

2. Backup friendly: If you lose your backup and there's no backup on the server as well, then it would be a piece of cake to get everything back online.

2. Hack Protection: just think for a moment your website is hacked. it would definitely take a longer time for the hacker to steal your products one by one than having them all inside a folder on your server. consequently, you would have enough time to restrict the access.

3. Switching to other hosts: It would be very much easier to switch to other hosts on your own.

4. No pressure: no extra pressure on your website.

Re: A Download extension that could use links...

Posted: Wed Apr 15, 2015 3:34 pm
by artcore
Just thinking out loud, it could be as simple as removing the upload field and controller mask/validation from the download section and copy the link in the file field?
That way clients would get your cloud link and not the ?download=file+mask in their email and account download section.

Re: A Download extension that could use links...

Posted: Wed Apr 15, 2015 5:59 pm
by STARS
Yeah.. but the question is how ?

Re: A Download extension that could use links...

Posted: Wed Apr 15, 2015 10:04 pm
by artcore
downloads-as-extlinks.zip
Indeed it needed some changes to multiple files.
I attached a working solution tested on localhost, default template, version 1.5.6.4.
Backup or rename your original files first!

Use full link including http:// in the downloads catalog. I resized the link field so one can see the entire url. ;D

Re: A Download extension that could use links...

Posted: Thu Apr 16, 2015 12:55 am
by STARS
artcore that was absolutely artistic!

But here's an issue. it just downloads the last part of the link ignoring whatever the content is and is absolutely fine for direct download links...
However, say the link in question ain't a download link. say it's a youtube link. Now if I put the link there it would download the last part as a file!

For example : www.youtube.com/watch?v=aEuyC5S_oI

Download file: watch?v=aEuyC5S_oI

is it possible to open the link in a new tab to let the browser search for it ?

Re: A Download extension that could use links...

Posted: Thu Apr 16, 2015 1:17 am
by STARS
oops! I got an error when I was deleting the customer's order list:

Fatal error: Call to a member function deleteOrder() on a non-object in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\store\vqmod\vqcache\vq2-admin_controller_sale_order.php on line 137

line 137: $this->openbay->deleteOrder($order_id);

Re: A Download extension that could use links...

Posted: Thu Apr 16, 2015 1:57 am
by artcore
Thanks!
You can download the youtube to your PC and then to your cloud. I use keepvid(google it) for this. I'll look into a programmatic option.
As for the admin/controller/sale it seems you don't have the library/openbay.php file which was introduced in version 1.5.6

Simply comment it out on that line 137 so it looks like this:

Code: Select all

//$this->openbay->deleteOrder($order_id);

Re: A Download extension that could use links...

Posted: Thu Apr 16, 2015 10:11 pm
by STARS
The error is gone. thanks artcore.

I'm not just talking about the youtube link or sth. Let's say it's a NetFrameWork or for whatever reason it's sth you don't necessarily have to upload anywhere. say, I dunno, it's a link to a help file from other websites or some information on your webpage for your product in question... it can be anything but a direct link if you know what I mean.

All in all, I'm not insisting on it.. you already did a great job and I can't thank you enough.

However if you managed to do such a thing put it for sale. xml would be a great idea btw. At least you have ONE customer ;) It's absolutely worth it.

Thanks again

Re: A Download extension that could use links...

Posted: Thu Apr 16, 2015 11:34 pm
by artcore
I hear you and you're welcome!
It sounds easier than it is in practice. Parsing a YouTube is possible but has a lot of options to test for. I don't want to think about all the other download link possibilities to cater for :)
And I don't enjoy creating vqmods also, so probably not gonna happen. Maybe for OC2 using the Event system...

Cheers

Re: A Download extension that could use links...

Posted: Fri Apr 17, 2015 12:22 am
by STARS
hands up and I surrender ;) I never asked for a free vqmod.. .I just simply said if, and only if, for whatever reason you decided to wrap it up for sale, then xml would be a good idea. apologies if it sounded otherwise.

Anyway, thanks again for your help and above all, thanks for sharing it for free...

I made 3 backups just in case... If I lose it then I would never find it anywhere else. :)

Re: A Download extension that could use links...

Posted: Fri Apr 17, 2015 1:00 am
by artcore
No apologies needed! You're right an xml would've been a better choice. I simply don't have the experience writing them and prefer PHP :) Sorry for that, I understand replacing files can be a nightmare!

I'll try to create an vqmod/xml for these changes, give me a couple of days as I have some work piled up.

Re: A Download extension that could use links...

Posted: Sat Apr 18, 2015 2:11 am
by artcore
VQmod version ready. It's my first ever so critique welcomed.
Limitations:
128 character limit for the url field as implemented by the database. So be advised.
External link needs to be pointing directly to a public file.
No support for YouTube, RTMP streams and others alike.

Re: A Download extension that could use links...

Posted: Sat Apr 18, 2015 5:07 am
by STARS
WOW Bingo! ... seriously, I never expected this one. So one step closer to the Higgs Boson ... :)

However, this vqmod had a minor issue on the line below and I could simple fix it by replacing the "\" with "/"...

<file path="admin\view\template\catalog\" name="download_form.tpl">

But then I was like, now that I don't have my website online to take a real-time test why not just give it a try on free hosts and unfortunately the result was exactly the way I experienced on my offline server! :-[ It seems like it DOES grab the last part of any download link ignoring other parts (no matter if it's direct or indirect) as though it's a file located on the server. (I always thought it was all due to the offline mode)

When I hover my mouse over the download icon I get this:

http://127.0.0.1/store/index.php?route= ... load_id=34

Well I guess that simply explains why it can't use the links as direct or indirect cause it just adds that specified ID.

Re: A Download extension that could use links...

Posted: Sat Apr 18, 2015 2:10 pm
by artcore
The link without download_id is no problem, but this does prevent your customers from giving out the links to others without the need to login as the paying customer.

Oh yes, the dir separators are from Windows, sorry. I'll Linuxify them

Re: A Download extension that could use links...

Posted: Sat Apr 18, 2015 5:06 pm
by STARS
I said it because I wasn't sure whether or not the id was the culprit. and besides If the customer ever wanted to do such a thing, then they would simply put their purchased product on other cloud servers and share it with anyone. Normally when a customer pays for something, the security firewall of their mind convince them not to share what you payed for, unless we're talking about some maniacs who have no other purposes than sabotage!

I mean there's no a 100% security in this universe. there are always other alternatives to bypass any rule. so be it.

Re: A Download extension that could use links...

Posted: Sat Apr 18, 2015 10:05 pm
by artcore
Here you go. A version without a download_id

Re: A Download extension that could use links...

Posted: Sun Apr 19, 2015 3:52 am
by STARS
artcore ? That is exactly the God Particle. :D Excellent!

I would like to extend my sincerest thanks and appreciation to you who helped this mission impossible come true ;)

Now I can have my direct and indirect links without any problem.

note: download links must have http:// included or the search bar would appear something like this showing up a not found page:

127.0.0.1(yourdomain)/whatever-website-link.com

Great Job!

Re: A Download extension that could use links... (SOLVED)

Posted: Sun Apr 19, 2015 4:28 am
by artcore
Yes always include http://
If you wanna gain these 8 characters change $result['filename'] to 'http://' . $result['filename]
That way you can/have to omit it from the download link.

You're welcome. It got me into vqmodding, so thank you too :)