Hi.
I cannot use Availability feature.
I think that there is this problem in the ec_availability_product_form_alter function of ec_available.module.
function ec_availability_product_form_alter(&$pform, &$node_form) {
if (ec_product_feature_exists($node_form['#node']->ptype, 'availability')) {
$node =& $node_form['#node'];
$form['inventory'] = array(
'#type' => 'fieldset',
'#title' => t('Availability control'),
);
$form['inventory']['available'] = array(
'#type' => 'textfield',
'#title' => t('Items available'),
'#default_value' => (($node->available != '') ? $node->available : 0),
'#size' => 25,
'#maxlength' => 50,
'#description' => t('Amount of the product is which available for sale.'),
);
$form['inventory']['reserved'] = array(
'#type' => 'textfield',
'#title' => t('Items reserved'),
'#default_value' => (($node->reserved != '') ? $node->reserved : 0),
'#size' => 25,
'#maxlength' => 50,
'#description' => t('Amount of the product which has been sold, but has not been shipped or the order has not been completed'),
);
}
}
This problem is recovered if I convert '$form' into '$pform'.
function ec_availability_product_form_alter(&$pform, &$node_form) {
if (ec_product_feature_exists($node_form['#node']->ptype, 'availability')) {
$node =& $node_form['#node'];
$pform['inventory'] = array(
'#type' => 'fieldset',
'#title' => t('Availability control'),
);
$pform['inventory']['available'] = array(
'#type' => 'textfield',
'#title' => t('Items available'),
'#default_value' => (($node->available != '') ? $node->available : 0),
'#size' => 25,
'#maxlength' => 50,
'#description' => t('Amount of the product is which available for sale.'),
);
$pform['inventory']['reserved'] = array(
'#type' => 'textfield',
'#title' => t('Items reserved'),
'#default_value' => (($node->reserved != '') ? $node->reserved : 0),
'#size' => 25,
'#maxlength' => 50,
'#description' => t('Amount of the product which has been sold, but has not been shipped or the order has not been completed'),
);
}
}
I'm developing new product module. It need ec_available.module. I expect Availability feature.
Comments
Comment #1
gordon commentedThanks I have fixed this. It was actually that the hook_form_FORM_ID_alter was being called incorrectly.
see http://api.drupal.org/api/function/hook_form_FORM_ID_alter/6
Comment #2
SmellyWelly commentedHi
I still cannot get this to work - the available field does not appear in the product edit page.
Comment #3
gordon commentedGive it another go with the latest dev version. I have fix another but which may have stopped this from working.