Can't render check form with ubercart_get_form('uc_cart_checkout_form');

Created on 21 September 2009, over 15 years ago
Updated 11 March 2025, about 2 months ago

I spent a while debugging this one.

Because the form is in a separate file, if you try to render the checkout form yourself (on some random node with the PHP filter turned on) you get an error.

    * warning: Missing argument 1 for webform_forms() in C:\Documents and Settings\Administrator\Sites\acquia-drupal-site\acquia-drupal\modules\acquia\webform\webform.module on line 442.
    * warning: Missing argument 1 for uc_product_forms() in C:\Documents and Settings\Administrator\Sites\acquia-drupal-site\acquia-drupal\sites\all\modules\ubercart\uc_product\uc_product.module on line 360.
    * warning: Missing argument 2 for uc_product_forms() in C:\Documents and Settings\Administrator\Sites\acquia-drupal-site\acquia-drupal\sites\all\modules\ubercart\uc_product\uc_product.module on line 360.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'uc_cart_checkout_form' was given in C:\Documents and Settings\Administrator\Sites\acquia-drupal-site\acquia-drupal\includes\form.inc on line 371.

To resolve this error, I had to do the following:

    require_once(drupal_get_path('module', 'uc_cart') .'/uc_cart.pages.inc');
    
    $form_id = 'uc_cart_checkout_form';
  
    drupal_add_js(drupal_get_path('module', 'uc_cart') .'/uc_cart.js');
    print drupal_get_form($form_id); 

This shouldn't be required to render a form.

Note: In my specific case I was using a "custom node" inside of Panels 3 with the PHP filter on to render the checkout form in a styled manner with some boxes around it.

🐛 Bug report
Status

Closed: works as designed

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • theming

    Used in Documentation issues related to theming

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024