I'm a WPAlchemy enthusiast, this class really enhance my productivity, but there is some things I don't understand.
I started to create a custom post type for products, with description, price and available stock. Then I added some columns to this custom post type listing like the price and stock.
And then, I tried to make the stock column sortable, so I read the tutorial from Scribu but it seems to not work with the storage mode of WPAlchemy.
The ID of my metabox is "_sk", the name of my value is "stock", the name returned by the method get_the_name()
is "_sk[stock]", and I use this code:
add_filter( 'manage_edit-products_sortable_columns', 'products_sortable_columns');
function products_sortable_columns( $columns ) {
$columns['stock'] = 'stock';
return $columns;
}
add_filter('request', 'stock_column_orderby');
function stock_column_orderby($vars) {
if (isset($vars['orderby']) && 'stock' == $vars['orderby']) {
$vars = array_merge( $vars, array(
'meta_key' => '_sk[stock]',
'orderby' => 'meta_value_num'
));
}
return $vars;
}
But when I try to sort by stock, the list return me "No products".
Can you see the point? Is there trouble with the storage mode of WPAlchemy?
Thanks in advance for your help!