Post by xem » Tue Sep 20, 2011 6:13 pm

Hi,

I've prepared a simple patch that adds support for unlimited file downloads to OpenCart 1.5.1 (it may probably for work for some of the older versions too). The changes are cosmetic - only three lines were actually changed.

The idea is to assign a negative number to download limit. If it is done, file downloads will no longer decrement the value of order_download.remaining column.

--

Edit: I've updated patch file. Previous one, due to mixed line endings, caused errors in patch program (at least in patch from UnxUtils and Cygwin).

Attachments

Unlimited downloads patch (fixed line endings issue)


xem
Newbie

Posts

Joined
Tue Sep 20, 2011 6:03 pm

Post by dragze » Wed Dec 05, 2012 6:09 pm

Hi,

I have just tried implementing your patch and it is not working.
I am using version 1.5.4 and have made the changes in your patch but my downloads just show as -1 with no download link in the customer download section.

Do you know what needs to be changed to make this work with version 1.5.4? or am I doing something wrong?
Don't know why Opencart dont just build this feature in?

Cheers.

Newbie

Posts

Joined
Tue Dec 04, 2012 11:39 pm

Post by dragze » Wed Dec 05, 2012 7:26 pm

Hi,

Got it working! Had to change a line of code in the theme template so that it shows the download link if the value is greater than 0 or less than 0 but hidden if 0.

The file that needed changing is /catalog/view/theme/default/template/account/download.tpl
and the line of code is:

Code: Select all

Line 18:       <?php if ($download['remaining'] > 0) { ?> 
changed to:

Code: Select all

Line 18:       <?php if ($download['remaining'] <> 0) { ?> 
Now just want to workout how to get it to display the remaining downloads as Unlimited instead of -1, will post if I work it out.

Hope this fix helps other people, thanks to the OP for the bulk of the code required.

Newbie

Posts

Joined
Tue Dec 04, 2012 11:39 pm

Post by dragze » Wed Dec 05, 2012 7:54 pm

Just to update,

To get it to display Unlimited for the remaining downloads instead of a minus number such as -1 I changed the following line of code in the same file mentioned in my previous post.

Code: Select all

Line 16          <div><b><?php echo $text_remaining; ?></b> <?php echo $download['remaining']; ?></div>
changed to:

Code: Select all

Line 16          <div><b><?php echo $text_remaining; ?></b> <?php if ($download['remaining'] < 0) { echo "Unlimited"; } else { echo $download['remaining']; } ?></div>
Thats all folks. Unlimited download option for 1.5.4 using default theme.

Hope someone finds this useful :)

Newbie

Posts

Joined
Tue Dec 04, 2012 11:39 pm

Post by dragze » Wed Dec 05, 2012 8:40 pm

Hi,

I have just created a vqmod xml file for Unlimited Downloads providing an easier way to implement this.
As described in this post this has been tested on OpenCart v1.5.4 using the default theme, also vqmod v2.2.1

You can download the xml file from here http://109.203.120.0/~limitles/vqmod/

Again many thanks goes to the original OP.

Enjoy :)

Newbie

Posts

Joined
Tue Dec 04, 2012 11:39 pm
Who is online

Users browsing this forum: No registered users and 1 guest