'', 'image' => 'Name', 'title' => '', 'price' => 'Price', 'categories' => 'Categories', ); register_column_headers('display-product-list', $columns); $baseurl = includes_url('js/tinymce'); ?>

0) { echo "
".str_replace(":directory:","",__('The following directories are not writable: :directory: You won't be able to upload any images or files here. You will need to change the permissions on these directories to make them writable.', 'wpsc'))."
"; } // class='stuffbox' ?>
escape($search_input)."%"; $search_sql = "AND (`products`.`name` LIKE '".$search_string."' OR `products`.`description` LIKE '".$search_string."')"; } else { $search_sql = ''; } $search_sql = apply_filters('wpsc_admin_products_list_search_sql', $search_sql); if($category_id > 0) { // if we are getting items from only one category, this is a monster SQL query to do this with the product order $sql = "SELECT `products`.`id` , `products`.`name` , `products`.`price` , `products`.`image`,`products`.`weight` , `products`.`publish`, `categories`.`category_id`,`order`.`order`, IF(ISNULL(`order`.`order`), 0, 1) AS `order_state` FROM `".WPSC_TABLE_PRODUCT_LIST."` AS `products` LEFT JOIN `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` AS `categories` ON `products`.`id` = `categories`.`product_id` LEFT JOIN `".WPSC_TABLE_PRODUCT_ORDER."` AS `order` ON ( ( `products`.`id` = `order`.`product_id` ) AND ( `categories`.`category_id` = `order`.`category_id` ) ) WHERE `products`.`active` = '1' $search_sql AND `categories`.`category_id` IN ( '".$category_id."' ) ORDER BY `order_state` DESC,`order`.`order` ASC, `products`.`date_added` DESC, `products`.`id` DESC"; // if we are selecting a category, set is_sortable to true $is_sortable = true; } else { $itempp = 10; if ($_GET['pageno']!='all') { if($_GET['pageno'] > 0) { $page = absint($_GET['pageno']); } else { $page = 1; } $start = (int)($page * $itempp) - $itempp; $sql = "SELECT DISTINCT * FROM `".WPSC_TABLE_PRODUCT_LIST."` AS `products` WHERE `products`.`active`='1' $search_sql ORDER BY `products`.`date_added` DESC LIMIT $start,$itempp"; if(get_option('wpsc_sort_by') == 'dragndrop'){ $sql = "SELECT DISTINCT * FROM `".WPSC_TABLE_PRODUCT_LIST."` AS `products` LEFT JOIN `".WPSC_TABLE_PRODUCT_ORDER."` AS `order` ON `products`.`id`= `order`.`product_id` WHERE `products`.`active`='1' AND `order`.`category_id`='0' $search_sql ORDER BY `order`.`order`"; } } else { $sql = "SELECT DISTINCT * FROM `".WPSC_TABLE_PRODUCT_LIST."` AS `products` WHERE `products`.`active`='1' $search_sql ORDER BY `products`.`date_added`"; } } // exit($sql); $product_list = $wpdb->get_results($sql,ARRAY_A); //exit('
'.print_r($product_list, true).'
'); $num_products = $wpdb->get_var("SELECT COUNT(DISTINCT `products`.`id`) FROM `".WPSC_TABLE_PRODUCT_LIST."` AS `products` WHERE `products`.`active`='1' $search_sql"); if (isset($itempp)) { $num_pages = ceil($num_products/$itempp); } if($page !== null) { $page_links = paginate_links( array( 'base' => add_query_arg( 'pageno', '%#%' ), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => $num_pages, 'current' => $page )); } $this_page_url = stripslashes($_SERVER['REQUEST_URI']); ?>

0) { foreach((array)$product_list as $product) { //first set the patch to the default $image_path = WPSC_URL."/images/no-image-uploaded.gif"; if(is_numeric($product['image'])) { // check for automatic thumbnail images // file_exists(WPSC_THUMBNAIL_DIR.$product['image']) $product_image = $wpdb->get_var("SELECT `image` FROM `".WPSC_TABLE_PRODUCT_IMAGES."` WHERE `id` = '{$product['image']}' LIMIT 1"); // if the image exists, set the image path to it. if(($product_image != null) && file_exists(WPSC_THUMBNAIL_DIR.$product_image)) { $image_path = WPSC_THUMBNAIL_URL.$product_image; } } // get the product name, unless there is no name, in which case, display text indicating so if ($product['name']=='') { $product_name = "(".__('No Name', 'wpsc').")"; } else { $product_name = htmlentities(stripslashes($product['name']), ENT_QUOTES, 'UTF-8'); } $category_html = ''; if(get_option('wpsc_sort_by') != 'dragndrop'){ $category_list = $wpdb->get_results("SELECT `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`id`,`".WPSC_TABLE_PRODUCT_CATEGORIES."`.`name` FROM `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` , `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."`.`product_id` IN ('".$product['id']."') AND `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."`.`category_id` = `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`id` AND `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`active` IN('1')",ARRAY_A); }else{ $category_list = $wpdb->get_results("SELECT `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`id`,`".WPSC_TABLE_PRODUCT_CATEGORIES."`.`name` FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` LEFT JOIN `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` ON `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."`.`category_id`= `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`id` WHERE `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."`.`product_id` IN ('".$product['product_id']."') AND `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`active` IN('1')",ARRAY_A); } $i = 0; foreach((array)$category_list as $category_row) { if($i > 0) { $category_html .= "
"; } $category_html .= "".stripslashes($category_row['name']).""; $i++; } if(get_option('wpsc_sort_by') == 'dragndrop'){ $product['id'] = $product['product_id']; } ?>
' title="ID #" /> <?php echo $product[' width='38' height='38' /> - 0) { $product_alert['messages'] = implode("\n",(array)$product_alert['messages']); } if($product_alert['state'] === true) { ?> <?php echo $product_alert[' title='' class='product-alert-image' src='/images/product-alert.jpg' alt='' /> /wp-admin/images/wpspin_light.gif' alt='loading' />
'> ][price]' value='' /> ][id]' value='' /> ][nonce]' value='' />
".__('View All Categories', 'wpsc')."\r\n"; $options .= wpsc_admin_category_dropdown_tree(null, 0, absint($_GET['category_id'])); $concat = "\r\n"; $concat .= "\r\n"; $concat .= "\r\n"; return $concat; } function wpsc_admin_category_dropdown_tree($category_id = null, $iteration = 0, $selected_id = null) { /* * Displays the category forms for adding and editing products * Recurses to generate the branched view for subcategories */ global $wpdb; $siteurl = get_option('siteurl'); $url = $siteurl."/wp-admin/admin.php?page=wpsc-edit-products"; $search_sql = apply_filters('wpsc_admin_category_dropdown_tree_search_sql', ''); if(is_numeric($category_id)) { $sql = "SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active`='1' AND `category_parent` = '$category_id' ".$search_sql." ORDER BY `id` ASC"; } else { $sql = "SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active`='1' AND `category_parent` = '0' ".$search_sql." ORDER BY `id` ASC"; } // echo $sql; $values = $wpdb->get_results($sql, ARRAY_A); foreach((array)$values as $option) { if($selected_id == $option['id']) { $selected = "selected='selected'"; } //$url = htmlentities(remove_query_arg('product_id',add_query_arg('category_id', $option['id']))); $output .= "\r\n"; $output .= wpsc_admin_category_dropdown_tree($option['id'], $iteration+1, $selected_id); $selected = ""; } return $output; } ?>