Virtuemart 2 plugin to automatically add products also to its parent categories, or remove them from all but the lowest categories. For child products, it can also assign them to the parent product's categories, or remove all categories.
This is a Virtuemart 2 plugin that can automatically add your products to the parent categories of their own categories, or remove them from all but the lowest categories in the category hierachy. For child products, it can also assign them to the parent product's categories, or remove all categories.
Virtuemart 2 displays products only in the exact categories they are assigned to. In many cases, however, you want your customers to see also all products in the child categories of the current category. This plugin, which can be configured to run automatically in the Backend, can be configured to add each product also to all parent categories, so it will appear also in the parent category listing. The reverse is also possible: Automatically remove each product from all parent categories and display it only in the very last category (leaf category). For child products, the plugins additionally allows the shop owner to automatically remove all categories or explicitly copy all categories from the parent product. This allows you to globally modify all child products to either not appear at all in the VirtueMart categories view in the frontend (because e.g. you display the child products on the parent product's page) or to show all child products automatically in the same categories as the parent products.
- Download the plugin here and store it on your harddrive
- Go to your Joomla administrator backend, and install it like any other joomla plugin:
- Log in and go to the extensions manager ("Extensions" -> "Extension manager")
- In the "Upload Package file" section, simply select the file you just downloaded and click "Upload & install"
How the plugin works
Whenever the plugin is triggered in the Joomla/VirtueMart administration area (see the configuration setting below), it simply loads all products and all child products, checks their categories and automatically modifies the categories according to you settings. Potential triggers for running the plugin are when you view the VirtueMart configuration page or the VirtueMart products list in the administration area. All changes by the plugin are then done automatically and in the background, only a short message is printed, informing you about how many products were modified.
This plugin only modifies the categories assigned to products, no other settings.
After installation, you need to enable and configure the plugin. By default, the plugin does not modify any categories automatically! You have to manually configure the plugin in the Joomla plugin manager (NOT inside VirtueMart!) first:
- Go to the Plugin manager in the Joomla backend ("Extensions" -> "Plug-In Manager")
- Find the plugin named "System - VM Auto Parent Categories" and click on it. This will bring up the configuration screen for the plugin:
- First change the "Status" on the left side the "Enabled" to enable the plugin itself
- Then configure your triggerfor the plugin. By default, the plugin will not run automatically and modify any products, since this is a potentially very destructive action (i.e. it might remove your diligently assigned category structure automatically!) Possible values are:
- "Never" - The plugin will never be run automatically, you can only run the plugin manually by clicking on the link on the left side (the plugin still has to be enabled for this to work!)
- "VirtueMart start page (Backend)" - Check the categories of all products whenever you visit VirtueMart's main page in the Backend (in the administrator area)
- "VirtueMart product list page (Backend)" - Check the categories of all products whenever you view VirtueMart's product list in the administrator area
- You can also select, how the categories of normal (i.e. top-level) productsshall be modified. This will NOT apply to any child product:
- "Do not modify" - No modifications will be done to top-level products.
- "Add product to all parent categories of assigned categories" - The product will be assigned to all parent categories of all its categories
- "Add product to leaf category and its parent, remove all others" - The product will be assigned only to the two lowest categories in the hierarchy (higher categories in the tree will be removed, the second-to-last category potentially added). If the product was assigned to multiple leaf categories, it will be added to all their immediate parents, too.
- For child products, you have the same options as for top-level products (you can select a different option than for top-level products). Additionally, two further options are available:
- "Copy categories from parent product" - Copies and explicitly adds all categories from the parent product. This causes all child products to be displayed in the frontent, too.
- "Remove all categories" - Remove all categories from all child products, so they will not be listed in the VirtueMart category views any more (this is needed if you want to show child products only on their parents' pages)
- The "Debug Output"options controls how verbose the output of the plugin is:
- "No output" - Never print any output of what is done or changed (Use with caution, you will never know when the plugin runs and potentially messes with your categories!)
- "Report changes" - Whenever a product is changed, print out a short summary how many products and child products were modified, so you know that the plugin was run and modified your category settings. If no modifications are needed, no message is printed.
- "Report, even if nothing was changed" - Whenever the plugin is run, print a short summary, listing how many products were modified. If no modifications are needed, a short message about this fact is still printed.
- "Report changes, don't apply them" - Like "Report, even if nothing was changed", only that no changes are actually applied. This is useful for testing the plugin and to get an overview what the plugin would modify. I highly recommend using this setting first, since it does not modify and potentially mess up your store.
- "Verbose debug output" - Print verbose debug output about all changes.
- "Verbose debug output, don't apply changes" - Like "Verbose debug output", only that no changes are actually applied. Again, this is usefull for testing and debugging the plugin.
WARNING: Before enabling the plugin, please make sure you have a backup of your data, as the plugin WILL modify your assigned categories. I recommend Akeeba Backup to backup the whole joomla site, so you can easily restore all your data if you don't like the results of the plugin.
This plugin is licenced unter the GNU GPLv3. It is also free to download, and you automatically obtain all the rights and duties that the GPL gives you, without any payment. If you find the plugin useful, it would still be nice if you could donate a certain amount.
2013-02-27: Version 1.2 (Support for Joomla 1.5, straighten out language files)
2013-02-24: Version 1.1 (Bugfix for more than 15 categories)
2012-12-18: Version 1.0 (First working version)