Any questions about Documents Sellers, post it here .

How to add download count to the orders screen

  • Best Best
  • Topic Author
  • Offline
  • New Member
  • New Member
More
13 years 8 months ago #3987 by Best Best
DMS has the ability to limit documents on a download count, but there is no way to know how many times users have downloaded the documents.

I made some modifications to show this information in the admin section on the orders screen.

in /www/administrator/components/com_dms/models/orders.php I altered the getData() function to be as follows..
Code:
.... for ($i = 0 , $n = count($rows) ; $i < $n ; $i++) { $row = & $rows[$i] ; //Get all documents $sql = 'SELECT c.title, b.downloaded FROM #__dms_orders AS a INNER JOIN #__dms_order_item AS b ' . ' ON a.id = b.order_id ' . ' INNER JOIN #__dms_documents AS c ' . ' ON b.document_id = c.id ' . ' WHERE a.id = '.$row->id ; ; $this->_db->setQuery($sql); $items = $this->_db->loadAssocList(); $row->items = ''; $row->downloaded = ''; foreach ($items as $item) { $row->items .= $item['title'] . '<br>'; $row->downloaded .= $item['downloaded'] . '<br>'; } } ...

Then in the /www/administrator/components/com_dms/views/orders/tmpl/default.php file I added a new <TH>Downloads</TH> to the table heading and the following to the table body
Code:
<td style="text-align: center;"> <?php echo $row->downloaded; ?> </td>

You can see the result in the attached screenshot below.
It would be great if this feature could be included in DMS.

The next step might be to be able to edit the download count...
Attachments:

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
13 years 8 months ago #4021 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: How to add download count to the orders screen
Hi

Thanks so much for offering this code . I will add this feature to next version of DMS .

Thanks ,

Tuan

Please Log in or Create an account to join the conversation.