WordPress.org

Plugin Directory

Changeset 348350


Ignore:
Timestamp:
02/20/11 22:17:10 (3 years ago)
Author:
JustinSainton
Message:

Checking if isset on orderby. WP_DEBUG stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-e-commerce/branches/3.8-development/wpsc-admin/display-items.page.php

    r347858 r348350  
    259259    $wp_query->query = wp_parse_args( $wp_query->query ); 
    260260 
    261           switch ( $wp_query->query['orderby'] ) : 
    262             case 'stock' : 
    263                 $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_stock') " . $wp_query->get('order'); 
    264                 break; 
    265             case 'price' : 
    266                 $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_price') " . $wp_query->get('order'); 
    267                 break; 
    268             case 'sale_price' : 
    269                 $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_special_price') " . $wp_query->get('order'); 
    270                 break; 
    271             case 'SKU' : 
    272                 $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_sku') " . $wp_query->get('order'); 
    273                 break; 
    274         endswitch; 
     261        if( isset( $wp_query->query ) ) : 
     262            switch ( $wp_query->query['orderby'] ) : 
     263                case 'stock' : 
     264                    $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_stock') " . $wp_query->get('order'); 
     265                    break; 
     266                case 'price' : 
     267                    $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_price') " . $wp_query->get('order'); 
     268                    break; 
     269                case 'sale_price' : 
     270                    $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_special_price') " . $wp_query->get('order'); 
     271                    break; 
     272                case 'SKU' : 
     273                    $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = '_wpsc_sku') " . $wp_query->get('order'); 
     274                    break; 
     275           endswitch; 
     276        endif; 
    275277         
    276     return $orderby; 
     278    return $orderby; 
    277279} 
    278280function wpsc_cats_restrict_manage_posts() { 
Note: See TracChangeset for help on using the changeset viewer.