If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Managing Customers and Orders / Reactivating download links in bulk?

Reactivating download links in bulk?

Started by caroleas on 31 Dec 2017, 9:49 PM · Views: 12,195

Results 1 to 20 of 30
31 Dec 2017, 9:49 PM
#1
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Reactivating download links in bulk?

Occasionally, I will update some of my digital products and send a notification to the customers. The problem I experience is that my default download period is 7 days, and the update might be months or years later so the customers have to contact me individually and I have to reset their downloads one by one.

Is there a way to reactivate all the downloads for Product X without having to go one at the time?
Is there a mod for that?

31 Dec 2017, 11:33 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Reactivating download links in bulk?

You could just modify the check in includes/templates/YOUR_TEMPLATE/templates/tpl_modules_downloads.php to skip the check (on a product by product basis or all together). There is a second check in includes/modules/pages/download/header_php.php that would need to be modified in the same way.

Alternately, you could use my Digital Product Upgrade mod and turn this into a profitable transaction.
https://www.zen-cart.com/downloads.php?do=file&id=2043

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

1 Jan 2018, 12:07 AM
#3
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

First, in my store, the customers don't have to re-purchase anything so I will reset their download as needed. That means that the mod would not be welcome by my customers who are already familiar with the way the downloads are managed.

As for the first part, I have NO CLUE what you are referring to as I don't find that file: includes/templates/YOUR_TEMPLATE/templates/tpl_modules_downloads.php

1 Jan 2018, 12:09 AM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Reactivating download links in bulk?

If a file is not part of your template, you can just copy it from template_default. So copy

includes/templates/template_default/templates/tpl_modules_downloads.php

to

includes/templates/YOUR_TEMPLATE/templates/tpl_modules_downloads.php

(if you're using the responsive classic template in 1.5.5, you'd change template_default to responsive_classic in the first path.)

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

2 Jan 2018, 5:31 PM
#5
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

Finally back to this today.

I am using a cloned version of the responsive_classic but I can't find the file

includes/templates/responsive_classic/templates/tpl_modules_downloads.php

Where else could I find it? there is one in the template_default but I suspect it would not work the same, or would it?

2 Jan 2018, 5:33 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Reactivating download links in bulk?

If it isn't there, it wasn't overridden so go to the base - template_default.

includes/templates/template_default/templates/tpl_modules_downloads.php

So now you know, the order of search is:
a) Your template
b) responsive_classic (assuming you used that as a base)
c) template_default

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

2 Jan 2018, 5:49 PM
#7
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

Ok I got a copy of the file, placed it in my template, but now, I have no clue what to do with it.
You mentioned "modify the check in ... to skip the check" but I don't know what to edit or where.

3 Jan 2018, 4:37 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Reactivating download links in bulk?

Hi Carole,
You said you're using v1.5.5.
Try the attached updated /admin/downloads_manager.php file. It adds a new "R" button to reset all orders with that download.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 Jan 2018, 8:59 PM
#9
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

I am just a little unclear where the R should appear. Where should I look?

3 Jan 2018, 9:23 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Reactivating download links in bulk?

On the Downloads Manager page:
Attachment 17586

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 Jan 2018, 10:32 PM
#11
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

Thank you so much. I had never used the Download Manager before. It now shows exactly as you indicate. Now, is there a way to know that one file download has been reset or not after I clicked on it?

4 Jan 2018, 3:04 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Reactivating download links in bulk?

CaroleAs:

Thank you so much. I had never used the Download Manager before. It now shows exactly as you indicate. Now, is there a way to know that one file download has been reset or not after I clicked on it?
Hmmmm ...

At line 66 in that file you'll see:

            $db->Execute($sql);
            zen_redirect(zen_href_link(FILENAME_DOWNLOADS_MANAGER, 'padID=' . (int)$_POST['padID'] . '&page=' . (int)$_GET['page']));

