Re: Removing SKU on product edit page

uberguy's picture
Offline
Joined: 02/24/2009
Juice: 22
Re: Removing SKU on product edit page

Sorry, trying to find out the product textfield attribute that I should use in order to change the size for the last few days but of no luck. I have found out the form id after print out in my_module.module file. The form is 'uc_product_add_to_cart_form_11', the node is node/11. This attribute is added from store/attributes, same as Size, Color(in Store Administration). My code is as follow:

<?php
// $Id$

/**
* @file
* Module to hold my customizations to Ubercart
*/

/**
* Implementation of hook_form_alter()
*/
function my_module_form_alter(&$form, $form_state, $form_id) {

if ($form_id == "uc_product_add_to_cart_form_11") {

print $form_id;

/*
$form['#parameters'][2]['attributes'][6]['#size'] = 20;
*/

$form['form_info'] = array('#value' => print_r($form, TRUE));

}

/* etc ... */

}

When browse to node/11, the form id will be printed. I have commented the $form['#parameters'][2]['attributes'][6]['#size'] = 20 as it will give blank screen. The form array printed is as attached.

As you can see attributes[6] which is a name text field, I would like to limit the number of characters to 20. Currently it has maxlength=128, size=60.

I have search through the forum on hook_form_alter but there is no example on changing the custom product attributes that is added from store admin. Any help on this.

Thanks.

AttachmentSize
form-array-output.txt 2.74 KB
Removing SKU on product edit page By: jag (48 replies) Tue, 12/11/2007 - 23:12