|
|
|
@ -49,16 +49,15 @@ function fulcrm_shoppingcart_menu() {
|
|
|
|
|
|
|
|
|
|
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',
|
|
|
|
|
'template' => 'fulcrm_shoppingcart_cart',
|
|
|
|
|
),
|
|
|
|
|
'fulcrm_shoppingcart_cart_items' => array( 'variables' => array( 'shoppingitems' => null ), // data returned from fulcrm API
|
|
|
|
|
'template' => 'fulcrm-shoppingcart-cart-items',
|
|
|
|
|
'template' => 'fulcrm_shoppingcart_cart_items',
|
|
|
|
|
),
|
|
|
|
|
'fulcrm_shoppingcart_cart_item' => array( 'variables' => array( 'shoppingitem' => null ), // data returned from fulcrm API
|
|
|
|
|
'template' => 'fulcrm-shoppingcart-cart-item',
|
|
|
|
|
'template' => 'fulcrm_shoppingcart_cart_item',
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_get_session_cart( $create = true ) {
|
|
|
|
@ -68,8 +67,8 @@ function fulcrm_shoppingcart_get_session_cart( $create = true ) {
|
|
|
|
|
|
|
|
|
|
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'))) );
|
|
|
|
|
$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' ];
|
|
|
|
@ -104,7 +103,7 @@ function fulcrm_shoppingcart_buy( $product_id ) {
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_cart() {
|
|
|
|
|
$cart = fulcrm_shoppingcart_get_session_cart( false );
|
|
|
|
|
return print_r( $cart, 1 );
|
|
|
|
|
return theme( 'fulcrm_shopping_cart', array( 'cart' => $cart ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_checkout() {
|
|
|
|
|