| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Keeping track e-goods downloads (date and ip) | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Keeping track e-goods downloads (date and ip)
I wanted to keep track of the egoods downloads of my site.
I added the great idea from minorgod to add the downloads counter. But I wanted more so that I can know when and from where an e-good had been downloaded. There are only 4 simple modifications to do. Those modifications works for xcart version 4.4.3 but may works also for newer release, it is just a matter of testing 1. Create a new table in DB in your DB console Code:
2. Add the new table in init.php Add the following statement in the sql_tbl array (preferably right after the download_keys statement: PHP Code:
3. Add the new table in the delete statements (keep your DB clean) In the func_delete_product() function: in the if ($delete_all === true) section, add the complete clean of the table: PHP Code:
Still in the func_delete_product() function, add a statement to delete content of the table for a given product id (when a product is removed) - you can skip this if you prefer to keep an history of all downloads, even for deleted products: PHP Code:
Note that this statement must be done before the delete from download_keys. Otherwise, you will not delete anything since the entries will have been deleted! 4. Update the table whenever an e-good is downloaded In download.php, locate the following statement (line 165 for me): PHP Code:
We will add new code below again (note that minorgod functionality is not required, but it is a good to get idea). This is to retrieve and increment the id. PHP Code:
Next, update the DB once the e-good has been downloaded: PHP Code:
That's it! Let me know if this works for you or if you find any enhancement or bug. Thanks Fred |
|||||||
|
|
|||
X-Cart forums © 2001-2020
|