Dashboard coding, new icons

This commit is contained in:
Mike Jolley 2011-08-19 15:48:41 +01:00
parent 3a4effd48a
commit e286b11ff5
7 changed files with 486 additions and 713 deletions

View File

@ -1,6 +1,6 @@
<?php
/**
* Functions used for displaying the WooCommerce store dashboard
* Functions used for displaying the WooCommerce dashboard widgets
*
* @author WooThemes
* @category Admin
@ -8,134 +8,14 @@
*/
/**
* Function for showing the dashboard
*
* The dashboard shows widgets for things such as:
* - Products
* - Sales
* - Recent reviews
* - Inventory notifications
* - WooCommerce news and updates
* Right now widget hooks/content
*/
function woocommerce_dashboard() {
?>
<div class="wrap woocommerce">
<div class="icon32 woocommerce_icon"><br/></div>
<h2><?php _e('Dashboard', 'woothemes'); ?></h2>
<div id="woocommerce_dashboard">
add_action('right_now_content_table_end', 'woocommerce_content_right_now');
add_action('right_now_table_end', 'woocommerce_right_now');
<div id="dashboard-widgets" class="metabox-holder">
function woocommerce_content_right_now() {
<div class="postbox-container" style="width:49%;">
<div id="woocommerce_right_now" class="woocommerce_right_now postbox">
<h3><?php _e('Right Now', 'woothemes') ?></h3>
<div class="inside">
<div class="table table_content">
<p class="sub"><?php _e('Shop Content', 'woothemes'); ?></p>
<table>
<tbody>
<tr class="first">
<td class="first b"><a href="edit.php?post_type=product"><?php
$num_posts = wp_count_posts( 'product' );
$num = number_format_i18n( $num_posts->publish );
echo $num;
?></a></td>
<td class="t"><a href="edit.php?post_type=product"><?php _e('Products', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php
echo wp_count_terms('product_cat');
?></a></td>
<td class="t"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php _e('Product Categories', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php
echo wp_count_terms('product_tag');
?></a></td>
<td class="t"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php _e('Product Tag', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="admin.php?page=attributes"><?php
echo sizeof(woocommerce::$attribute_taxonomies);
?></a></td>
<td class="t"><a href="admin.php?page=attributes"><?php _e('Attribute taxonomies', 'woothemes'); ?></a></td>
</tr>
</tbody>
</table>
</div>
<div class="table table_discussion">
<p class="sub"><?php _e('Orders', 'woothemes'); ?></p>
<table>
<tbody>
<?php $woocommerce_orders = &new woocommerce_orders(); ?>
<tr class="first">
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=pending"><span class="total-count"><?php echo $woocommerce_orders->pending_count; ?></span></a></td>
<td class="last t"><a class="pending" href="edit.php?post_type=shop_order&shop_order_status=pending"><?php _e('Pending', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=on-hold"><span class="total-count"><?php echo $woocommerce_orders->on_hold_count; ?></span></a></td>
<td class="last t"><a class="onhold" href="edit.php?post_type=shop_order&shop_order_status=on-hold"><?php _e('On-Hold', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=processing"><span class="total-count"><?php echo $woocommerce_orders->processing_count; ?></span></a></td>
<td class="last t"><a class="processing" href="edit.php?post_type=shop_order&shop_order_status=processing"><?php _e('Processing', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=completed"><span class="total-count"><?php echo $woocommerce_orders->completed_count; ?></span></a></td>
<td class="last t"><a class="complete" href="edit.php?post_type=shop_order&shop_order_status=completed"><?php _e('Completed', 'woothemes'); ?></a></td>
</tr>
</tbody>
</table>
</div>
<div class="versions">
<p id="wp-version-message"><?php _e('You are using', 'woothemes'); ?> <strong>WooCommerce <?php echo WOOCOMMERCE_VERSION; ?></strong> <?php _e('and', 'woothemes'); ?> <strong><?php if (is_multisite()) echo 'WPMU'; else echo 'WP'; ?> <?php echo bloginfo('version'); ?></strong> <?php _e('running on PHP', 'woothemes'); ?> <?php if(function_exists('phpversion')) echo phpversion(); ?> (<?php echo $_SERVER['SERVER_SOFTWARE']; ?>). <?php if(function_exists('fsockopen')) echo '<span style="color:green">' . __('Your server supports fsockopen.', 'woothemes'). '</span>'; else echo '<span style="color:red">' . __('Your server does not support fsockopen.', 'woothemes'). '</span>'; ?></p>
</div>
<div class="clear"></div>
</div>
</div><!-- postbox end -->
<div class="postbox">
<h3 class="hndle" id="poststuff"><span><?php _e('Recent Orders', 'woothemes') ?></span></h3>
<div class="inside">
<?php
$args = array(
'numberposts' => 8,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'shop_order',
'post_status' => 'publish'
);
$orders = get_posts( $args );
if ($orders) :
echo '<ul class="recent-orders">';
foreach ($orders as $order) :
$this_order = &new woocommerce_order( $order->ID );
echo '
<li>
<span class="order-status '.sanitize_title($this_order->status).'">'.ucwords($this_order->status).'</span> <a href="'.admin_url('post.php?post='.$order->ID).'&action=edit">'.date_i18n('l jS \of F Y h:i:s A', strtotime($this_order->order_date)).'</a><br />
<small>'.sizeof($this_order->items).' '._n('item', 'items', sizeof($this_order->items), 'woothemes').' <span class="order-cost">'.__('Total: ', 'woothemes').woocommerce_price($this_order->order_total).'</span></small>
</li>';
endforeach;
echo '</ul>';
endif;
?>
</div>
</div><!-- postbox end -->
<?php if (get_option('woocommerce_manage_stock')=='yes') : ?>
<div class="postbox woocommerce_right_now">
<h3 class="hndle" id="poststuff"><span><?php _e('Stock Report', 'woothemes') ?></span></h3>
<div class="inside">
<?php
global $lowinstock, $outofstock;
$lowstockamount = get_option('woocommerce_notify_low_stock_amount');
if (!is_numeric($lowstockamount)) $lowstockamount = 1;
@ -178,75 +58,174 @@ function woocommerce_dashboard() {
if (sizeof($outofstock)==0) :
$outofstock[] = '<tr><td colspan="2">'.__('No products are out of stock.', 'woothemes').'</td></tr>';
endif;
?>
<div class="table table_content">
<p class="sub"><?php _e('Low Stock', 'woothemes'); ?></p>
</table>
<p class="sub woocommerce_sub"><?php _e('Shop Content', 'woothemes'); ?></p>
<table>
<tr>
<td class="first b"><a href="edit.php?post_type=product"><?php
$num_posts = wp_count_posts( 'product' );
$num = number_format_i18n( $num_posts->publish );
echo $num;
?></a></td>
<td class="t"><a href="edit.php?post_type=product"><?php _e('Products', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php
echo wp_count_terms('product_cat');
?></a></td>
<td class="t"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php _e('Product Categories', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php
echo wp_count_terms('product_tag');
?></a></td>
<td class="t"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php _e('Product Tags', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="admin.php?page=attributes"><?php
echo sizeof(woocommerce::$attribute_taxonomies);
?></a></td>
<td class="t"><a href="admin.php?page=attributes"><?php _e('Attribute taxonomies', 'woothemes'); ?></a></td>
</tr>
</table>
<p class="sub woocommerce_sub"><?php _e('Low in stock', 'woothemes'); ?></p>
<table>
<tbody>
<?php echo implode('', $lowinstock); ?>
</tbody>
</table>
</div>
<div class="table table_discussion">
<p class="sub"><?php _e('Out of Stock/Backorders', 'woothemes'); ?></p>
<table>
<tbody>
<?php echo implode('', $outofstock); ?>
</tbody>
</table>
</div>
<div class="clear"></div>
</div>
</div><!-- postbox end -->
<?php endif; ?>
</div>
<div class="postbox-container" style="width:49%; float:right; overflow:hidden;">
<?php
}
function woocommerce_right_now() {
global $outofstock;
$woocommerce_orders = &new woocommerce_orders();
?>
</table>
<p class="sub woocommerce_sub"><?php _e('Orders', 'woothemes'); ?></p>
<table>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=pending"><span class="total-count"><?php echo $woocommerce_orders->pending_count; ?></span></a></td>
<td class="last t"><a class="pending" href="edit.php?post_type=shop_order&shop_order_status=pending"><?php _e('Pending', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=on-hold"><span class="total-count"><?php echo $woocommerce_orders->on_hold_count; ?></span></a></td>
<td class="last t"><a class="onhold" href="edit.php?post_type=shop_order&shop_order_status=on-hold"><?php _e('On-Hold', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=processing"><span class="total-count"><?php echo $woocommerce_orders->processing_count; ?></span></a></td>
<td class="last t"><a class="processing" href="edit.php?post_type=shop_order&shop_order_status=processing"><?php _e('Processing', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=completed"><span class="total-count"><?php echo $woocommerce_orders->completed_count; ?></span></a></td>
<td class="last t"><a class="complete" href="edit.php?post_type=shop_order&shop_order_status=completed"><?php _e('Completed', 'woothemes'); ?></a></td>
</tr>
</table>
<p class="sub woocommerce_sub"><?php _e('Out of Stock/Backorders', 'woothemes'); ?></p>
<table>
<?php echo implode('', $outofstock); ?>
<?php
}
/**
* Dashboard Widgets - init
*/
add_action('wp_dashboard_setup', 'woocommerce_init_dashboard_widgets' );
function woocommerce_init_dashboard_widgets() {
global $current_month_offset;
$current_month_offset = (int) date('m');
if (isset($_GET['month'])) $current_month_offset = (int) $_GET['month'];
?>
<div class="postbox stats" id="woocommerce-stats">
<h3 class="hndle" id="poststuff">
<?php if ($current_month_offset!=date('m')) : ?><a href="admin.php?page=woocommerce&amp;month=<?php echo $current_month_offset+1; ?>" class="next">Next Month &rarr;</a><?php endif; ?>
<a href="admin.php?page=woocommerce&amp;month=<?php echo $current_month_offset-1; ?>" class="previous">&larr; Previous Month</a>
<span><?php _e('Monthly Sales', 'woothemes') ?></span></h3>
<div class="inside">
<div id="placeholder" style="width:100%; height:300px; position:relative;"></div>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(function(){
$sales_heading = '';
function weekendAreas(axes) {
var markings = [];
var d = new Date(axes.xaxis.min);
// go to the first Saturday
d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))
d.setUTCSeconds(0);
d.setUTCMinutes(0);
d.setUTCHours(0);
var i = d.getTime();
do {
// when we don't set yaxis, the rectangle automatically
// extends to infinity upwards and downwards
markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } });
i += 7 * 24 * 60 * 60 * 1000;
} while (i < axes.xaxis.max);
if ($current_month_offset!=date('m')) :
$sales_heading .= '<a href="index.php?month='.($current_month_offset+1).'" class="next">'.__('Next Month &rarr;', 'woo themes').'</a>';
endif;
return markings;
}
$sales_heading .= '<a href="index.php?month='.($current_month_offset-1).'" class="previous">'.__('&larr; Previous Month', 'woo themes').'</a><span>'.__('Monthly Sales', 'woothemes').'</span>';
<?php
wp_add_dashboard_widget('woocommmerce_dashboard_sales', $sales_heading, 'woocommmerce_dashboard_sales');
wp_add_dashboard_widget('woocommmerce_dashboard_recent_orders', __('WooCommerce recent orders', 'woothemes'), 'woocommmerce_dashboard_recent_orders');
wp_add_dashboard_widget('woocommmerce_dashboard_recent_reviews', __('WooCommerce recent reviews', 'woothemes'), 'woocommmerce_dashboard_recent_reviews');
}
function orders_this_month( $where = '' ) {
/**
* Recent orders widget
*/
function woocommmerce_dashboard_recent_orders() {
$args = array(
'numberposts' => 8,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'shop_order',
'post_status' => 'publish'
);
$orders = get_posts( $args );
if ($orders) :
echo '<ul class="recent-orders">';
foreach ($orders as $order) :
$this_order = &new woocommerce_order( $order->ID );
echo '
<li>
<span class="order-status '.sanitize_title($this_order->status).'">'.ucwords($this_order->status).'</span> <a href="'.admin_url('post.php?post='.$order->ID).'&action=edit">'.date_i18n('l jS \of F Y h:i:s A', strtotime($this_order->order_date)).'</a><br />
<small>'.sizeof($this_order->items).' '._n('item', 'items', sizeof($this_order->items), 'woothemes').' <span class="order-cost">'.__('Total: ', 'woothemes').woocommerce_price($this_order->order_total).'</span></small>
</li>';
endforeach;
echo '</ul>';
endif;
}
/**
* Recent reviews widget
*/
function woocommmerce_dashboard_recent_reviews() {
global $wpdb;
$comments = $wpdb->get_results("SELECT *, SUBSTRING(comment_content,1,100) AS comment_excerpt
FROM $wpdb->comments
LEFT JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
WHERE comment_approved = '1'
AND comment_type = ''
AND post_password = ''
AND post_type = 'product'
ORDER BY comment_date_gmt DESC
LIMIT 5" );
if ($comments) :
echo '<ul>';
foreach ($comments as $comment) :
echo '<li>';
echo get_avatar($comment->comment_author, '32');
$rating = get_comment_meta( $comment->comment_ID, 'rating', true );
echo '<div class="star-rating" title="'.$rating.'">
<span style="width:'.($rating*16).'px">'.$rating.' '.__('out of 5', 'woothemes').'</span></div>';
echo '<h4 class="meta"><a href="'.get_permalink($comment->ID).'#comment-'.$comment->comment_ID .'">'.$comment->post_title.'</a> reviewed by ' .strip_tags($comment->comment_author) .'</h4>';
echo '<blockquote>'.strip_tags($comment->comment_excerpt).' [...]</blockquote></li>';
endforeach;
echo '</ul>';
else :
echo '<p>'.__('There are no product reviews yet.', 'woothemes').'</p>';
endif;
}
/**
* Orders this month filter function
*/
function orders_this_month( $where = '' ) {
global $current_month_offset;
$month = $current_month_offset;
@ -262,7 +241,28 @@ function woocommerce_dashboard() {
$where .= " AND post_date < '$before'";
return $where;
}
}
/**
* Sales widget
*/
function woocommmerce_dashboard_sales() {
?><div id="placeholder" style="width:100%; height:300px; position:relative;"></div><?php
}
/**
* Sales widget javascript
*/
function woocommmerce_dashboard_sales_js() {
$screen = get_current_screen();
if (!$screen || $screen->id!=='dashboard') return;
global $current_month_offset;
// Get orders to display in widget
add_filter( 'posts_where', 'orders_this_month' );
$args = array(
@ -327,166 +327,33 @@ function woocommerce_dashboard() {
endif;
remove_filter( 'posts_where', 'orders_this_month' );
?>
var d = [
<?php
$values = array();
foreach ($order_counts as $key => $value) $values[] = "[$key, $value]";
echo implode(',', $values);
?>
];
for (var i = 0; i < d.length; ++i) d[i][0] += 60 * 60 * 1000;
var d2 = [
<?php
$values = array();
foreach ($order_amounts as $key => $value) $values[] = "[$key, $value]";
echo implode(',', $values);
?>
];
for (var i = 0; i < d2.length; ++i) d2[i][0] += 60 * 60 * 1000;
var plot = jQuery.plot(jQuery("#placeholder"), [ { label: "Number of sales", data: d }, { label: "Sales amount", data: d2, yaxis: 2 } ], {
series: {
lines: { show: true },
points: { show: true }
},
grid: {
show: true,
aboveData: false,
color: '#ccc',
backgroundColor: '#fff',
borderWidth: 2,
borderColor: '#ccc',
clickable: false,
hoverable: true,
markings: weekendAreas
},
xaxis: {
mode: "time",
timeformat: "%d %b",
tickLength: 1,
minTickSize: [1, "day"]
},
yaxes: [ { min: 0, tickSize: 1, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
colors: ["#21759B", "#ed8432"]
});
function showTooltip(x, y, contents) {
jQuery('<div id="tooltip">' + contents + '</div>').css( {
position: 'absolute',
display: 'none',
top: y + 5,
left: x + 5,
border: '1px solid #fdd',
padding: '2px',
'background-color': '#fee',
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
var previousPoint = null;
jQuery("#placeholder").bind("plothover", function (event, pos, item) {
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
jQuery("#tooltip").remove();
if (item.series.label=="Number of sales") {
var y = item.datapoint[1];
showTooltip(item.pageX, item.pageY, item.series.label + " - " + y);
} else {
var y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.series.label + " - <?php echo get_woocommerce_currency_symbol(); ?>" + y);
}
}
}
else {
jQuery("#tooltip").remove();
previousPoint = null;
}
});
});
/* ]]> */
</script>
</div>
</div><!-- postbox end -->
<div class="postbox">
<h3 class="hndle" id="poststuff"><span><?php _e('Recent Product Reviews', 'woothemes') ?></span></h3>
<div class="inside woocommerce-reviews-widget">
<?php
global $wpdb;
$comments = $wpdb->get_results("SELECT *, SUBSTRING(comment_content,1,100) AS comment_excerpt
FROM $wpdb->comments
LEFT JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
WHERE comment_approved = '1'
AND comment_type = ''
AND post_password = ''
AND post_type = 'product'
ORDER BY comment_date_gmt DESC
LIMIT 5" );
if ($comments) :
echo '<ul>';
foreach ($comments as $comment) :
echo '<li>';
echo get_avatar($comment->comment_author, '32');
$rating = get_comment_meta( $comment->comment_ID, 'rating', true );
echo '<div class="star-rating" title="'.$rating.'">
<span style="width:'.($rating*16).'px">'.$rating.' '.__('out of 5', 'woothemes').'</span></div>';
echo '<h4 class="meta"><a href="'.get_permalink($comment->ID).'#comment-'.$comment->comment_ID .'">'.$comment->post_title.'</a> reviewed by ' .strip_tags($comment->comment_author) .'</h4>';
echo '<blockquote>'.strip_tags($comment->comment_excerpt).' [...]</blockquote></li>';
/* Script variables */
$params = array(
'currency_symbol' => get_woocommerce_currency_symbol()
);
$order_counts_array = array();
foreach ($order_counts as $key => $count) :
$order_counts_array[] = array($key, $count);
endforeach;
echo '</ul>';
else :
echo '<p>'.__('There are no product reviews yet.', 'woothemes').'</p>';
endif;
?>
</div>
</div><!-- postbox end -->
<div class="postbox">
<h3 class="hndle" id="poststuff"><span><?php _e('Useful Links', 'woothemes') ?></span></h3>
<div class="inside woocommerce-links-widget">
<ul class="links">
<li><a href="http://www.woothemes.com/"><?php _e('WooThemes', 'woothemes'); ?></a> &ndash; <?php _e('Premium WordPress Themes', 'woothemes'); ?></li>
<li><a href="https://github.com/mikejolley/woocommerce"><?php _e('WooCommerce on Github', 'woothemes'); ?></a> &ndash; <?php _e('Help extend and develop WooCommerce.', 'woothemes'); ?></li>
<li><a href="http://wordpress.org/extend/plugins/woocommerce/"><?php _e('WooCommerce on WordPress.org', 'woothemes'); ?></a> &ndash; <?php _e('Leave us a rating if you like WooCommerce!', 'woothemes'); ?></li>
</ul>
<div class="social">
$order_amounts_array = array();
foreach ($order_amounts as $key => $amount) :
$order_amounts_array[] = array($key, $amount);
endforeach;
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwoocommerce.com&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=segoe+ui&amp;height=24" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:24px;" allowTransparency="true"></iframe>
$order_data = array( 'order_counts' => $order_counts_array, 'order_amounts' => $order_amounts_array );
<p><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://woocommerce.com/" data-text="WooCommerce" data-count="horizontal" data-via="woocommerce" data-related="WooThemes:Creators">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>
$params['order_data'] = json_encode($order_data);
<p><g:plusone size="medium" href="http://woocommerce.com/"></g:plusone><script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang: 'en-GB'}</script></p>
// Queue
wp_register_script( 'woocommerce_dashboard_sales', woocommerce::plugin_url() . '/assets/js/woocommerce_dashboard_sales.js', 'jquery', '1.0' );
wp_localize_script( 'woocommerce_dashboard_sales', 'params', $params );
wp_print_scripts('woocommerce_dashboard_sales');
</div>
<div class="clear"></div>
</div>
</div><!-- postbox end -->
</div>
</div>
</div>
</div>
<?php
}
add_action('admin_footer', 'woocommmerce_dashboard_sales_js');

View File

@ -25,17 +25,14 @@ add_action('admin_init', 'woocommerce_admin_init');
* Admin Menus
*
* Sets up the admin menus in wordpress.
*
* @since 1.0
*/
function woocommerce_admin_menu() {
global $menu;
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator' );
add_menu_page(__('WooCommerce'), __('WooCommerce'), 'manage_woocommerce', 'woocommerce' , 'woocommerce_dashboard', woocommerce::plugin_url() . '/assets/images/icons/menu_icons.png', 56);
add_submenu_page('woocommerce', __('Dashboard', 'woothemes'), __('Dashboard', 'woothemes'), 'manage_woocommerce', 'woocommerce', 'woocommerce_dashboard');
add_submenu_page('woocommerce', __('General Settings', 'woothemes'), __('Settings', 'woothemes') , 'manage_woocommerce', 'woocommerce-settings', 'woocommerce_settings');
add_menu_page(__('WooCommerce'), __('WooCommerce'), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings', woocommerce::plugin_url() . '/assets/images/icons/menu_icons.png', 56);
add_submenu_page('woocommerce', __('General Settings', 'woothemes'), __('Settings', 'woothemes') , 'manage_woocommerce', 'woocommerce', 'woocommerce_settings');
add_submenu_page('edit.php?post_type=product', __('Attributes', 'woothemes'), __('Attributes', 'woothemes'), 'manage_woocommerce', 'attributes', 'woocommerce_attributes');
}

View File

@ -328,20 +328,24 @@ table.wp-list-table .column-featured, table.wp-list-table .column-sellable, tabl
text-align: center !important;
}
/* Dashboard */
#woocommerce_dashboard {
padding: 0 5px;
#dashboard_right_now p.woocommerce_sub {
position: static;
top: auto;
left: auto;
margin: 15px 5px 0;
padding: 0 0 5px 0;
border-bottom: #ECECEC 1px solid;
}
#woocommerce_dashboard div.postbox div.inside {
margin: 10px;
position: relative;
#dashboard_right_now .onhold {
color: red;
}
#woocommerce_dashboard div.postbox h3 {
cursor: default !important;
#dashboard_right_now .pending {
color: #e66f00;
}
#woocommerce_dashboard div.postbox a {
text-decoration: none;
#dashboard_right_now .complete {
color: green;
}
.stats h3 a {
#woocommmerce_dashboard_sales h3 a {
float: right;
margin-left: 8px;
}
@ -376,131 +380,53 @@ ul.recent-orders li .pending {
ul.recent-orders li .refunded, ul.recent-orders li .cancelled {
color: #999;
}
.woocommerce_right_now p.sub, .woocommerce_right_now .table, .woocommerce_right_now .versions {
margin: -12px;
}
.woocommerce_right_now .inside {
font-size: 12px;
padding-top: 20px;
}
.woocommerce_right_now p.sub {
font-style: italic;
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
padding: 5px 10px 15px;
color: #777;
font-size: 13px;
position: absolute;
top: -17px;
left: 15px;
}
.woocommerce_right_now .table {
margin: 0 -9px;
padding: 0 10px;
position: relative;
}
.woocommerce_right_now .table_content {
float: left;
border-top: #ececec 1px solid;
width: 45%;
}
.woocommerce_right_now .table_discussion {
float: right;
border-top: #ececec 1px solid;
width: 45%;
}
.woocommerce_right_now table td {
padding: 3px 0;
white-space: nowrap;
}
.woocommerce_right_now table tr.first td {
border-top: none;
}
.woocommerce_right_now td.b {
padding-right: 6px;
text-align: right;
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
font-size: 14px;
width: 1%;
}
.woocommerce_right_now td.b a {
font-size: 18px;
}
.woocommerce_right_now td.b a:hover {
color: #d54e21;
}
.woocommerce_right_now .t {
font-size: 12px;
padding-right: 12px;
padding-top: 6px;
color: #777;
}
.woocommerce_right_now .t a {
white-space: nowrap;
}
.woocommerce_right_now .onhold {
color: red;
}
.woocommerce_right_now .pending {
color: #e66f00;
}
.woocommerce_right_now .complete {
color: green;
}
.woocommerce_right_now .versions {
padding: 4px 15px 12px;
clear: both;
}
.woocommerce-rss-widget ul li, .woocommerce-links-widget ul li {
line-height: 1.5em;
margin-bottom: 12px;
}
.woocommerce-links-widget ul.links {
#woocommmerce_dashboard_useful_links ul.links {
float: left;
width: 49%;
}
.woocommerce-links-widget .social {
#woocommmerce_dashboard_useful_links .social {
float: right;
width: 49%;
}
.woocommerce-links-widget .social h4 {
#woocommmerce_dashboard_useful_links .social h4 {
color: #999;
}
.woocommerce-links-widget .social h4.first {
#woocommmerce_dashboard_useful_links .social h4.first {
margin-top: 0;
}
.woocommerce-links-widget .social img {
#woocommmerce_dashboard_useful_links .social img {
width: 49%;
}
.woocommerce-links-widget .social p {
#woocommmerce_dashboard_useful_links .social p {
color: #ccc;
line-height: 1.5em;
font-style: italic;
}
.woocommerce-reviews-widget li {
#woocommmerce_dashboard_recent_reviews li {
line-height: 1.5em;
margin-bottom: 12px;
}
.woocommerce-reviews-widget h4.meta {
#woocommmerce_dashboard_recent_reviews h4.meta {
line-height: 1.4;
margin: -0.2em 0 0 0;
font-weight: normal;
color: #999;
}
.woocommerce-reviews-widget blockquote {
#woocommmerce_dashboard_recent_reviews blockquote {
padding: 0;
margin: 0;
}
.woocommerce-reviews-widget .avatar {
#woocommmerce_dashboard_recent_reviews .avatar {
float: left;
margin: 0 10px 5px 0;
}
.woocommerce-reviews-widget .star-rating {
#woocommmerce_dashboard_recent_reviews .star-rating {
float: right;
width: 80px;
height: 16px;
background: url(../images/star.png) repeat-x left 0;
}
.woocommerce-reviews-widget .star-rating span {
#woocommmerce_dashboard_recent_reviews .star-rating span {
background: url(../images/star.png) repeat-x left -32px;
height: 0;
padding-top: 16px;
@ -552,25 +478,6 @@ p.taxrow label input {
.woocommerce table.widefat table.coupon_rows tbody td input.text {
width: 95px;
}
a.tips {
height: 16px;
width: 16px;
margin: 4px -8px 0 0;
float: right;
background: url(../images/tip.png) no-repeat top left;
}
#easyTooltip {
padding: 8px;
border: 3px solid #b9e3f0;
background: #E3F4F9;
font-size: 12px;
width: 400px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
-o-border-radius: 8px;
-khtml-border-radius: 8px;
border-radius: 8px;
}
.woocommerce #tabs-wrap table a.remove {
margin-left: 4px;
}

View File

@ -360,21 +360,25 @@ table.wp-list-table .column-featured, table.wp-list-table .column-sellable, tabl
}
/* Dashboard */
#woocommerce_dashboard {
padding: 0 5px;
#dashboard_right_now p.woocommerce_sub {
position: static;
top: auto;
left: auto;
margin: 15px 5px 0;
padding: 0 0 5px 0;
border-bottom: #ECECEC 1px solid;
}
#woocommerce_dashboard div.postbox div.inside {
margin: 10px;
position: relative;
#dashboard_right_now .onhold {
color: red;
}
#woocommerce_dashboard div.postbox h3 {
cursor: default !important;
#dashboard_right_now .pending {
color: #e66f00;
}
#woocommerce_dashboard div.postbox a {
text-decoration: none;
#dashboard_right_now .complete {
color: green;
}
.stats {
#woocommmerce_dashboard_sales {
h3 a {
float: right;
margin-left: 8px;
@ -415,88 +419,7 @@ ul.recent-orders {
}
}
.woocommerce_right_now p.sub,
.woocommerce_right_now .table, .woocommerce_right_now .versions {
margin: -12px;
}
.woocommerce_right_now .inside {
font-size: 12px;
padding-top: 20px;
}
.woocommerce_right_now p.sub {
font-style: italic;
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
padding: 5px 10px 15px;
color: #777;
font-size: 13px;
position: absolute;
top: -17px;
left: 15px;
}
.woocommerce_right_now .table {
margin: 0 -9px;
padding: 0 10px;
position: relative;
}
.woocommerce_right_now .table_content {
float: left;
border-top: #ececec 1px solid;
width: 45%;
}
.woocommerce_right_now .table_discussion {
float: right;
border-top: #ececec 1px solid;
width: 45%;
}
.woocommerce_right_now table td {
padding: 3px 0;
white-space: nowrap;
}
.woocommerce_right_now table tr.first td {
border-top: none;
}
.woocommerce_right_now td.b {
padding-right: 6px;
text-align: right;
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
font-size: 14px;
width: 1%;
}
.woocommerce_right_now td.b a {
font-size: 18px;
}
.woocommerce_right_now td.b a:hover {
color: #d54e21;
}
.woocommerce_right_now .t {
font-size: 12px;
padding-right: 12px;
padding-top: 6px;
color: #777;
}
.woocommerce_right_now .t a {
white-space: nowrap;
}
.woocommerce_right_now .onhold {
color: red;
}
.woocommerce_right_now .pending {
color: #e66f00;
}
.woocommerce_right_now .complete {
color: green;
}
.woocommerce_right_now .versions {
padding: 4px 15px 12px;
clear: both;
}
.woocommerce-rss-widget ul li, .woocommerce-links-widget ul li {
line-height: 1.5em;
margin-bottom: 12px;
}
.woocommerce-links-widget {
#woocommmerce_dashboard_useful_links {
ul.links {
float: left;
width: 49%;
@ -521,7 +444,7 @@ ul.recent-orders {
}
}
.woocommerce-reviews-widget {
#woocommmerce_dashboard_recent_reviews {
li {
line-height: 1.5em;
margin-bottom: 12px;
@ -610,25 +533,7 @@ p.taxrow label {
}
a.tips {
height: 16px;
width: 16px;
margin: 4px -8px 0 0;
float: right;
background: url(../images/tip.png) no-repeat top left;
}
#easyTooltip {
padding:8px;
border:3px solid #b9e3f0;
background:#E3F4F9;
font-size: 12px;
width:400px;
-moz-border-radius:8px;
-webkit-border-radius:8px;
-o-border-radius:8px;
-khtml-border-radius:8px;
border-radius:8px;
}
.woocommerce #tabs-wrap table a.remove {
margin-left: 4px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,97 @@
jQuery(function(){
function weekendAreas(axes) {
var markings = [];
var d = new Date(axes.xaxis.min);
// go to the first Saturday
d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))
d.setUTCSeconds(0);
d.setUTCMinutes(0);
d.setUTCHours(0);
var i = d.getTime();
do {
// when we don't set yaxis, the rectangle automatically
// extends to infinity upwards and downwards
markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } });
i += 7 * 24 * 60 * 60 * 1000;
} while (i < axes.xaxis.max);
return markings;
}
var order_data = jQuery.parseJSON( params.order_data.replace(/&quot;/g, '"') );
var d = order_data.order_counts;
var d2 = order_data.order_amounts;
for (var i = 0; i < d.length; ++i) d[i][0] += 60 * 60 * 1000;
for (var i = 0; i < d2.length; ++i) d2[i][0] += 60 * 60 * 1000;
var plot = jQuery.plot(jQuery("#placeholder"), [ { label: "Number of sales", data: d }, { label: "Sales amount", data: d2, yaxis: 2 } ], {
series: {
lines: { show: true },
points: { show: true }
},
grid: {
show: true,
aboveData: false,
color: '#ccc',
backgroundColor: '#fff',
borderWidth: 2,
borderColor: '#ccc',
clickable: false,
hoverable: true,
markings: weekendAreas
},
xaxis: {
mode: "time",
timeformat: "%d %b",
tickLength: 1,
minTickSize: [1, "day"]
},
yaxes: [ { min: 0, tickSize: 1, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
colors: ["#21759B", "#ed8432"]
});
function showTooltip(x, y, contents) {
jQuery('<div id="tooltip">' + contents + '</div>').css( {
position: 'absolute',
display: 'none',
top: y + 5,
left: x + 5,
border: '1px solid #fdd',
padding: '2px',
'background-color': '#fee',
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
var previousPoint = null;
jQuery("#placeholder").bind("plothover", function (event, pos, item) {
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
jQuery("#tooltip").remove();
if (item.series.label=="Number of sales") {
var y = item.datapoint[1];
showTooltip(item.pageX, item.pageY, item.series.label + " - " + y);
} else {
var y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.series.label + " - " + params.currency_symbol + y);
}
}
}
else {
jQuery("#tooltip").remove();
previousPoint = null;
}
});
});

View File

@ -200,7 +200,7 @@ class woocommerce_product {
/** Get the title of the post */
function get_title () {
$this->get_post_data();
return apply_filters('woocommerce_product_title', $this->post->post_title, $this);
return apply_filters('woocommerce_product_title', get_the_title($this->post->ID), $this);
}