| Project: | Ubercart Contributions |
| Component: | Code |
| Category: | |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (needs review) |
Jump to:
Hi.
The error is:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'uc_product_add_to_cart_form_29' was given in /srv/www/vhosts/test.localhost/httpdocs/includes/form.inc on line 218." while browsing a my custom product-node
And you can guess, there is no any "Add to cart form" form 
You can get this error by doing this:
1. Add a new node type and fill "module" field with "uc_product" (with the help of hook_node_info())
For example, my hook-func is:
<?php
function uc_balance_node_info() {
return array(
'balance' => array(
'name' => t('Balance'),
'module' => 'uc_product',
'description' => t('Balance is special product type which can be represent as payment gateway. This can be used for prepayment mechanisms, automatic prolongation of some service-type goods and more... Customers on your site may have several balance types'),
)
);
}
?>2. Register this node type as "product" with the help of hook_product_types()
My code is:
<?php
function uc_balance_product_types() {
return array('balance');
}
?>3. Create a new node of this node type and you'll get this error.
Also i found that hook_product_types() is not documented 
So my solution was making custom hook_forms() for my module with this code not changing main uc sources (only one line of uc_product_forms() code was changed).
But i hope that you will just fix it if it's a really bug 
Thank you.
| Preview | Attachment | Size |
|---|---|---|
| uc_product.module.patch | 164 bytes |





I'm specifically using only uc_product's node types for those callbacks because uc_product_kit has a somewhat different Add to Cart form. Using hook_product_types() here would add product_kits to hook_forms() twice, and differently, and I don't really know what would happen then.