Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce with Zen Cart!

Zen Cart Audit

Zen Cart Audit

The Audit mod runs a series of consistency checks on your database.

Donate: This is free software. Show your appreciation by supporting my efforts. Donate

Relevance: Zen Cart™ 1.5.4 and above

Current Version: 1.2 (version history)

Support Thread: Audit Support Thread

Cost: Free, but donation appreciated

Installed Cost: $100.00 Buy Professional Installation by That Software Guy

Installation Difficulty: Easy

Installation Instructions: click here for installation instructions

Location: Zen Cart Plugins, under Admin Tools

Download: Audit in Zen Cart Plugins

FAQ: click here for FAQ


Overview:

Audit runs a series of checks on your database. When it finds problems, it makes recommendations on how to fix them.

Operation:

First, let's see what audit reports on a site with no issues. The table border is green, and a success message is shown.
Zen Cart Audit finds no issues

If there are issues, the table border is red, and the columns show the issue and possible ways to resolve it.

  1. Product's master category does not exist
    Each product has a master category id, and that category must exist for you to see the product in the admin. You can press the link to move the product to a category which exists.
    Zen Cart Audit finds missing product with a master category that does not exist

  2. Product not present in Products to Categories table
    Each product should have one or more entries in the products_to_categories table. You can press the link to add an entry in the table and resolve this issue.
    Zen Cart Audit finds missing product,category pair in products_to_categories table

  3. Missing Product ID, Master Categories ID pair
    Each product should have one or more entries in the products_to_categories table. You can press the link to add an entry in the table and resolve this issue.

    The difference between this and the previous issue is that in this case, there is at least one entry in the products_to_categories table (but not the expected entry of {products_id, master categories_id})
    Zen Cart Audit finds missing product,category pair in products_to_categories table

  4. Master category ID 0
    Each product should have a non-zero master category, indicating the parent the product is underneath. You can press the link to move the product to the correct category. As an interim step, the product will be moved to the SAFE_CATEGORY.
    Note that a similar message is issued if the product's master category is the safe category, since this is designed to be a temporary holding place only.

    Zen Cart Audit finds missing product,category pair in products_to_categories table

    Part of the process of moving a product with the audit tool is removing any existing linked categories, so if the product is linked, you will need to re-add it to any linked categories.

  5. Empty Categories
    Empty categories may be deleted using the Delete Category link. Note that deleting one or more categories may lead to the reporting of additional empty categories if the deleted categories were children of a parent category with no more children.
    Zen Cart Audit finds empty categories

  6. Product with type 0
    Products can be misconfigured with type 0 in a variety of ways. You'll want to correct this. The most common product type is 1, so the fix link sets it to this value; you can further modify that in the normal Zen Cart product edit screen (Admin > Catalog > Categories/Products > Edit).
    Zen Cart Audit finds product with type 0

Installation Instructions:

  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. Copy the contents of the unzipped folder to the root directory of your shop.
  3. Run the audit.sql file against your database, using Admin > Tools > Install SQL Patches.
  4. Create a category named SAFE. This will be used as a temporary holding place for products being moved.
  5. Run Audit from under Admin > Tools.


Optional but recommended changes

  • If you use the category sidebox, skip the SAFE category.
    In the file includes/templates/bootstrap/sideboxes/tpl_categories.php make the first check in the for loop:
        if ($box_categories_array[$i]['name'] == 'SAFE') continue;
    
  • In the sitemap, skip the SAFE category.
    In the file includes/classes/site_map.php in the constructor, add this condition to the first select:
        and cd.categories_name != 'SAFE'
    


Major Versions

  • 1.2 09/01/2021 - Check for categories containing both sub-categories and products
  • 1.1 05/04/2020 - Check for missing product master category
  • 1.0a 10/04/2019 - Fix PHP notice
  • 1.0 10/01/2019 - First Release

FAQ

Q: How can I prevent the SAFE category from showing up in my category lists?
A: Assuming these lists were built with the categories_ul_generator class, just modify includes/classes/categories_ul_generator.php to include a check on the category name:

    WHERE c.categories_id = cd.categories_id
    AND c.categories_status = 1
    AND cd.language_id = " . (int)$_SESSION['languages_id'] . "
    AND cd.categories_name != 'SAFE'