'', // Unused. Messages start at index 1.
1 => sprintf( __('Product updated. View Product'), esc_url( get_permalink($post_ID) ) ),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __('Product updated.'),
/* translators: %s: date and time of the revision */
5 => isset($_GET['revision']) ? sprintf( __('Product restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( __('Product published. View Product'), esc_url( get_permalink($post_ID) ) ),
7 => __('Product saved.'),
8 => sprintf( __('Product submitted. Preview Product'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
9 => sprintf( __('Product scheduled for: %1$s. Preview Product'),
// translators: Publish box date format, see http://php.net/date
date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
10 => sprintf( __('Product draft updated. Preview Product'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
);
return $messages;
}
/**
* Custom columns
**/
function jigoshop_edit_product_columns($columns) {
$columns = array();
$columns["cb"] = "";
$columns["thumb"] = null;
$columns["title"] = __("Title", 'jigoshop');
$columns["featured"] = __("Featured", 'jigoshop');
$columns["product-type"] = __("Type", 'jigoshop');
if( get_option('jigoshop_enable_sku', true) == 'yes' ) {
$columns["product-type"] .= ' & ' . __("SKU", 'jigoshop');
}
if ( get_option('jigoshop_manage_stock')=='yes' ) {
$columns["stock"] = __("Stock", 'jigoshop');
}
$columns["price"] = __("Price", 'jigoshop');
$columns["product-visibility"] = __("Visibility", 'jigoshop');
$columns["product-date"] = __("Date", 'jigoshop');
return $columns;
}
add_filter('manage_edit-product_columns', 'jigoshop_edit_product_columns');
function jigoshop_custom_product_columns($column) {
global $post;
$product = new jigoshop_product($post->ID);
switch ($column) {
case "thumb" :
if( 'trash' != $post->post_status ) {
echo '';
echo jigoshop_get_product_thumbnail( 'admin_product_list' );
echo '';
}
else {
echo jigoshop_get_product_thumbnail( 'admin_product_list' );
}
break;
case "price":
echo $product->get_price_html();
break;
case "featured" :
$url = wp_nonce_url( admin_url('admin-ajax.php?action=jigoshop-feature-product&product_id=' . $post->ID) );
echo '';
if ($product->is_featured()) echo '';
else echo '';
echo '';
break;
case "stock" :
if ( ! $product->is_type( 'grouped' ) && $product->is_in_stock() ) {
if ( $product->managing_stock() ) {
echo $product->stock.' '.__('In Stock', 'jigoshop');
} else {
echo __('In Stock', 'jigoshop');
}
} elseif ( $product->is_type( 'grouped' ) ) {
echo __('Parent (no stock)', 'jigoshop');
} else {
echo '' . __('Out of Stock', 'jigoshop') . '';
}
break;
case "product-type" :
echo ucwords($product->product_type);
echo '
';
if ( get_option('jigoshop_enable_sku', true) == 'yes' && $sku = get_post_meta( $post->ID, 'sku', true )) {
echo $sku;
}
else {
echo $post->ID;
}
break;
case "product-date" :
if ( '0000-00-00 00:00:00' == $post->post_date ) :
$t_time = $h_time = __( 'Unpublished', 'jigoshop' );
$time_diff = 0;
else :
$t_time = get_the_time( __( 'Y/m/d g:i:s A', 'jigoshop' ) );
$m_time = $post->post_date;
$time = get_post_time( 'G', true, $post );
$time_diff = time() - $time;
if ( $time_diff > 0 && $time_diff < 24*60*60 )
$h_time = sprintf( __( '%s ago', 'jigoshop' ), human_time_diff( $time ) );
else
$h_time = mysql2date( __( 'Y/m/d', 'jigoshop' ), $m_time );
endif;
echo '' . apply_filters( 'post_date_column_time', $h_time, $post ) . '
';
if ( 'publish' == $post->post_status ) :
_e( 'Published', 'jigoshop' );
elseif ( 'future' == $post->post_status ) :
if ( $time_diff > 0 ) :
echo '' . __( 'Missed schedule', 'jigoshop' ) . '';
else :
_e( 'Scheduled', 'jigoshop' );
endif;
else :
_e( 'Draft', 'jigoshop' );
endif;
break;
case "product-visibility" :
if ( $product->visibility ) :
echo ($product->visibility == 'Hidden')
? ''.ucfirst($product->visibility).''
: ucfirst($product->visibility);
endif;
break;
}
}
// Enable sorting for custom columns
add_filter("manage_edit-product_sortable_columns", 'jigoshop_custom_product_sort');
function jigoshop_custom_product_sort( $columns ) {
$custom = array(
'featured' => 'featured',
'price' => 'price',
'product-visibility' => 'visibility',
'product-date' => 'date'
);
return wp_parse_args($custom, $columns);
}
// Product column orderby
add_filter( 'request', 'jigoshop_custom_product_orderby' );
function jigoshop_custom_product_orderby( $vars ) {
if (isset( $vars['orderby'] )) :
if ( 'featured' == $vars['orderby'] ) :
$vars = array_merge( $vars, array(
'meta_key' => 'featured',
'orderby' => 'meta_value'
) );
endif;
if ( 'price' == $vars['orderby'] ) :
$vars = array_merge( $vars, array(
'meta_key' => 'regular_price',
'orderby' => 'meta_value_num'
) );
endif;
if ( 'visibility' == $vars['orderby'] ) :
$vars = array_merge( $vars, array(
'meta_key' => 'visibility',
'orderby' => 'meta_value'
) );
endif;
endif;
return $vars;
}
/**
* Filter products by category, uses slugs for option values.
* Props to: Andrew Benbow - chromeorange.co.uk
**/
add_action('restrict_manage_posts','jigoshop_products_by_category');
function jigoshop_products_by_category() {
global $typenow, $wp_query;
if ( $typenow=='product' )
jigoshop_product_dropdown_categories();
}
/**
* Filter products by type
**/
add_action('restrict_manage_posts', 'jigoshop_filter_products_type');
function jigoshop_filter_products_type() {
global $typenow, $wp_query;
if ( $typenow != 'product' )
return false;
// Get all active terms
$terms = get_terms('product_type');
echo "";
}
// NOTE: This causes a large spike in queries, however they are cached so the performance hit is minimal ~20ms -Rob
add_action('manage_product_posts_custom_column', 'jigoshop_custom_product_columns', 2);
function jigoshop_edit_order_columns($columns) {
$columns = array();
//$columns["cb"] = "";
$columns["order_status"] = __("Status", 'jigoshop');
$columns["order_title"] = __("Order", 'jigoshop');
$columns["customer"] = __("Customer", 'jigoshop');
$columns["billing_address"] = __("Billing Address", 'jigoshop');
$columns["shipping_address"] = __("Shipping Address", 'jigoshop');
$columns["billing_and_shipping"] = __("Billing & Shipping", 'jigoshop');
$columns["total_cost"] = __("Order Cost", 'jigoshop');
return $columns;
}
add_filter('manage_edit-shop_order_columns', 'jigoshop_edit_order_columns');
add_action('manage_shop_order_posts_custom_column', 'jigoshop_custom_order_columns', 2);
function jigoshop_custom_order_columns($column) {
global $post;
$order = new jigoshop_order($post->ID);
switch ($column) {
case "order_status" :
echo sprintf( '%s', sanitize_title($order->status), __($order->status, 'jigoshop') );
break;
case "order_title" :
echo '' . sprintf(__('Order #%s', 'jigoshop'), $post->ID) . '';
echo '';
break;
case "customer" :
if ($order->user_id)
$user_info = get_userdata($order->user_id);
?>
order_subtotal); ?> | ||
order_shipping); ?> | ||
get_tax_class_for_display($tax_class) . ' (' . (float) $order->get_tax_rate($tax_class) . '%):'; ?> | get_tax_amount($tax_class) ?> | |
order_subtotal_inc_tax); ?> | ||
order_shipping); ?> | ||
get_tax_class_for_display($tax_class) . ' (' . (float) $order->get_tax_rate($tax_class) . '%):'; ?> | get_tax_amount($tax_class) ?> | |
get_tax_class_for_display($tax_class) . ' (' . (float) $order->get_tax_rate($tax_class) . '%):'; ?> | get_tax_amount($tax_class) ?> | |
order_discount); ?> | ||
order_total); ?> |