Better order admin and fixes
This commit is contained in:
parent
8c4e69f707
commit
30e2b33c1d
|
@ -189,18 +189,12 @@ function woocommerce_edit_order_columns($columns){
|
|||
$columns = array();
|
||||
|
||||
$columns["cb"] = "<input type=\"checkbox\" />";
|
||||
|
||||
$columns["order_status"] = __("Status", 'woothemes');
|
||||
|
||||
$columns["order_title"] = __("Order", 'woothemes');
|
||||
|
||||
$columns["customer"] = __("Customer", 'woothemes');
|
||||
$columns["billing_address"] = __("Billing Address", 'woothemes');
|
||||
$columns["shipping_address"] = __("Shipping Address", 'woothemes');
|
||||
|
||||
$columns["billing_and_shipping"] = __("Billing & Shipping", 'woothemes');
|
||||
|
||||
$columns["total_cost"] = __("Order Cost", 'woothemes');
|
||||
$columns["billing_address"] = __("Billing", 'woothemes');
|
||||
$columns["shipping_address"] = __("Shipping", 'woothemes');
|
||||
$columns["total_cost"] = __("Order Total", 'woothemes');
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
@ -210,6 +204,7 @@ function woocommerce_custom_order_columns($column) {
|
|||
|
||||
global $post;
|
||||
$order = &new woocommerce_order( $post->ID );
|
||||
|
||||
switch ($column) {
|
||||
case "order_status" :
|
||||
|
||||
|
@ -218,44 +213,46 @@ function woocommerce_custom_order_columns($column) {
|
|||
break;
|
||||
case "order_title" :
|
||||
|
||||
echo '<a href="'.admin_url('post.php?post='.$post->ID.'&action=edit').'">'.sprintf( __('Order #%s', 'woothemes'), $post->ID ).'</a>';
|
||||
echo '<a href="'.admin_url('post.php?post='.$post->ID.'&action=edit').'">'.sprintf( __('Order #%s', 'woothemes'), $post->ID ).'</a> ';
|
||||
|
||||
echo '<time title="'.date_i18n('c', strtotime($post->post_date)).'">'.date_i18n('F j, Y, g:i a', strtotime($post->post_date)).'</time>';
|
||||
|
||||
break;
|
||||
case "customer" :
|
||||
|
||||
if ($order->user_id) $user_info = get_userdata($order->user_id);
|
||||
|
||||
?>
|
||||
<dl>
|
||||
<dt><?php _e('User:', 'woothemes'); ?></dt>
|
||||
<dd><?php
|
||||
if (isset($user_info) && $user_info) :
|
||||
|
||||
echo '<a href="user-edit.php?user_id='.$user_info->ID.'">#'.$user_info->ID.' – <strong>';
|
||||
|
||||
if ($user_info->first_name || $user_info->last_name) echo $user_info->first_name.' '.$user_info->last_name;
|
||||
else echo $user_info->display_name;
|
||||
|
||||
echo '</strong></a>';
|
||||
|
||||
else :
|
||||
_e('Guest', 'woothemes');
|
||||
endif;
|
||||
?></dd>
|
||||
<?php if ($order->billing_email) : ?><dt><?php _e('Billing Email:', 'woothemes'); ?></dt>
|
||||
<dd><a href="mailto:<?php echo $order->billing_email; ?>"><?php echo $order->billing_email; ?></a></dd><?php endif; ?>
|
||||
<?php if ($order->billing_phone) : ?><dt><?php _e('Billing Tel:', 'woothemes'); ?></dt>
|
||||
<dd><?php echo $order->billing_phone; ?></dd><?php endif; ?>
|
||||
</dl>
|
||||
<?php
|
||||
if ($order->user_id) $user_info = get_userdata($order->user_id);
|
||||
|
||||
if (isset($user_info) && $user_info) :
|
||||
|
||||
echo '<a href="user-edit.php?user_id='.$user_info->ID.'">';
|
||||
|
||||
if ($user_info->first_name || $user_info->last_name) echo $user_info->first_name.' '.$user_info->last_name;
|
||||
else echo $user_info->display_name;
|
||||
|
||||
echo '</a>';
|
||||
|
||||
else :
|
||||
_e('Guest', 'woothemes');
|
||||
endif;
|
||||
|
||||
if ($order->billing_email) :
|
||||
echo '<small class="meta">'.__('Email: ', 'woothemes').'<a href="mailto:'.$order->billing_email.'">'.$order->billing_email.'</a></small>';
|
||||
endif;
|
||||
if ($order->billing_phone) :
|
||||
echo '<small class="meta">'.__('Tel: ', 'woothemes'). $order->billing_phone . '</small>';
|
||||
endif;
|
||||
|
||||
break;
|
||||
case "billing_address" :
|
||||
echo '<strong>'.$order->billing_first_name . ' ' . $order->billing_last_name;
|
||||
if ($order->billing_company) echo ', '.$order->billing_company;
|
||||
echo '</strong><br/>';
|
||||
echo '<a target="_blank" href="http://maps.google.co.uk/maps?&q='.urlencode($order->formatted_billing_address).'&z=16">'.$order->formatted_billing_address.'</a>';
|
||||
|
||||
if ($order->payment_method) :
|
||||
echo '<small class="meta">' . __('Paid via ', 'woo themes') . $order->payment_method . '</small>';
|
||||
endif;
|
||||
|
||||
break;
|
||||
case "shipping_address" :
|
||||
if ($order->formatted_shipping_address) :
|
||||
|
@ -266,42 +263,13 @@ function woocommerce_custom_order_columns($column) {
|
|||
else :
|
||||
echo '–';
|
||||
endif;
|
||||
break;
|
||||
case "billing_and_shipping" :
|
||||
?>
|
||||
<dl>
|
||||
<dt><?php _e('Payment:', 'woothemes'); ?></dt>
|
||||
<dd><?php echo $order->payment_method; ?></dd>
|
||||
<dt><?php _e('Shipping:', 'woothemes'); ?></dt>
|
||||
<dd><?php echo $order->shipping_method; ?></dd>
|
||||
</dl>
|
||||
<?php
|
||||
|
||||
if ($order->shipping_metho) :
|
||||
echo '<small class="meta">' . __('Shipped via ', 'woothemes') . $order->shipping_method . '</small>';
|
||||
endif;
|
||||
break;
|
||||
case "total_cost" :
|
||||
?>
|
||||
<table cellpadding="0" cellspacing="0" class="cost">
|
||||
<tr>
|
||||
<th><?php _e('Subtotal', 'woothemes'); ?></th>
|
||||
<td><?php echo woocommerce_price($order->order_subtotal); ?></td>
|
||||
</tr>
|
||||
<?php if ($order->order_shipping>0) : ?><tr>
|
||||
<th><?php _e('Shipping', 'woothemes'); ?></th>
|
||||
<td><?php echo woocommerce_price($order->order_shipping); ?></td>
|
||||
</tr><?php endif; ?>
|
||||
<?php if ($order->get_total_tax()>0) : ?><tr>
|
||||
<th><?php _e('Tax', 'woothemes'); ?></th>
|
||||
<td><?php echo woocommerce_price($order->get_total_tax()); ?></td>
|
||||
</tr><?php endif; ?>
|
||||
<?php if ($order->order_discount>0) : ?><tr>
|
||||
<th><?php _e('Discount', 'woothemes'); ?></th>
|
||||
<td><?php echo woocommerce_price($order->order_discount); ?></td>
|
||||
</tr><?php endif; ?>
|
||||
<tr>
|
||||
<th><?php _e('Total', 'woothemes'); ?></th>
|
||||
<td><?php echo woocommerce_price($order->order_total); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
echo woocommerce_price($order->order_total);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,15 +144,12 @@ function woocommerce_order_items_meta_box($post) {
|
|||
<thead>
|
||||
<tr>
|
||||
<th class="product-id" width="1%"><?php _e('ID', 'woothemes'); ?></th>
|
||||
<th class="variation-id" width="1%"><?php _e('Variation ID', 'woothemes'); ?></th>
|
||||
<th class="product-sku" width="1%"><?php _e('SKU', 'woothemes'); ?></th>
|
||||
<th class="name"><?php _e('Name', 'woothemes'); ?></th>
|
||||
<th class="variation"><?php _e('Variation', 'woothemes'); ?></th>
|
||||
<th class="meta"><?php _e('Order Item Meta', 'woothemes'); ?></th>
|
||||
<th class="meta" width="1%"><?php _e('Item Meta', 'woothemes'); ?></th>
|
||||
<?php do_action('woocommerce_admin_order_item_headers'); ?>
|
||||
<th class="quantity" style="width:72px"><?php _e('Quantity', 'woothemes'); ?></th>
|
||||
<th class="cost" style="width:72px"><?php _e('Cost', 'woothemes'); ?></th>
|
||||
<th class="tax" style="width:72px"><?php _e('Tax Rate', 'woothemes'); ?></th>
|
||||
<th class="quantity"><?php _e('Quantity', 'woothemes'); ?></th>
|
||||
<th class="cost"><?php _e('Cost', 'woothemes'); ?></th>
|
||||
<th class="tax"><?php _e('Tax Rate', 'woothemes'); ?></th>
|
||||
<th class="center" width="1%"><?php _e('Remove', 'woothemes'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -168,17 +165,21 @@ function woocommerce_order_items_meta_box($post) {
|
|||
|
||||
?>
|
||||
<tr class="item" rel="<?php echo $loop; ?>">
|
||||
<td class="product-id"><?php echo $item['id']; ?></td>
|
||||
<td class="variation-id"><?php if ($item['variation_id']) echo $item['variation_id']; else echo '-'; ?></td>
|
||||
<td class="product-sku"><?php if ($_product->sku) echo $_product->sku; else echo '-'; ?></td>
|
||||
<td class="name"><a href="<?php echo admin_url('post.php?post='. $_product->id .'&action=edit'); ?>"><?php echo $item['name']; ?></a></td>
|
||||
<td class="variation"><?php
|
||||
if (isset($_product->variation_data)) :
|
||||
echo woocommerce_get_formatted_variation( $_product->variation_data, true );
|
||||
else :
|
||||
echo '-';
|
||||
endif;
|
||||
?></td>
|
||||
<td class="product-id">
|
||||
<img class="tips" tip="<?php
|
||||
echo '<strong>'.__('Product ID:', 'woothemes').'</strong> '. $item['id'];
|
||||
echo '<br/><strong>'.__('Variation ID:', 'woothemes').'</strong> '; if ($item['variation_id']) echo $item['variation_id']; else echo '-';
|
||||
echo '<br/><strong>'.__('Product SKU:', 'woothemes').'</strong> '; if ($_product->sku) echo $_product->sku; else echo '-';
|
||||
?>" src="<?php echo woocommerce::plugin_url(); ?>/assets/images/tip.png" />
|
||||
</td>
|
||||
<td class="name">
|
||||
<a href="<?php echo admin_url('post.php?post='. $_product->id .'&action=edit'); ?>"><?php echo $item['name']; ?></a>
|
||||
<?php
|
||||
if (isset($_product->variation_data)) :
|
||||
echo '<br/>' . woocommerce_get_formatted_variation( $_product->variation_data, true );
|
||||
endif;
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<table class="meta" cellspacing="0">
|
||||
<tfoot>
|
||||
|
|
|
@ -129,12 +129,7 @@ function woocommerce_write_panel_scripts() {
|
|||
$post_type = woocommerce_get_current_post_type();
|
||||
|
||||
if( $post_type !== 'product' && $post_type !== 'shop_order' ) return;
|
||||
|
||||
wp_register_script('woocommerce-date', woocommerce::plugin_url() . '/assets/js/date.js');
|
||||
wp_register_script('woocommerce-datepicker', woocommerce::plugin_url() . '/assets/js/datepicker.js', array('jquery', 'woocommerce-date'));
|
||||
|
||||
wp_enqueue_script('woocommerce-datepicker');
|
||||
|
||||
|
||||
wp_register_script('woocommerce-writepanel', woocommerce::plugin_url() . '/assets/js/write-panels.js', array('jquery'));
|
||||
wp_enqueue_script('woocommerce-writepanel');
|
||||
|
||||
|
|
|
@ -126,12 +126,12 @@ dl.totals dd input.last {
|
|||
}
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items thead th {
|
||||
background: #ECECEC;
|
||||
padding: 8px 10px;
|
||||
padding: 8px 8px;
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
}
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items td {
|
||||
padding: 8px 10px;
|
||||
padding: 8px 8px;
|
||||
text-align: left;
|
||||
line-height: 26px;
|
||||
vertical-align: top;
|
||||
|
@ -151,16 +151,22 @@ dl.totals dd input.last {
|
|||
.woocommerce_order_items_wrapper table.woocommerce_order_items .name {
|
||||
min-width: 100px;
|
||||
}
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items .center,
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items .variation-id,
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items .product-id,
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items .product-sku {
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items .center, .woocommerce_order_items_wrapper table.woocommerce_order_items .variation-id, .woocommerce_order_items_wrapper table.woocommerce_order_items .product-id {
|
||||
text-align: center;
|
||||
}
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items .quantity, .woocommerce_order_items_wrapper table.woocommerce_order_items .cost, .woocommerce_order_items_wrapper table.woocommerce_order_items .tax {
|
||||
width: 60px;
|
||||
}
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items table.meta {
|
||||
width: 100%;
|
||||
}
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items table.meta tr td {
|
||||
padding: 1px 4px 1px 0;
|
||||
border: 0;
|
||||
}
|
||||
.woocommerce_order_items_wrapper table.woocommerce_order_items table.meta tr td input {
|
||||
width: 150px;
|
||||
}
|
||||
.woocommerce-order-panel {
|
||||
overflow: hidden;
|
||||
zoom: 1;
|
||||
|
@ -214,34 +220,23 @@ dl.totals dd input.last {
|
|||
width: 65%;
|
||||
float: left;
|
||||
}
|
||||
.column-total_cost table.cost {
|
||||
border: 1px solid #ddd !important;
|
||||
width: 100%;
|
||||
margin: 5px 0 !important;
|
||||
}
|
||||
.column-total_cost table.cost td, .column-total_cost table.cost th {
|
||||
padding: 4px 9px 4px;
|
||||
background: #eee;
|
||||
line-height: 1;
|
||||
}
|
||||
.widefat th.column-id {
|
||||
width: 60px !important;
|
||||
}
|
||||
.widefat .column-order_title time {
|
||||
display: block;
|
||||
color: #999;
|
||||
margin: 3px 0;
|
||||
}
|
||||
.widefat small.meta {
|
||||
display: block;
|
||||
color: #999;
|
||||
font-size: inherit;
|
||||
margin: 3px 0;
|
||||
}
|
||||
.widefat .column-total_cost {
|
||||
width: 150px !important;
|
||||
}
|
||||
.widefat .column-order_title {
|
||||
width: 120px;
|
||||
}
|
||||
.widefat .column-order_title a {
|
||||
display: block;
|
||||
}
|
||||
.widefat .column-order_title time {
|
||||
color: #999;
|
||||
}
|
||||
.widefat .column-customer {
|
||||
width: 140px;
|
||||
}
|
||||
.widefat .column-order_status {
|
||||
width: 80px;
|
||||
text-align: center;
|
||||
|
@ -761,6 +756,23 @@ div.multi_select_products_wrapper {
|
|||
height: 60px;
|
||||
background: #000;
|
||||
}
|
||||
/* Tooltips */
|
||||
.tips {
|
||||
cursor: help;
|
||||
padding: 5px 0 0 0;
|
||||
}
|
||||
#easyTooltip {
|
||||
padding: 5px 10px;
|
||||
border: 3px solid #3da5d5;
|
||||
background: #288ab7;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-o-border-radius: 4px;
|
||||
-khtml-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
/* Datepicker */
|
||||
table.jCalendar {
|
||||
border: 1px solid #000;
|
||||
|
|
|
@ -129,12 +129,12 @@ dl.totals {
|
|||
background: #fff;
|
||||
thead th {
|
||||
background: #ECECEC;
|
||||
padding: 8px 10px;
|
||||
padding: 8px 8px;
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
}
|
||||
td {
|
||||
padding: 8px 10px;
|
||||
padding: 8px 8px;
|
||||
text-align: left;
|
||||
line-height: 26px;
|
||||
vertical-align: top;
|
||||
|
@ -154,14 +154,21 @@ dl.totals {
|
|||
.name {
|
||||
min-width: 100px;
|
||||
}
|
||||
.center, .variation-id, .product-id, .product-sku {
|
||||
.center, .variation-id, .product-id {
|
||||
text-align: center;
|
||||
}
|
||||
.quantity, .cost, .tax {
|
||||
width: 60px;
|
||||
}
|
||||
table.meta {
|
||||
width: 100%;
|
||||
tr {
|
||||
td {
|
||||
padding: 1px 4px 1px 0;
|
||||
border: 0;
|
||||
input {
|
||||
width: 150px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,43 +227,27 @@ dl.totals {
|
|||
float: left;
|
||||
}
|
||||
}
|
||||
.column-total_cost {
|
||||
table.cost {
|
||||
border: 1px solid #ddd !important;
|
||||
width: 100%;
|
||||
margin: 5px 0 !important;
|
||||
td, th {
|
||||
padding: 4px 9px 4px;
|
||||
background: #eee;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.widefat {
|
||||
th.column-id {
|
||||
width:60px !important;
|
||||
}
|
||||
.column-order_title {
|
||||
time {
|
||||
display: block;
|
||||
color:#999;
|
||||
margin: 3px 0;
|
||||
}
|
||||
}
|
||||
small.meta {
|
||||
display: block;
|
||||
color:#999;
|
||||
font-size: inherit;
|
||||
margin: 3px 0;
|
||||
}
|
||||
|
||||
.column-total_cost {
|
||||
width:150px !important;
|
||||
}
|
||||
|
||||
.column-order_title {
|
||||
width:120px;
|
||||
|
||||
a {
|
||||
display: block;
|
||||
}
|
||||
|
||||
time {
|
||||
color:#999;
|
||||
}
|
||||
}
|
||||
|
||||
.column-customer {
|
||||
width:140px;
|
||||
}
|
||||
.column-order_status {
|
||||
width:80px;
|
||||
text-align: center;
|
||||
|
@ -826,6 +817,24 @@ div.multi_select_products_wrapper {
|
|||
background: #000;
|
||||
}
|
||||
|
||||
/* Tooltips */
|
||||
.tips {
|
||||
cursor: help;
|
||||
padding: 5px 0 0 0;
|
||||
}
|
||||
#easyTooltip {
|
||||
padding:5px 10px;
|
||||
border:3px solid #3da5d5;
|
||||
background:#288ab7;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
-moz-border-radius:4px;
|
||||
-webkit-border-radius:4px;
|
||||
-o-border-radius:4px;
|
||||
-khtml-border-radius:4px;
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
/* Datepicker */
|
||||
table.jCalendar {
|
||||
border: 1px solid #000;
|
||||
|
|
|
@ -113,6 +113,23 @@ var iD=f.indexOf('dd');if(iM<iD)
|
|||
d.setDate(Number(s.substr(iD,2)));if(isNaN(d.getTime())){return false;}
|
||||
return d;};var _zeroPad=function(num){var s='0'+num;return s.substring(s.length-2)};})();
|
||||
|
||||
/*
|
||||
* Easy Tooltip 1.0 - jQuery plugin
|
||||
* written by Alen Grakalic
|
||||
* http://cssglobe.com/post/4380/easy-tooltip--jquery-plugin
|
||||
*
|
||||
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*/
|
||||
(function($){$.fn.easyTooltip=function(options){var defaults={xOffset:10,yOffset:25,tooltipId:"easyTooltip",clickRemove:false,content:"",useElement:""};var options=$.extend(defaults,options);var content;this.each(function(){var title=$(this).attr("tip");$(this).hover(function(e){content=(options.content!="")?options.content:title;content=(options.useElement!="")?$("#"+options.useElement).html():content;$(this).attr("title","");if(content!=""&&content!=undefined){$("body").append("<div id='"+options.tooltipId+"'>"+content+"</div>");$("#"+options.tooltipId).css("position","absolute").css("top",(e.pageY-options.yOffset)+"px").css("left",(e.pageX+options.xOffset)+"px").css("display","none").fadeIn("fast")}},function(){$("#"+options.tooltipId).remove();$(this).attr("title",title)});$(this).mousemove(function(e){$("#"+options.tooltipId).css("top",(e.pageY-options.yOffset)+"px").css("left",(e.pageX+options.xOffset)+"px")});if(options.clickRemove){$(this).mousedown(function(e){$("#"+options.tooltipId).remove();$(this).attr("title",title)})}})}})(jQuery);
|
||||
|
||||
jQuery(function(){
|
||||
jQuery(".tips").easyTooltip();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Spoofs placeholders in browsers that don't support them (eg Firefox 3)
|
||||
*
|
||||
|
|
|
@ -164,55 +164,6 @@ if(typeof options.expires==='number'){var days=options.expires,t=options.expires
|
|||
value=String(value);return(document.cookie=[encodeURIComponent(key),'=',options.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}
|
||||
options=value||{};var result,decode=options.raw?function(s){return s;}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null;};
|
||||
|
||||
/*
|
||||
* Date prototype extensions. Doesn't depend on any
|
||||
* other code. Doens't overwrite existing methods.
|
||||
*
|
||||
* Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear,
|
||||
* isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear,
|
||||
* setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods
|
||||
*
|
||||
* Copyright (c) 2006 Jšrn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*
|
||||
* Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString -
|
||||
* I've added my name to these methods so you know who to blame if they are broken!
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
Date.dayNames=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];Date.abbrDayNames=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];Date.monthNames=['January','February','March','April','May','June','July','August','September','October','November','December'];Date.abbrMonthNames=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];Date.firstDayOfWeek=1;Date.format='dd/mm/yyyy';Date.fullYearStart='20';(function(){function add(name,method){if(!Date.prototype[name]){Date.prototype[name]=method;}};add("isLeapYear",function(){var y=this.getFullYear();return(y%4==0&&y%100!=0)||y%400==0;});add("isWeekend",function(){return this.getDay()==0||this.getDay()==6;});add("isWeekDay",function(){return!this.isWeekend();});add("getDaysInMonth",function(){return[31,(this.isLeapYear()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];});add("getDayName",function(abbreviated){return abbreviated?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()];});add("getMonthName",function(abbreviated){return abbreviated?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()];});add("getDayOfYear",function(){var tmpdtm=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-tmpdtm.getTime())/86400000);});add("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7);});add("setDayOfYear",function(day){this.setMonth(0);this.setDate(day);return this;});add("addYears",function(num){this.setFullYear(this.getFullYear()+num);return this;});add("addMonths",function(num){var tmpdtm=this.getDate();this.setMonth(this.getMonth()+num);if(tmpdtm>this.getDate())
|
||||
this.addDays(-this.getDate());return this;});add("addDays",function(num){this.setTime(this.getTime()+(num*86400000));return this;});add("addHours",function(num){this.setHours(this.getHours()+num);return this;});add("addMinutes",function(num){this.setMinutes(this.getMinutes()+num);return this;});add("addSeconds",function(num){this.setSeconds(this.getSeconds()+num);return this;});add("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this;});add("asString",function(format){var r=format||Date.format;return r.split('yyyy').join(this.getFullYear()).split('yy').join((this.getFullYear()+'').substring(2)).split('mmmm').join(this.getMonthName(false)).split('mmm').join(this.getMonthName(true)).split('mm').join(_zeroPad(this.getMonth()+1)).split('dd').join(_zeroPad(this.getDate())).split('hh').join(_zeroPad(this.getHours())).split('min').join(_zeroPad(this.getMinutes())).split('ss').join(_zeroPad(this.getSeconds()));});Date.fromString=function(s,format)
|
||||
{var f=format||Date.format;var d=new Date('01/01/1977');var mLength=0;var iM=f.indexOf('mmmm');if(iM>-1){for(var i=0;i<Date.monthNames.length;i++){var mStr=s.substr(iM,Date.monthNames[i].length);if(Date.monthNames[i]==mStr){mLength=Date.monthNames[i].length-4;break;}}
|
||||
d.setMonth(i);}else{iM=f.indexOf('mmm');if(iM>-1){var mStr=s.substr(iM,3);for(var i=0;i<Date.abbrMonthNames.length;i++){if(Date.abbrMonthNames[i]==mStr)break;}
|
||||
d.setMonth(i);}else{d.setMonth(Number(s.substr(f.indexOf('mm'),2))-1);}}
|
||||
var iY=f.indexOf('yyyy');if(iY>-1){if(iM<iY)
|
||||
{iY+=mLength;}
|
||||
d.setFullYear(Number(s.substr(iY,4)));}else{if(iM<iY)
|
||||
{iY+=mLength;}
|
||||
d.setFullYear(Number(Date.fullYearStart+s.substr(f.indexOf('yy'),2)));}
|
||||
var iD=f.indexOf('dd');if(iM<iD)
|
||||
{iD+=mLength;}
|
||||
d.setDate(Number(s.substr(iD,2)));if(isNaN(d.getTime())){return false;}
|
||||
return d;};var _zeroPad=function(num){var s='0'+num;return s.substring(s.length-2)};})();
|
||||
|
||||
/*
|
||||
* Easy Tooltip 1.0 - jQuery plugin
|
||||
* written by Alen Grakalic
|
||||
* http://cssglobe.com/post/4380/easy-tooltip--jquery-plugin
|
||||
*
|
||||
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*/
|
||||
(function($){$.fn.easyTooltip=function(options){var defaults={xOffset:10,yOffset:25,tooltipId:"easyTooltip",clickRemove:false,content:"",useElement:""};var options=$.extend(defaults,options);var content;this.each(function(){var title=$(this).attr("tip");$(this).hover(function(e){content=(options.content!="")?options.content:title;content=(options.useElement!="")?$("#"+options.useElement).html():content;$(this).attr("title","");if(content!=""&&content!=undefined){$("body").append("<div id='"+options.tooltipId+"'>"+content+"</div>");$("#"+options.tooltipId).css("position","absolute").css("top",(e.pageY-options.yOffset)+"px").css("left",(e.pageX+options.xOffset)+"px").css("display","none").fadeIn("fast")}},function(){$("#"+options.tooltipId).remove();$(this).attr("title",title)});$(this).mousemove(function(e){$("#"+options.tooltipId).css("top",(e.pageY-options.yOffset)+"px").css("left",(e.pageX+options.xOffset)+"px")});if(options.clickRemove){$(this).mousedown(function(e){$("#"+options.tooltipId).remove();$(this).attr("title",title)})}})}})(jQuery);
|
||||
|
||||
jQuery(function(){
|
||||
jQuery(".tips").easyTooltip();
|
||||
});
|
||||
|
||||
/**
|
||||
* Spoofs placeholders in browsers that don't support them (eg Firefox 3)
|
||||
*
|
||||
|
|
|
@ -114,7 +114,8 @@ jQuery( function($){
|
|||
jQuery('table.woocommerce_order_items tbody#order_items_list').append( response );
|
||||
jQuery('table.woocommerce_order_items').unblock();
|
||||
jQuery('select.add_item_id').css('border-color', '').val('');
|
||||
|
||||
jQuery(".tips").easyTooltip();
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
|
|
|
@ -539,14 +539,31 @@ class woocommerce_checkout {
|
|||
$rate = $_tax->get_rate( $_product->tax_class );
|
||||
endif;
|
||||
|
||||
// Store any item meta data
|
||||
$item_meta = array();
|
||||
|
||||
// Variations meta
|
||||
if ($values['variation'] && is_array($values['variation'])) :
|
||||
foreach ($values['variation'] as $key => $value) :
|
||||
$item_meta[ sanitize_title(str_replace('tax_', '', $key)) ] = $value;
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
// Discount code meta
|
||||
if (woocommerce_cart::$applied_coupons) $item_meta[ 'coupons' ] = implode(', ', woocommerce_cart::$applied_coupons);
|
||||
|
||||
// Run filter
|
||||
$item_meta = apply_filters('order_item_meta', $item_meta, $values);
|
||||
|
||||
$order_items[] = apply_filters('new_order_item', array(
|
||||
'id' => $values['product_id'],
|
||||
'variation_id' => $values['variation_id'],
|
||||
'name' => $_product->get_title(),
|
||||
'qty' => (int) $values['quantity'],
|
||||
'cost' => $_product->get_price_excluding_tax(),
|
||||
'taxrate' => $rate
|
||||
));
|
||||
'taxrate' => $rate,
|
||||
'item_meta' => $item_meta
|
||||
), $values);
|
||||
|
||||
// Check stock levels
|
||||
if ($_product->managing_stock()) :
|
||||
|
|
|
@ -47,24 +47,47 @@ class woocommerce_product_variation extends woocommerce_product {
|
|||
$this->id = $this->variation->post_parent;
|
||||
|
||||
$parent_custom_fields = get_post_custom( $this->id );
|
||||
|
||||
// Define the data we're going to load: Key => Default value
|
||||
$load_data = array(
|
||||
'sku' => $this->id,
|
||||
'price' => 0,
|
||||
'visibility' => 'hidden',
|
||||
'stock' => 0,
|
||||
'stock_status' => 'instock',
|
||||
'backorders' => 'no',
|
||||
'manage_stock' => 'no',
|
||||
'sale_price' => '',
|
||||
'regular_price' => '',
|
||||
'weight' => '',
|
||||
'tax_status' => 'taxable',
|
||||
'tax_class' => '',
|
||||
'upsell_ids' => array(),
|
||||
'crosssell_ids' => array()
|
||||
);
|
||||
|
||||
// Load the data from the custom fields
|
||||
foreach ($load_data as $key => $default) :
|
||||
if (isset($parent_custom_fields[$key][0]) && !empty($parent_custom_fields[$key][0])) :
|
||||
$this->$key = $parent_custom_fields[$key][0];
|
||||
else :
|
||||
$this->$key = $default;
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
// Load serialised data, unserialise twice to fix WP bug
|
||||
if (isset($product_custom_fields['product_attributes'][0])) $this->attributes = maybe_unserialize( maybe_unserialize( $product_custom_fields['product_attributes'][0] )); else $this->attributes = array();
|
||||
|
||||
if (isset($parent_custom_fields['sku'][0]) && !empty($parent_custom_fields['sku'][0])) $this->sku = $parent_custom_fields['sku'][0]; else $this->sku = $this->id;
|
||||
if (isset($parent_custom_fields['product_attributes'][0])) $this->attributes = maybe_unserialize( maybe_unserialize( $parent_custom_fields['product_attributes'][0] ) ); else $this->attributes = array();
|
||||
if (isset($parent_custom_fields['price'][0])) $this->price = $parent_custom_fields['price'][0]; else $this->price = 0;
|
||||
if (isset($parent_custom_fields['visibility'][0])) $this->visibility = $parent_custom_fields['visibility'][0]; else $this->visibility = 'hidden';
|
||||
if (isset($parent_custom_fields['stock'][0])) $this->stock = $parent_custom_fields['stock'][0]; else $this->stock = 0;
|
||||
|
||||
$this->product_type = 'variable';
|
||||
|
||||
if ($product_custom_fields) :
|
||||
if ($parent_custom_fields) :
|
||||
$this->exists = true;
|
||||
else :
|
||||
$this->exists = false;
|
||||
endif;
|
||||
|
||||
//parent::woocommerce_product( $this->variation->post_parent );
|
||||
|
||||
/* Pverride parent data with variation */
|
||||
|
||||
/* Override parent data with variation */
|
||||
if (isset($product_custom_fields['sku'][0]) && !empty($product_custom_fields['sku'][0])) :
|
||||
$this->variation_has_sku = true;
|
||||
$this->sku = $product_custom_fields['sku'][0];
|
||||
|
@ -83,11 +106,13 @@ class woocommerce_product_variation extends woocommerce_product {
|
|||
if (isset($product_custom_fields['price'][0]) && !empty($product_custom_fields['price'][0])) :
|
||||
$this->variation_has_price = true;
|
||||
$this->price = $product_custom_fields['price'][0];
|
||||
$this->regular_price = $product_custom_fields['price'][0];
|
||||
endif;
|
||||
|
||||
if (isset($product_custom_fields['sale_price'][0]) && !empty($product_custom_fields['sale_price'][0])) :
|
||||
$this->variation_has_sale_price = true;
|
||||
$this->sale_price = $product_custom_fields['sale_price'][0];
|
||||
if ($this->sale_price < $this->price) $this->price = $this->sale_price;
|
||||
endif;
|
||||
}
|
||||
|
||||
|
@ -99,29 +124,14 @@ class woocommerce_product_variation extends woocommerce_product {
|
|||
return $this->variation;
|
||||
}
|
||||
|
||||
/** Returns the product's price */
|
||||
function get_price() {
|
||||
|
||||
if ($this->variation_has_price) :
|
||||
if ($this->variation_has_sale_price) :
|
||||
return $this->sale_price;
|
||||
else :
|
||||
return $this->price;
|
||||
endif;
|
||||
else :
|
||||
return parent::get_price();
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
/** Returns the price in html format */
|
||||
function get_price_html() {
|
||||
if ($this->variation_has_price) :
|
||||
if ($this->variation_has_price || $this->variation_has_sale_price) :
|
||||
$price = '';
|
||||
|
||||
if ($this->price) :
|
||||
if ($this->variation_has_sale_price) :
|
||||
$price .= '<del>'.woocommerce_price( $this->price ).'</del> <ins>'.woocommerce_price( $this->sale_price ).'</ins>';
|
||||
$price .= '<del>'.woocommerce_price( $this->regular_price ).'</del> <ins>'.woocommerce_price( $this->sale_price ).'</ins>';
|
||||
else :
|
||||
$price .= woocommerce_price( $this->price );
|
||||
endif;
|
||||
|
|
|
@ -53,7 +53,7 @@ class WooCommerce_Widget_Featured_Products extends WP_Widget {
|
|||
|
||||
<li><a href="<?php echo get_permalink( $r->ID ) ?>" title="<?php echo esc_attr($r->post_title ? $r->post_title : $r->ID); ?>">
|
||||
<?php if (has_post_thumbnail( $r->ID )) echo get_the_post_thumbnail($r->ID, 'shop_tiny'); else echo '<img src="'.woocommerce::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.woocommerce::get_var('shop_tiny_w').'px" height="'.woocommerce::get_var('shop_tiny_h').'px" />'; ?>
|
||||
<?php if ( $r->post_title ) echo $r->post_title; else echo $r->ID; ?>
|
||||
<?php if ( $r->post_title ) echo esc_attr(__($r->post_title)); else echo $r->ID; ?>
|
||||
</a> <?php echo $_product->get_price_html(); ?></li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -133,7 +133,7 @@ function display_variation_data() {
|
|||
endif;
|
||||
|
||||
$data = array(
|
||||
'price_html' => '<span class="price">'.$_product->get_price_html().'</span>',
|
||||
'price_html' => '<span class="price">'.$_product->get_price_html() .'</span>',
|
||||
'availability_html' => $availability_html,
|
||||
'image_src' => $image,
|
||||
'image_link' => $image_link
|
||||
|
@ -191,22 +191,26 @@ function woocommerce_add_order_item() {
|
|||
endif;
|
||||
?>
|
||||
<tr class="item" rel="<?php echo $index; ?>">
|
||||
<td class="product-id"><?php echo $_product->id; ?></td>
|
||||
<td class="variation-id"><?php if (isset($_product->variation_id)) echo $_product->variation_id; else echo '-'; ?></td>
|
||||
<td class="product-sku"><?php if ($_product->sku) echo $_product->sku; ?></td>
|
||||
<td class="name"><a href="<?php echo admin_url('post.php?post='. $_product->id .'&action=edit'); ?>"><?php echo $_product->get_title(); ?></a></td>
|
||||
<td class="variation"><?php
|
||||
if (isset($_product->variation_data)) :
|
||||
echo woocommerce_get_formatted_variation( $_product->variation_data, true );
|
||||
else :
|
||||
echo '-';
|
||||
endif;
|
||||
?></td>
|
||||
<td class="product-id">
|
||||
<img class="tips" tip="<?php
|
||||
echo '<strong>'.__('Product ID:', 'woothemes').'</strong> '. $_product->id;
|
||||
echo '<br/><strong>'.__('Variation ID:', 'woothemes').'</strong> '; if ($_product->variation_id) echo $_product->variation_id; else echo '-';
|
||||
echo '<br/><strong>'.__('Product SKU:', 'woothemes').'</strong> '; if ($_product->sku) echo $_product->sku; else echo '-';
|
||||
?>" src="<?php echo woocommerce::plugin_url(); ?>/assets/images/tip.png" />
|
||||
</td>
|
||||
<td class="name">
|
||||
<a href="<?php echo admin_url('post.php?post='. $_product->id .'&action=edit'); ?>"><?php echo $_product->get_title(); ?></a>
|
||||
<?php
|
||||
if (isset($_product->variation_data)) :
|
||||
echo '<br/>' . woocommerce_get_formatted_variation( $_product->variation_data, true );
|
||||
endif;
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<table class="meta" cellspacing="0">
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3"><button class="add_meta button"><?php _e('Add meta', 'woothemes'); ?></button></td>
|
||||
<td colspan="3"><button class="add_meta button"><?php _e('Add meta', 'woothemes'); ?></button></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody class="meta_items"></tbody>
|
||||
|
|
Loading…
Reference in New Issue