I want to bring to attention that many Ubercart modules are not using the 'product_types' hook when they probably should.
Instead of something like this:
$p_types = module_invoke_all('product_types');
foreach ($p_types as $id) {
$product_types[] = "'". $id ."'";
}
modules are just dipping into the uc_product_class table for a quick look and adding the default 'product'. eg:
$product_types = array("'product'");
$types = db_query("SELECT DISTINCT(pcid) FROM {uc_product_classes}");
One instance of this happening is in uc_reports: function uc_reports_products().
I have brought up this issue because I created a new product type uc_event (a paid event), using the 'product_types' hook implementation and I want to enable uc_reports to report on it. I have modified my uc_reports script in order to make this happen and am requesting that this go to core.
I will report back here on any other instances in uc modules where I think the 'product_types' hook should be used.



Re: product classes: using the 'product_types' hook
This is a good thing to look into, but I want to advise caution because there are good reasons to use each method. hook_product_types() is used to find all the node types that can be used in Ubercart's API. They will have a price and weight, and all that fun stuff.
However, if the code is dealing with the idea that these nodes use the same callbacks to generate information, then you should stick to querying the {uc_product_classes} table. These types use the same node hooks, and they will have the same add to cart forms. They are even more similar too each other than node types that aren't created by uc_product. Like product kits.
Re: Re: product classes: using the 'product_types' hook
I looked into entering the paid event as a product_class in the table but unfortunately it created a dummy content type which was of no use and distracted from the actual event content type. It is true that I have removed weight from the event product, but it certainly has a price and that is used as determination of it being a product (test for display of product form in event content type node edit form).
Anyway, I've added the relevent code where it is needed for this module and will keep a record and put it in the uc_event README.txt for the sake of users. And we'll see what happens.