|
|
|
@ -9,6 +9,10 @@ function fulcrm_shoppingcart_admin_form_submit( $form, &$form_state ) {
|
|
|
|
|
|
|
|
|
|
variable_set( 'fulcrm_shoppingcart_experience', $form_state[ 'values' ][ 'experience' ] );
|
|
|
|
|
|
|
|
|
|
variable_set( 'fulcrm_shoppingcart_donations', $form_state[ 'values' ][ 'donation_enabled' ] );
|
|
|
|
|
variable_set( 'fulcrm_shoppingcart_donation_checkout_product', $form_state[ 'values' ][ 'donation_checkout_product' ] );
|
|
|
|
|
variable_set( 'fulcrm_shoppingcart_donation_solicited_product', $form_state[ 'values' ][ 'donation_solicited_product' ] );
|
|
|
|
|
|
|
|
|
|
drupal_set_message( t('Settings saved.'), 'status' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -53,6 +57,40 @@ function fulcrm_shoppingcart_admin_form( $form, &$form_state ) {
|
|
|
|
|
'#default_value' => variable_get( 'fulcrm_shoppingcart_failure_url', url( '<front>', array( 'absolute' => true ) ) ),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$products = array( '' => '-- disabled --' );
|
|
|
|
|
|
|
|
|
|
$product_data = fulcrm_apiv2_GET( 'product/',
|
|
|
|
|
$query = array( 'content_object__isnull' => 'true',
|
|
|
|
|
) );
|
|
|
|
|
if ( $product_data[ 'success' ] ) {
|
|
|
|
|
if ( $product_data[ 'data' ][ 'results' ] ) {
|
|
|
|
|
foreach ( $product_data[ 'data' ][ 'results' ] as $product ) {
|
|
|
|
|
$products[ $product[ 'url' ] ] = $product[ 'name' ];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$products[ 'ERROR' ] = '** ERROR fetching products from fulcrm **';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$form[ 'donation' ] = array( '#type' => 'fieldset',
|
|
|
|
|
'#title' => 'Donations',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$form[ 'donation' ][ 'donation_enabled' ] = array( '#type' => 'checkbox',
|
|
|
|
|
'#title' => 'Donations enabled?',
|
|
|
|
|
'#default_value' => variable_get( 'fulcrm_shoppingcart_donations', false ),
|
|
|
|
|
);
|
|
|
|
|
$form[ 'donation' ][ 'donation_checkout_product' ] = array( '#type' => 'select',
|
|
|
|
|
'#title' => 'Donation Product for Checkout',
|
|
|
|
|
'#default_value' => variable_get( 'fulcrm_shoppingcart_donation_checkout_product', '' ),
|
|
|
|
|
'#options' => $products,
|
|
|
|
|
);
|
|
|
|
|
$form[ 'donation' ][ 'donation_solicited_product' ] = array( '#type' => 'select',
|
|
|
|
|
'#title' => 'Donation Product for Donation Page',
|
|
|
|
|
'#default_value' => variable_get( 'fulcrm_shoppingcart_donation_solicited_product', '' ),
|
|
|
|
|
'#options' => $products,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
|
|
|
|
$form[ 'actions' ][ 'save' ] = array( '#type' => 'submit',
|
|
|
|
|
'#value' => t('Save'),
|
|
|
|
|