Try adding this extra line as shown:

            $db->Execute($sql);
            $messageStack->add_session('Done. ' . $db->affectedRows() . ' orders updated.', 'success');
            zen_redirect(zen_href_link(FILENAME_DOWNLOADS_MANAGER, 'padID=' . (int)$_POST['padID'] . '&page=' . (int)$_GET['page']));

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

4 Jan 2018, 3:39 AM
#13
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

After editing and replacing the file, whenever I click on one of the R, I get a 500 error.
I must still be doing something wrong.

4 Jan 2018, 3:38 PM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Reactivating download links in bulk?

Oops. That depends on something added in v1.5.5f. If you copy the /includes/classes/db/query_factory.php file from v155f to replace your existing v155 file, then the R should work.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

4 Jan 2018, 6:16 PM
#15
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

I still get the same thing.
I downloaded the 1.5.5f version, and found the file /includes/classes/db/mysql/query_factory.php and replaced the similar file in my 1.5.5e installation.
Now, in the Download Manager, if I click the R beside a product, although I don't get a 500 error anymore, I get nothing visible. What is supposed to happy or display?

4 Jan 2018, 8:25 PM
#16
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Reactivating download links in bulk?

CaroleAs:

I still get the same thing.
I downloaded the 1.5.5f version, and found the file /includes/classes/db/mysql/query_factory.php and replaced the similar file in my 1.5.5e installation.
Now, in the Download Manager, if I click the R beside a product, although I don't get a 500 error anymore, I get nothing visible. What is supposed to happy or display?

After selecting the R option, the screen is supposed to refresh and a "success" message (typically bright green) indicating:

Done. XXX orders updated.

Should be shown at the top of the screen.

Would suggest reviewing the ZC logs folder to see what myDebug-adm related files are generated when trying to use this functionality. There may be a typo or something else in the modification that has been made. If posting the contents here, please obscure your admin directory from within the content and as always post within ```
[CODE][/CODE]

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

4 Jan 2018, 8:47 PM
#17
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

After selecting the R option, the screen is supposed to refresh and a "success" message (typically bright green) indicating:

Done. XXX orders updated.

Should be shown at the top of the screen.

Oh ok, that is there, so that works. I was just expecting the R box to change color to indicate that it had been reset. I guess, it is just because I had about 20 to reset but if I had only one, then it would not matter to know, tomorrow, which ones were reset yesterday.

Thank you for your time.

4 Jan 2018, 9:26 PM
#18
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Reactivating download links in bulk?

CaroleAs:

Oh ok, that is there, so that works. I was just expecting the R box to change color to indicate that it had been reset. I guess, it is just because I had about 20 to reset but if I had only one, then it would not matter to know, tomorrow, which ones were reset yesterday.

Thank you for your time.

So there is a little bit of "notification" that probably should have also been included in the code provided which is a log (or attempt to log) that the particular reset occurred... It isn't necessarily the same as a color change for the affected row such that perhaps a check is performed and if all records associated with that "line" have a "good" date then set as one color and if all others are outside that good date then another color (tertiary color if needed for some other cut-off point).

Anyways, just before/after the newly added $messageStack command if you would add:

if (function_exists('zen_record_admin_activity')) {
    zen_record_admin_activity('Downloads-manager download reset for products_attributes_id ' . (int)$padID, 'info');
}

This would make a log entry that could be reviewed/cross referenced for records...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

4 Jan 2018, 9:59 PM
#19
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Reactivating download links in bulk?

mc12345678:

Anyways, just before/after the newly added $messageStack command if you would add:

In which file? The query_factory.php file or the downloads_manager.php ?

4 Jan 2018, 10:48 PM
#20
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Reactivating download links in bulk?

CaroleAs:

In which file? The query_factory.php file or the downloads_manager.php ?
The file referenced in post #12: https://www.zen-cart.com/showthread.php?223305-Reactivating-download-links-in-bulk&p=1339916#post1339916

Which is the downloads_manager.php file where $messageStack was just recently added to address "knowing" what had changed. (guess a little more info could be captured in that text as well maybe.)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...