The solution is really Drupal-specific, and doesn't have anything to do with Ubercart, but let me show you how this works as my pennance for failing to properly read the question
It never hurts to have too much documentation!
In uc_product.module, you will find the function uc_product_form(). This function builds the form that is used to enter information about a product. In particular, this code:
$form['base']['model'] = array('#type' => 'textfield',
'#title' => t('SKU'),
'#required' => TRUE,
'#default_value' => $node->model,
'#description' => t('Product SKU/model'),
'#weight' => 0,
'#size' => 32,
);creates the SKU field on the form and marks it as "required" - meaning the user must enter a value or automatic validation won't allow the form to be submitted.
Now, you could just go ahead and change that "TRUE" to be "FALSE" and your problem would be solved. (Don't do this!) Solved until you had to upgrade Ubercart. Then this core module code would be overwritten, and of course you probably forgot all the "simple" changes you made, and you didn't write them down anywhere, so not only would your store break but it would take you a long time to identify all the problems and re-implement all those "solutions" you put in before.
No, the proper way is NOT to change the core modules, but to OVERRIDE the functions to perform the way you want them to.
In this case, what you're trying to do is to alter the product form. Luckily, Drupal gives you a way to alter any form using the hook mechanism. In particular, hook_form_alter(). The way it works is this: Whenever a form is displayed, Drupal "asks" if any module wants to alter it. So if you write a small module, your module will have the ability to make changes to the form before it is presented to the user.
Here is the minimal module you will need: Create a directory on your web server called "custom" under site/all/modules and in it create two files: my_module.info and my_module.module
my_module.info looks like this:
; $Id$
name = My Module
description = My customizations to Ubercart
package = Custommy_module.module looks like this:
<?php
// $Id$
/**
* @file
* Module to hold my customizations to Ubercart
*/
/**
* Implementation of hook_form_alter()
*/
function my_module_form_alter($form_id, &$form) {
if ($form_id == 'product_node_form') {
$form['base']['model']['#required'] = FALSE;
}
}This function is called by Drupal every time a form is built, so we first test to see if it's the form we're interested in then change the value we're interested in. We could also add elements to the form at this point, if that's something you need.
Now use your browser to go to the admin/build/modules menu for your site and enable your module. That's all - the SKU field should no longer be "required" when you create products. You can use this mechanism to perform all sorts of different customizations to Ubercart without ever having to modify the distributed code.


Joined: 11/05/2007