function widget($args, $instance) { global $wpdb, $wpsc_theme_path; extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Product Categories') : $instance['title']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $selected_categorisations = array_keys((array) $instance['categorisation'], true); if ($selected_categorisations != null) { foreach ($selected_categorisations as $key => $selected_categorisation) { $selected_categorisations[$key] = (int) $selected_categorisation; } $selected_values = implode(',', $selected_categorisations); } else { $selected_values = $wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_CATEGORISATION_GROUPS . "` WHERE `active` IN ('1') AND `default` IN ('1') LIMIT 1 "); } $categorisation_groups = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CATEGORISATION_GROUPS . "` WHERE `id` IN ({$selected_values}) AND `active` IN ('1')", ARRAY_A); foreach ($categorisation_groups as $categorisation_group) { $category_settings = array(); $category_settings['category_group'] = $categorisation_group['id']; $category_settings['show_thumbnails'] = $instance['image']; $category_settings['order_by'] = array("column" => 'name', "direction" => 'asc'); $provided_classes = array(); if ($category_settings['show_thumbnails'] == 1) { $provided_classes[] = "category_images"; } //echo wpsc_get_theme_file_path("category_widget.php"); include wpsc_get_theme_file_path("category_widget.php"); } echo $after_widget; }
function widget_wp_shopping_cart($args) { global $wpsc_theme_path, $cache_enabled; extract($args); $options = get_option('widget_wp_shopping_cart'); if (get_option('show_sliding_cart') == 1) { if (is_numeric($_SESSION['slider_state'])) { if ($_SESSION['slider_state'] == 0) { $collapser_image = 'plus.png'; } else { $collapser_image = 'minus.png'; } $fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='" . WPSC_URL . "/images/{$collapser_image}' title='' alt='' id='fancy_collapser' /></a>"; } else { if ($_SESSION['nzshpcrt_cart'] == null) { $collapser_image = 'plus.png'; } else { $collapser_image = 'minus.png'; } $fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='" . WPSC_URL . "/images/{$collapser_image}' title='' alt='' id='fancy_collapser' /></a>"; } } else { $fancy_collapser = ""; } $title = empty($options['title']) ? __('Shopping Cart') : $options['title']; echo $before_widget; $full_title = $before_title . $title . $fancy_collapser . $after_title; echo $full_title; $display_state = ""; if (($_SESSION['slider_state'] == 0 || wpsc_cart_item_count() < 1) && get_option('show_sliding_cart') == 1) { $display_state = "style='display: none;'"; } $use_object_frame = false; if ($cache_enabled == true && (!defined('DONOTCACHEPAGE') || constant('DONOTCACHEPAGE') !== true)) { echo " <div id='sliding_cart' class='shopping-cart-wrapper'>"; if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE") == false && $use_object_frame == true) { ?> <object codetype="text/html" type="text/html" data="index.php?wpsc_action=cart_html_page" border='0px'> <p><?php _e('Loading...', 'wpsc'); ?> </p> </object> <?php } else { ?> <div class='wpsc_cart_loading'><p><?php _e('Loading...', 'wpsc'); ?> </p> <?php } echo " </div>"; } else { echo " <div id='sliding_cart' class='shopping-cart-wrapper' {$display_state}>"; include wpsc_get_theme_file_path("cart_widget.php"); echo " </div>"; } echo $after_widget; }
function nzshpcrt_display_categories_groups() { global $wpdb; if (get_option('permalink_structure') != '') { $seperator = "?"; } else { $seperator = "&"; } ob_start(); $category_settings = array('category_group' => 1, 'show_thumbnails' => get_option('show_category_thumbnails')); include wpsc_get_theme_file_path("category_widget.php"); $output = ob_get_contents(); ob_end_clean(); return $output; }