Looking for broken downloads in your Zen Cart

Zen Cart has a feature called the Downloads Manager (admin->catalog->downloads manager), which allows you to easily spot missing downloadable files.  If the file isn’t present in your downloads directory, the icon goes bright red.

Screen Shot 2015-05-25 at 11.17.39 AM

The problem is, this doesn’t always work.  If you created the file attribute, but forgot to specify the file, the download manager won’t identify the missing file.

If you believe this might be a problem for you, you may do an audit of your database, looking for products with this problem.

Here’s how to do the audit:

1) Go to admin->catalog->option name manager to verify the option id for File Format.  It will normally be “1”.

2) From PHPMyAdmin:

SELECT * FROM `products_attributes` pa where options_id = 1 and not exists (select * from products_attributes_download pad where pa.products_attributes_id = pad.products_attributes_id)

Of course you will need to prefix table names with your prefix if you are using one, and change the options_id value if it’s other than 1.

Once found, you can add back these missing files in the attributes controller (admin->catalog->attributes controller) simply by editing the attribute, and entering the filename at the bottom of the form.