tweaks and fixes and theming

This commit is contained in:
Marek Isalski 2016-03-23 10:18:22 +00:00
parent c62c20e0ee
commit 80e52bb79f
5 changed files with 7 additions and 8 deletions

View File

@ -1 +0,0 @@
<?php /* fulcrm-shoppingcart-cart.tpl.php */

View File

@ -49,16 +49,15 @@ function fulcrm_shoppingcart_menu() {
function fulcrm_shoppingcart_theme( $existing, $type, $theme, $path ) { function fulcrm_shoppingcart_theme( $existing, $type, $theme, $path ) {
return array( 'fulcrm_shoppingcart_cart' => array( 'variables' => array( 'shoppingcart' => null ), // data returned from fulcrm API 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 '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 '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 ) { 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 ) ) { if ( array_key_exists( 'fulcrm_shoppingcart_id', $_SESSION ) ) {
$api_data = fulcrm_apiv2_GET( 'shoppingcart/' . $_SESSION[ 'fulcrm_shoppingcart_id' ] . '/', $api_data = fulcrm_apiv2_GET( 'shoppingcart/' . $_SESSION[ 'fulcrm_shoppingcart_id' ] . '/',
$query = array('expand' => implode(',', array('shoppingitems', $query = array( 'expand' => implode( ',', array( 'shoppingitems',
'shoppingitems.content_object'))) ); 'shoppingitems.content_object' ) ) ) );
if ( $api_data[ 'success' ] ) { if ( $api_data[ 'success' ] ) {
if ( ( $api_data[ 'data' ][ 'completed' ] === null ) && ( $api_data[ 'data' ][ 'abandoned' ] === null ) ) { if ( ( $api_data[ 'data' ][ 'completed' ] === null ) && ( $api_data[ 'data' ][ 'abandoned' ] === null ) ) {
return $api_data[ 'data' ]; return $api_data[ 'data' ];
@ -104,7 +103,7 @@ function fulcrm_shoppingcart_buy( $product_id ) {
function fulcrm_shoppingcart_cart() { function fulcrm_shoppingcart_cart() {
$cart = fulcrm_shoppingcart_get_session_cart( false ); $cart = fulcrm_shoppingcart_get_session_cart( false );
return print_r( $cart, 1 ); return theme( 'fulcrm_shopping_cart', array( 'cart' => $cart ) );
} }
function fulcrm_shoppingcart_checkout() { function fulcrm_shoppingcart_checkout() {

View File

@ -0,0 +1 @@
fulcrm_shoppingcart_cart.tpl.php