apptivo_widget_cssclass = 'widget_apptivo_shopping_cart'; $this->apptivo_widget_description = __( 'Display the users Shopping Cart in the sidebar.', 'apptivo_ecommerce' ); $this->apptivo_widget_idbase = 'apptivo_ecommerce_shopping_cart'; $this->apptivo_widget_name = __('[Apptivo] Shopping Cart', 'apptivo_ecommerce' ); /* Widget settings. */ $widget_ops = array( 'classname' => $this->apptivo_widget_cssclass, 'description' => $this->apptivo_widget_description ); /* Create the widget. */ $this->WP_Widget('apptivo_shopping_cart', $this->apptivo_widget_name, $widget_ops); } /** @see WP_Widget */ function widget( $args, $instance ) { global $apptivo_ecommerce; $available_gateways = $apptivo_ecommerce->payment_gateways->available_payment_gateway_lists(); $checkout_pageid = ''; if($available_gateways): foreach ($available_gateways as $gateway ) : if($gateway->id == 'SecureCheckout') : $checkout_pageid = get_permalink(get_option('apptivo_ecommerce_secure_checkout_page_id')); break; elseif( $gateway->id == 'paypal' || $gateway->id == 'GoogleCheckout'): $checkout_pageid = get_permalink(get_option('apptivo_ecommerce_checkout_page_id')); break; endif; endforeach; endif; if (is_shopping_cart()) return; extract($args); if ( !empty($instance['title']) ) $title = $instance['title']; else $title = __('Cart', 'apptivo_ecommerce'); $title = apply_filters('widget_title', $title, $instance, $this->id_base); $getcartDetails = getCartDetails(); $shoppingCart_Lines = get_baginfo()->shoppingCartLines; $shoppingCartLines = app_convertObjectToArray($shoppingCart_Lines); if (sizeof($shoppingCartLines) == 0 || empty($shoppingCartLines[0])) { echo $before_widget; if ( $title ) echo $before_title . '' . $after_title; echo ''; echo $after_widget; return; } echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; echo ''; echo $after_widget; } /** @see WP_Widget->update */ function update( $new_instance, $old_instance ) { $instance['title'] = strip_tags(stripslashes($new_instance['title'])); return $instance; } /** @see WP_Widget->form */ function form( $instance ) { ?>