Do not load all products in one go, but one after the other
Created by: kainhofer
With many products, loading all products into memory and looping in memory might exhaust server memory. It might be better to only load the products one after each other: http://open-tools.net/forum/auto-parent-categories-plugin/4180-virtuemart-2-auto-product-categories-plug-in.html
The only obstacle is the parent products feature of children, for which we need to find the top-level parent of the current product. This might mean that we have to load each product multiple times if we have a deep product hierarchy.