Digital Downloads

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
In Nop_Download, I think there should be another field added to that table named "MaxNumDownloads" that will let the administrator set the maximum number of downloads for a specific user. Another table would need to be created, something like Nop_Download_User and the fields would look something like this:

CREATE TABLE [dbo].[Nop_Download_Customer] (
  [DownloadCustomerID] [int] IDENTITY(1,1) NOT NULL,
  [DownloadID] [int] NOT NULL,
  [CustomerID] [int] NOT NULL,
  [DownloadIsPaidFor] [bit] NOT NULL DEFAULT(1),
  [DownloadIsFree] [bit] NOT NULL DEFAULT(0),
  [NumDownloads] [int] NOT NULL DEFAULT(1),
CONSTRAINT [Nop_Download_User_PK] PRIMARY KEY CLUSTERED
(
  [DownloadUserID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]


ALTER TABLE [dbo].[Nop_Download_Customer]  WITH CHECK ADD  CONSTRAINT [FK_Nop_Customer_Nop_Download_Customer] FOREIGN KEY([CustomerID])
REFERENCES [dbo].[Nop_Customer] ([CustomerId])

ALTER TABLE [dbo].[Nop_Download_Customer]  WITH CHECK ADD  CONSTRAINT [FK_Nop_Download_Nop_Download_Customer] FOREIGN KEY([DownloadID])
REFERENCES [dbo].[Nop_Download] ([DownloadID])

The value set in [MaxNumDownloads] in Nop_Download would determine if the user can still download this item when [NumDownloads] reaches the same value of [MaxNumDownloads].

[DownloadIsPaidFor] is just a flag that lets administrators control whether the item can be downloaded if it has not been paid for.

[DownloadIsFree] is a flag that will let the user download the file without any further prompting for payment.
13 years ago
This feature exists already (as of 1.6 I believe).

Just uncheck "Unlimited downloads" and you then have the option to set the max number of downloads.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.