diff --git a/wpsc-admin/includes/save-data.functions.php b/wpsc-admin/includes/save-data.functions.php index de37628480..e0fc9b6844 100755 --- a/wpsc-admin/includes/save-data.functions.php +++ b/wpsc-admin/includes/save-data.functions.php @@ -264,6 +264,9 @@ function _wpsc_is_display_type_supported( $display_type ) { return function_exists( $callback ); } +/** + * Renders the additional content for the category edit page + */ function wpsc_admin_category_forms_edit() { global $wpdb; @@ -271,7 +274,7 @@ function wpsc_admin_category_forms_edit() { $category_name = ''; $category = array(); - $category_id = absint( $_REQUEST["tag_ID"] ); + $category_id = absint( $_REQUEST['tag_ID'] ); $category = get_term( $category_id, 'wpsc_product_category', ARRAY_A ); $category['nice-name'] = wpsc_get_categorymeta( $category['term_id'], 'nice-name' ); $category['description'] = wpsc_get_categorymeta( $category['term_id'], 'description' ); @@ -305,7 +308,7 @@ function wpsc_admin_category_forms_edit() { ?>
@@ -325,7 +328,7 @@ function wpsc_admin_category_forms_edit() { - + @@ -342,7 +345,6 @@ function wpsc_admin_category_forms_edit() { -

@@ -352,7 +354,7 @@ function wpsc_admin_category_forms_edit() { - [wpsc_products category_url_name='']
+ [wpsc_products category_url_name='']
@@ -361,7 +363,7 @@ function wpsc_admin_category_forms_edit() { - <?php echo wpsc_display_products_page( array( 'category_url_name' => '' ) ); ?>
+ <?php echo wpsc_display_products_page( array( 'category_url_name' => '' ) ); ?>
@@ -374,7 +376,7 @@ function wpsc_admin_category_forms_edit() { get_results( "SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A ); + $countrylist = $wpdb->get_results( 'SELECT id,country,visible FROM `'.WPSC_TABLE_CURRENCY_LIST.'` ORDER BY country ASC ',ARRAY_A ); $selectedCountries = wpsc_get_meta( $category_id,'target_market','wpsc_category' ); ?> @@ -387,16 +389,16 @@ function wpsc_admin_category_forms_edit() { :  
- - ' value='' checked='' /> -
+ ' value='' checked='' /> +
- ' value='' /> -
+ ' value='' /> +
@@ -418,7 +420,7 @@ function wpsc_admin_category_forms_edit() { $category['term_id'] = ''; $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' ); - $checkout_sets = get_option('wpsc_checkout_form_sets'); + $checkout_sets = get_option( 'wpsc_checkout_form_sets' ); unset($checkout_sets[0]); $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' ); ?> @@ -430,12 +432,12 @@ function wpsc_admin_category_forms_edit() { /> - + +

diff --git a/wpsc-includes/theme.functions.php b/wpsc-includes/theme.functions.php index 8cc04baa4b..25d6a75d30 100755 --- a/wpsc-includes/theme.functions.php +++ b/wpsc-includes/theme.functions.php @@ -902,68 +902,69 @@ function wpsc_get_the_new_id($prod_id){ function wpsc_display_products_page( $query ) { global $wpdb, $wpsc_query,$wp_query, $wp_the_query; - remove_filter('the_title','wpsc_the_category_title'); + remove_filter( 'the_title','wpsc_the_category_title' ); // If the data is coming from a shortcode parse the values into the args variable, // I did it this was to preserve backwards compatibility - if(!empty($query)){ + if ( ! empty( $query ) ) { $args = array(); $args['post_type'] = 'wpsc-product'; - if(!empty($query['product_id']) && is_array($query['product_id'])){ + if ( ! empty( $query['product_id'] ) && is_array( $query['product_id'] ) ) { $args['post__in'] = $query['product_id']; - }elseif(is_string($query['product_id'])){ + } elseif ( is_string( $query['product_id'] ) ) { $args['post__in'] = (array)$query['product_id']; } - if(!empty($query['old_product_id'])){ - $post_id = wpsc_get_the_new_id($query['old_product_id']); + if ( ! empty( $query['old_product_id'] ) ) { + $post_id = wpsc_get_the_new_id( $query['old_product_id'] ); $args['post__in'] = (array)$post_id; } - if(!empty($query['price']) && 'sale' != $query['price']){ + if ( ! empty( $query['price'] ) && 'sale' != $query['price'] ) { $args['meta_key'] = '_wpsc_price'; $args['meta_value'] = $query['price']; - }elseif(!empty($query['price']) && 'sale' == $query['price']){ + } elseif ( ! empty( $query['price'] ) && 'sale' == $query['price'] ) { $args['meta_key'] = '_wpsc_special_price'; $args['meta_compare'] = '>='; $args['meta_value'] = '1'; } - if(!empty($query['product_name'])){ + if ( ! empty( $query['product_name'] ) ) { $args['pagename'] = $query['product_name']; } - if(!empty($query['category_id'])){ - $term = get_term($query['category_id'],'wpsc_product_category'); - $id = wpsc_get_meta($query['category_id'], 'category_id','wpsc_old_category'); - if( !empty($id)){ - $term = get_term($id,'wpsc_product_category'); + if ( ! empty( $query['category_id'] ) ) { + $term = get_term( $query['category_id'],'wpsc_product_category' ); + $id = wpsc_get_meta( $query['category_id'], 'category_id','wpsc_old_category' ); + if ( ! empty( $id ) ){ + $term = get_term( $id,'wpsc_product_category' ); $args['wpsc_product_category'] = $term->slug; $args['wpsc_product_category__in'] = $term->term_id; - }else{ + } else { $args['wpsc_product_category'] = $term->slug; $args['wpsc_product_category__in'] = $term->term_id; } } - if(!empty($query['category_url_name'])){ + if ( ! empty( $query['category_url_name'] ) ) { $args['wpsc_product_category'] = $query['category_url_name']; } $orderby = ( !empty($query['sort_order']) ) ? $query['sort_order'] : null; - $args = array_merge( $args, wpsc_product_sort_order_query_vars($orderby) ); + $args = array_merge( $args, wpsc_product_sort_order_query_vars( $orderby ) ); - if(!empty($query['order'])){ + if ( ! empty( $query['order'] ) ) { $args['order'] = $query['order']; } - if(!empty($query['limit_of_items']) && '1' == get_option('use_pagination')){ + if ( '0' == get_option( 'use_pagination' ) ) { + $args['nopaging'] = true; + $args['posts_per_page'] = '-1'; + } + if ( ! empty( $query['limit_of_items'] ) ) { $args['posts_per_page'] = $query['limit_of_items']; + $args['nopaging'] = false; } - if(!empty($query['number_per_page']) && '1' == get_option('use_pagination')){ + if ( ! empty( $query['number_per_page'] ) ) { $args['posts_per_page'] = $query['number_per_page']; - $args['paged'] = $query['page']; + $args['nopaging'] = false; } - if( '0' == get_option('use_pagination') ){ - $args['nopaging'] = true; - $args['posts_per_page'] = '-1'; - } - if(!empty($query['tag'])){ + if ( ! empty( $query['tag'] ) ) { $args['product_tag'] = $query['tag']; } query_posts( $args ); @@ -974,12 +975,13 @@ function wpsc_display_products_page( $query ) { // Pretty sure this single_product code is legacy...but fixing it up just in case. // get the display type for the selected category - if(!empty($temp_wpsc_query->query_vars['term'])) - $display_type = wpsc_get_the_category_display($temp_wpsc_query->query_vars['term']); - elseif( !empty( $args['wpsc_product_category'] ) ) - $display_type = wpsc_get_the_category_display($args['wpsc_product_category']); - else + if ( ! empty( $temp_wpsc_query->query_vars['term'] ) ) { + $display_type = wpsc_get_the_category_display( $temp_wpsc_query->query_vars['term'] ); + } elseif ( ! empty( $args['wpsc_product_category'] ) ) { + $display_type = wpsc_get_the_category_display( $args['wpsc_product_category'] ); + } else { $display_type = 'default'; + } $saved_display = wpsc_get_customer_meta( 'display_type' ); $display_type = ! empty( $saved_display ) ? $saved_display : wpsc_check_display_type(); @@ -1472,7 +1474,7 @@ function is_products_page(){ } /** - * wpsc_display_products_page function. + * wpsc_display_featured_products_page function. * * @access public * @param mixed $query @@ -1514,7 +1516,7 @@ function wpsc_display_featured_products_page() { /** - * wpsc_display_products_page class + * WPSC_Hide_subcatsprods_in_cat class * * Shows only products from current category, but not from subcategories. *