3 submit buttons to modify ubecart veiws
Hi,
I'm new with the internal drupal code, and i try to modify ubercart catalog using hooks, but i can´t find the answer. i try to create first a form with all the components and later i will try to modify ubercart, but is impossible for me because i have not experience about that.
My project:
I have one ubecart catalog with:
5 Regions with a price by region
3 Users with a price by user
3 Duration with a price by 1year or 1 month
Them when the client select all this 3 options i have to show the sum prices + 3 format options:
EX: 1 user + 2 regions + 1 month => PDF FORMAT= total ; EXCEL FORMAT= total, WORD FORMAT= total
And them the client hay to push add to cart to pay his selection
----my code until now----
--php
// $Id$
/**
* Implements hook_menu().
*/
function input_menu() {
$items['input/online-store'] = array(
'title' => 'FocusEconomics Consensus Forecasts',
'description' => 'FocusEconomics Consensus Forecasts',
'page callback' => 'drupal_get_form',
'page arguments' => array('eshop_form'),
'access callback' => TRUE,
'weight' => 1,
);
return $items;
}
/**
* A longer form with more elements and attributes.
*/
print '
';
function eshop_form($form, &$form_submit) {
//Form Regions
$form['regions'] = array(
'#type' => 'checkboxes',
'#options' => drupal_map_assoc(array('mayor_economies'=>t('Major Economies'), 'euro_area'=>t('Euro Area'), 'nordic_economies'=>t('Nordic Economies'), 'asia_pacific'=>t('Asia|Pacific'), 'eastern_europe' =>t('Eastern Europe'), 'latin_america' =>t('Latin America'))),
'#title' => t('Regions'),
'#required' => TRUE,
);
//Form Users
$form['users'] = array(
'#type' => 'checkboxes',
'#options' => drupal_map_assoc(array('1user'=>t('1 User'), '2-5users'=>t('2-5 Users'), '6-10users'=>t('6-10 Users'))),
'#title' => t('Users'),
'#required' => TRUE,
);
// Form Duration
$form['duration'] = array(
'#title' => t('Duration'),
'#type' => 'radios',
'#options' => array('1month' => t('1 Month'), '1year' => t('1 Year')),
'#required' => TRUE,
);
$form['more_selection'] = array(
'#type' => 'markup',
'#markup' => '' . t('For more users suscription, please contact us', array('!url' => url('contact'))) . '.',
);
//Submit buttons
$form['pdf_only'] = array(
'#type' => 'submit',
'#value' => t('Buy Now'),
'#prefix' => "",
'#suffix' => "",
);
$form['pdf_and_excel'] = array(
'#type' => 'submit',
'#value' => t('Buy Now'),
'#prefix' => "",
'#suffix' => "",
);
$form['excel_only'] = array(
'#type' => 'submit',
'#value' => t('Buy Now'),
'#prefix' => "",
'#suffix' => "",
);
return $form;
}
print '
';
/**
* Submit function for input_simple_form().
*/
function eshop_form_submit($form, &$form_state) {
// Display a message upon successful submission.
drupal_set_message(t("I like @regions, too!", array('@regions' => $form_state['values']['regions'])));
}
I would suggest contacting some of the mentors on http://buildamodule.com/mentors to see if any of them would be able to talk you through this, and be sure to ask if they have any experience with modifying the Ubercart module.
Please let us know if you're able to connect with someone there to help you out!