Ejemplo n.º 1
0
 * You will need to setup a nested array of options and option selections.
 *
 * You could end up with multiple $BMButtonOption arrays here, and each of those could
 * contain multiple $BMButtonOptionSelection arrays within it.  All are then passed into
 * the final $BMButtonOptions array that gets passed to the API.
 *
 * This sample includes 2 options.  The Color option, which contains 3 selections (with pricing),
 * and the Size option, which contains 2 selections (without pricing).
 */
$BMButtonOptions = array();
$BMButtonOptionSelections = array();
$BMButtonOptionSelection = array('value' => 'Blue', 'price' => '10.00', 'type' => '');
array_push($BMButtonOptionSelections, $BMButtonOptionSelection);
$BMButtonOptionSelection = array('value' => 'Red', 'price' => '8.00', 'type' => '');
array_push($BMButtonOptionSelections, $BMButtonOptionSelection);
$BMButtonOptionSelection = array('value' => 'Green', 'price' => '12.00', 'type' => '');
array_push($BMButtonOptionSelections, $BMButtonOptionSelection);
$BMButtonOption = array('name' => 'Color', 'selections' => $BMButtonOptionSelections);
array_push($BMButtonOptions, $BMButtonOption);
$BMButtonOptionSelections = array();
$BMButtonOptionSelection = array('value' => 'Small', 'price' => '', 'type' => '');
array_push($BMButtonOptionSelections, $BMButtonOptionSelection);
$BMButtonOptionSelection = array('value' => 'Large', 'price' => '', 'type' => '');
array_push($BMButtonOptionSelections, $BMButtonOptionSelection);
$BMButtonOption = array('name' => 'Size', 'selections' => $BMButtonOptionSelections);
array_push($BMButtonOptions, $BMButtonOption);
$PayPalRequestData = array('BMCreateButtonFields' => $BMCreateButtonFields, 'BMButtonVars' => $BMButtonVars, 'BMButtonOptions' => $BMButtonOptions);
$PayPalResult = $PayPal->BMCreateButton($PayPalRequestData);
// Write the contents of the response array to the screen for demo purposes.
echo '<pre />';
print_r($PayPalResult);