3 submit buttons to modify ubecart veiws

1 reply [Last post]
cucuyito
Offline
Last seen: 4 years 2 weeks ago
Joined: 2013-04-28

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'])));
}

John Q.T. Nguyen
Offline
Last seen: 8 years 22 weeks ago
Joined: 2012-06-13
I would suggest contacting

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!

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.