array( 'title' => t('Administer fulcrm shopping cart'), 'description' => t('Perform main installation/administration tasks for fulcrm shopping cart.'), ), ); } function fulcrm_shoppingcart_menu() { /* $items[ 'admin/config/services/fulcrm' ] = array( 'page callback' => 'system_admin_menu_block_page', 'file' => 'system.admin.inc', 'file path' => drupal_get_path('module', 'system'), 'title' => 'fulcrm', 'description' => 'Configuration integration with fulcrm.org.', 'position' => 'right', 'access callback' => 'user_access', 'access arguments' => array('access administration pages'), ); */ $items[ 'admin/config/services/fulcrm/shoppingcart' ] = array( 'page callback' => 'fulcrm_shoppingcart_admin', 'file' => 'fulcrm_shoppingcart.admin.inc', 'title' => 'fulcrm Shopping Cart', 'description' => 'Configure Shopping Cart for fulcrm.org.', 'access callback' => 'user_access', 'access arguments' => array('administer fulcrm shoppingcart'), ); $items[ 'fulcrm/buy/%/%' ] = array( 'page callback' => 'fulcrm_shoppingcart_buy', 'page arguments' => array(2,3), 'type' => MENU_CALLBACK, 'access callback' => 'user_access', 'access arguments' => array('access content'), ); $items[ 'fulcrm/cart' ] = array( 'page callback' => 'fulcrm_shoppingcart_cart', 'type' => MENU_CALLBACK, 'access callback' => 'user_access', 'access arguments' => array('access content'), ); $items[ 'fulcrm/checkout' ] = array( 'page callback' => 'fulcrm_shoppingcart_checkout', 'type' => MENU_CALLBACK, 'access callback' => 'user_access', 'access arguments' => array('access content'), ); return $items; } function fulcrm_shoppingcart_theme( $existing, $type, $theme, $path ) { return array( 'fulcrm_shoppingcart_cart' => array( 'variables' => array( 'shoppingcart' => null ), // data returned from fulcrm API 'template' => 'fulcrm_shoppingcart_cart', ), 'fulcrm_shoppingcart_cart_items' => array( 'variables' => array( 'shoppingitems' => null ), // data returned from fulcrm API 'template' => 'fulcrm_shoppingcart_cart_items', ), 'fulcrm_shoppingcart_cart_item' => array( 'variables' => array( 'shoppingitem' => null ), // data returned from fulcrm API 'template' => 'fulcrm_shoppingcart_cart_item', ), ); } function fulcrm_shoppingcart_get_session_cart( $create = true ) { global $user; drupal_session_start(); if ( array_key_exists( 'fulcrm_shoppingcart_id', $_SESSION ) ) { $api_data = fulcrm_apiv2_GET( 'shoppingcart/' . $_SESSION[ 'fulcrm_shoppingcart_id' ] . '/', $query = array( 'expand' => implode( ',', array( 'shoppingitems', 'shoppingitems.content_object' ) ) ) ); if ( $api_data[ 'success' ] ) { if ( ( $api_data[ 'data' ][ 'completed' ] === null ) && ( $api_data[ 'data' ][ 'abandoned' ] === null ) ) { return $api_data[ 'data' ]; } } } if ( $create ) { $person_url = null; if ( !user_is_anonymous() ) { $person_id = fulcrm_webhook_get_pk_for_entity_type( 'user', $user->uid, 'person' ); if ( $person_id ) $person_url = fulcrm_apiv2_make_url( 'person', $person_id ); } $cart_data = array( 'person' => $person_url, 'd' => array( 'fulcrm_testing_data' => 'this is a test' ) ); $api_data = fulcrm_apiv2_POST( 'shoppingcart/', $cart_data ); if ( $api_data[ 'success' ] ) { $_SESSION[ 'fulcrm_shoppingcart_id' ] = $api_data[ 'data' ][ 'id' ]; return $api_data[ 'data' ]; } } } function _fulcrm_shoppingcart_buy_hmac( $product_id ) { return drupal_hmac_base64( 'fulcrm:' . strval( $product_id ) . ':product_id', session_id() . drupal_get_hash_salt() ); } function fulcrm_shoppingcart_buy_url( $product_id ) { $hmac = _fulcrm_shoppingcart_buy_hmac( $product_id ); return url( 'fulcrm/buy/' . $product_id . '/' . $hmac ); } function _fulcrm_shoppingcart_person_id_hmac( $person_id ) { return drupal_hmac_base64( 'fulcrm:' . strval( $person_id ) . ':person_id', session_id() . drupal_get_hash_salt() ); } function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_state ) { } function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $person, $eventbookingtype, $product ) { $form = array(); $form[ 'title_event' ] = array( '#type' => 'markup', '#markup' => '