Re: Re: Can't get this to work...

haggis's picture
Offline
Joined: 02/22/2009
Juice: 27
Re: Re: Can't get this to work...

here is how I hide the sku input field:

uc_nosku.info

; $Id$
name = "No sku"
description = "Hides the sku input field on the edit product form and allocates its default value with 'default'."
dependencies[] = uc_product
package = "Ubercart (Optional)"
core = 6.x
php = 5.0

uc_nosku.module

<?php
// $Id$

/**
* @file
* Hides the sku input field on the edit product form
* and allocates its default value with 'default'.
*/

/**
* Implementation of hook_form_alter().
*/

function uc_nosku_form_alter(&$form, &$form_state, $form_id) {
  if (
$form_id == "product_node_form") {
     
$form['base']['model']['#default_value'] = 'default';
     
$form['base']['model']['#type'] = 'hidden';
  }
}
?>

Remember that there mustn't be a '?>' tag at the end of the .module file!

Create a directory ../sites/all/modules/ubercart/uc_nosku and save the files there.

@loocher
To change the label of the sku-field just add this line to the module above:

$form['base']['model']['#title'] = 'Just another label';
Removing SKU on product edit page By: jag (48 replies) Tue, 12/11/2007 - 23:12