Updating to 1.5
This commit is contained in:
parent
e998a8e6bb
commit
fff9ee51b5
|
@ -0,0 +1,277 @@
|
|||
<?php
|
||||
/**
|
||||
* Order Downloads
|
||||
*
|
||||
* Functions for displaying order download permissions in admin
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin Write Panels
|
||||
* @package WooCommerce
|
||||
*/
|
||||
|
||||
/**
|
||||
* Order notes meta box
|
||||
*/
|
||||
function woocommerce_order_downloads_meta_box() {
|
||||
global $woocommerce, $post, $wpdb;
|
||||
|
||||
?>
|
||||
<div class="order_download_permissions wc-metaboxes-wrapper">
|
||||
|
||||
<div class="wc-metaboxes">
|
||||
|
||||
<?php
|
||||
$i = -1;
|
||||
|
||||
$download_permissions = $wpdb->get_results("
|
||||
SELECT * FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
|
||||
WHERE order_id = $post->ID
|
||||
");
|
||||
|
||||
if ($download_permissions && sizeof($download_permissions)>0) foreach ($download_permissions as $download) :
|
||||
$i++;
|
||||
|
||||
$product = new WC_Product( $download->product_id );
|
||||
?>
|
||||
<div class="wc-metabox closed">
|
||||
<h3 class="fixed">
|
||||
<button type="button" rel="<?php echo $download->product_id; ?>" class="revoke_access button"><?php _e('Revoke Access', 'woocommerce'); ?></button>
|
||||
<div class="handlediv" title="<?php _e('Click to toggle'); ?>"></div>
|
||||
<strong><?php echo '#' . $product->id . ' — ' . $product->get_title() . ' — ' . sprintf(_n('Downloaded %s time', 'Downloaded %s times', $download->download_count), $download->download_count); ?></strong>
|
||||
</h3>
|
||||
<table cellpadding="0" cellspacing="0" class="wc-metabox-content">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label><?php _e('Downloads Remaining', 'woocommerce'); ?>:</label>
|
||||
<input type="hidden" name="download_id[<?php echo $i; ?>]" value="<?php echo $download->product_id; ?>" />
|
||||
<input type="text" class="short" name="downloads_remaining[<?php echo $i; ?>]" value="<?php echo $download->downloads_remaining ?>" placeholder="<?php _e('Unlimited', 'woocommerce'); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<label><?php _e('Access Expires', 'woocommerce'); ?>:</label>
|
||||
<input type="text" class="short date-picker" name="access_expires[<?php echo $i; ?>]" value="<?php echo ($download->access_expires>0) ? date('Y-m-d', strtotime($download->access_expires)) : ''; ?>" maxlength="10" placeholder="<?php _e('Never', 'woocommerce'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="toolbar">
|
||||
<p class="buttons">
|
||||
<select name="grant_access_id" class="grant_access_id chosen_select_nostd" data-placeholder="<?php _e('Choose a downloadable product…', 'woocommerce') ?>">
|
||||
<?php
|
||||
echo '<option value=""></option>';
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'product',
|
||||
'posts_per_page' => -1,
|
||||
'post_status' => 'publish',
|
||||
'post_parent' => 0,
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'title',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => '_downloadable',
|
||||
'value' => 'yes'
|
||||
)
|
||||
)
|
||||
);
|
||||
$products = get_posts( $args );
|
||||
|
||||
if ($products) foreach ($products as $product) :
|
||||
|
||||
$sku = get_post_meta($product->ID, '_sku', true);
|
||||
|
||||
if ($sku) $sku = ' SKU: '.$sku;
|
||||
|
||||
echo '<option value="'.$product->ID.'">'.$product->post_title.$sku.' (#'.$product->ID.''.$sku.')</option>';
|
||||
|
||||
$args_get_children = array(
|
||||
'post_type' => array( 'product_variation', 'product' ),
|
||||
'posts_per_page' => -1,
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'title',
|
||||
'post_parent' => $product->ID
|
||||
);
|
||||
|
||||
if ( $children_products =& get_children( $args_get_children ) ) :
|
||||
|
||||
foreach ($children_products as $child) :
|
||||
|
||||
echo '<option value="'.$child->ID.'"> — '.$child->post_title.'</option>';
|
||||
|
||||
endforeach;
|
||||
|
||||
endif;
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
</select>
|
||||
|
||||
<button type="button" class="button grant_access"><?php _e('Grant Access', 'woocommerce'); ?></button>
|
||||
</p>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Javascript
|
||||
*/
|
||||
ob_start();
|
||||
?>
|
||||
jQuery(function(){
|
||||
|
||||
jQuery('.order_download_permissions').on('click', 'button.grant_access', function(){
|
||||
|
||||
var product = jQuery('select.grant_access_id').val();
|
||||
|
||||
if (!product) return;
|
||||
|
||||
jQuery('.order_download_permissions').block({ message: null, overlayCSS: { background: '#fff url(<?php echo $woocommerce->plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
|
||||
|
||||
var data = {
|
||||
action: 'woocommerce_grant_access_to_download',
|
||||
product_id: product,
|
||||
order_id: '<?php echo $post->ID; ?>',
|
||||
security: '<?php echo wp_create_nonce("grant-access"); ?>'
|
||||
};
|
||||
|
||||
jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', data, function(response) {
|
||||
|
||||
var loop = jQuery('.order_download_permissions .wc-metabox').size();
|
||||
|
||||
new_download = jQuery.parseJSON( response );
|
||||
|
||||
if ( new_download && new_download.success == 1 ) {
|
||||
|
||||
jQuery('.order_download_permissions .wc-metaboxes').append('<div class="wc-metabox closed">\
|
||||
<h3 class="fixed">\
|
||||
<button type="button" rel="' + new_download.download_id + '" class="revoke_access button"><?php _e('Revoke Access', 'woocommerce'); ?></button>\
|
||||
<div class="handlediv" title="<?php _e('Click to toggle'); ?>"></div>\
|
||||
<strong>#' + new_download.download_id + ' — ' + new_download.title + '</strong>\
|
||||
</h3>\
|
||||
<table cellpadding="0" cellspacing="0" class="wc-metabox-content">\
|
||||
<tbody>\
|
||||
<tr>\
|
||||
<td>\
|
||||
<label><?php _e('Downloads Remaining', 'woocommerce'); ?>:</label>\
|
||||
<input type="hidden" name="download_id[' + loop + ']" value="' + new_download.download_id + '" />\
|
||||
<input type="text" class="short" name="downloads_remaining[' + loop + ']" value="' + new_download.remaining + '" placeholder="<?php _e('Unlimited', 'woocommerce'); ?>" />\
|
||||
</td>\
|
||||
<td>\
|
||||
<label><?php _e('Access Expires', 'woocommerce'); ?>:</label>\
|
||||
<input type="text" class="short date-picker" name="access_expires[' + loop + ']" value="' + new_download.expires + '" maxlength="10" placeholder="<?php _e('Never', 'woocommerce'); ?>" />\
|
||||
</td>\
|
||||
</tr>\
|
||||
</tbody>\
|
||||
</table>\
|
||||
</div>');
|
||||
|
||||
} else {
|
||||
alert('<?php _e('Could not grant access - the user may already have permission for this file.', 'woocommerce'); ?>');
|
||||
}
|
||||
|
||||
jQuery( ".date-picker" ).datepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
numberOfMonths: 1,
|
||||
showButtonPanel: true,
|
||||
showOn: "button",
|
||||
buttonImage: woocommerce_writepanel_params.calendar_image,
|
||||
buttonImageOnly: true
|
||||
});
|
||||
|
||||
jQuery('.order_download_permissions').unblock();
|
||||
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
jQuery('.order_download_permissions').on('click', 'button.revoke_access', function(e){
|
||||
e.preventDefault();
|
||||
var answer = confirm('<?php _e('Are you sure you want to revoke access to this download?', 'woocommerce'); ?>');
|
||||
if (answer){
|
||||
|
||||
var el = jQuery(this).parent().parent();
|
||||
|
||||
var product = jQuery(this).attr('rel');
|
||||
|
||||
if (product>0) {
|
||||
|
||||
jQuery(el).block({ message: null, overlayCSS: { background: '#fff url(<?php echo $woocommerce->plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
|
||||
|
||||
var data = {
|
||||
action: 'woocommerce_revoke_access_to_download',
|
||||
product_id: product,
|
||||
order_id: '<?php echo $post->ID; ?>',
|
||||
security: '<?php echo wp_create_nonce("revoke-access"); ?>'
|
||||
};
|
||||
|
||||
jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', data, function(response) {
|
||||
// Success
|
||||
jQuery(el).fadeOut('300', function(){
|
||||
jQuery(el).remove();
|
||||
});
|
||||
});
|
||||
|
||||
} else {
|
||||
jQuery(el).fadeOut('300', function(){
|
||||
jQuery(el).remove();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
<?php
|
||||
$javascript = ob_get_clean();
|
||||
$woocommerce->add_inline_js( $javascript );
|
||||
}
|
||||
|
||||
/**
|
||||
* Order Downloads Save
|
||||
*
|
||||
* Function for processing and storing all order downloads.
|
||||
*/
|
||||
add_action('woocommerce_process_shop_order_meta', 'woocommerce_order_downloads_save', 5, 2);
|
||||
|
||||
function woocommerce_order_downloads_save( $post_id, $post ) {
|
||||
global $wpdb, $woocommerce;
|
||||
|
||||
if (isset($_POST['download_id'])) :
|
||||
|
||||
// Download data
|
||||
$download_ids = $_POST['download_id'];
|
||||
$downloads_remaining = $_POST['downloads_remaining'];
|
||||
$access_expires = $_POST['access_expires'];
|
||||
|
||||
// Order data
|
||||
$order_key = get_post_meta($post->ID, '_order_key', true);
|
||||
$customer_email = get_post_meta($post->ID, '_billing_email', true);
|
||||
$customer_user = (int) get_post_meta($post->ID, '_customer_user', true);
|
||||
|
||||
for ($i=0; $i<sizeof($download_ids); $i++) :
|
||||
|
||||
$wpdb->update( $wpdb->prefix . "woocommerce_downloadable_product_permissions", array(
|
||||
'user_id' => $customer_user,
|
||||
'user_email' => $customer_email,
|
||||
'downloads_remaining' => $downloads_remaining[$i],
|
||||
'access_expires' => ($access_expires[$i]) ? date('Y-m-d', strtotime($access_expires[$i])) : ''
|
||||
), array(
|
||||
'order_id' => $post_id,
|
||||
'product_id' => $download_ids[$i]
|
||||
), array( '%d', '%s', '%s', '%s' ), array( '%d', '%d' ) );
|
||||
|
||||
endfor;
|
||||
|
||||
endif;
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
.woocommerce-message{position:relative;z-index:100;border:1px solid #b76ca9!important;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 0 15px rgba(0,0,0,0.04);-moz-box-shadow:inset 0 0 15px rgba(0,0,0,0.04);box-shadow:inset 0 0 15px rgba(0,0,0,0.04);overflow:hidden;padding:10px 0 10px!important;background:#cc99c2 url(../images/message.png) no-repeat right bottom!important}.woocommerce-message .squeezer{max-width:960px;margin:0;padding:0 10px;text-align:left;overflow:hidden}.woocommerce-message h4{margin:0 10px 0 0;font-size:18px;line-height:36px;font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;font-weight:normal;color:#fff;text-shadow:0 1px 1px #b574a8;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;float:left;vertical-align:middle}.woocommerce-message p{margin:0!important;padding:2px 0!important;float:left!important;line-height:32px;vertical-align:middle}.woocommerce-message p a.button-primary{font-size:16px!important;line-height:16px!important;margin:0 5px 0 0;padding:6px 15px;vertical-align:middle;color:#fff;text-align:center;text-decoration:none;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;border:1px solid #88537e;background:#a46497;-moz-box-shadow:inset 0 0 2px #fff,0 1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:inset 0 0 2px #fff,0 1px 1px rgba(0,0,0,0.1);box-shadow:inset 0 0 2px #fff,0 1px 1px rgba(0,0,0,0.1);text-shadow:0 -1px 0 rgba(0,0,0,0.3);-webkit-transition-duration:.3s;-moz-transition-duration:.3s;cursor:pointer;font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif}.woocommerce-message p a.button-primary:hover,.woocommerce-message p a.button-primary:active{background-color:#f0a000;border-color:#c87800;-webkit-transition-duration:.3s;outline:0;opacity:1}.woocommerce-message p a.skip,.woocommerce-message p a.docs{opacity:.5}.woocommerce-message .twitter-share-button{vertical-align:middle}
|
|
@ -0,0 +1,78 @@
|
|||
.woocommerce-message {
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
border: 1px solid #b76ca9 !important;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-webkit-box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
|
||||
-moz-box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
|
||||
box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
|
||||
overflow: hidden;
|
||||
padding: 10px 0 10px !important;
|
||||
background: #cc99c2 url(../images/message.png) no-repeat right bottom !important;
|
||||
.squeezer {
|
||||
max-width: 960px;
|
||||
margin: 0;
|
||||
padding: 0 10px;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
}
|
||||
h4 {
|
||||
margin: 0 10px 0 0;
|
||||
font-size: 18px;
|
||||
line-height: 36px;
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
|
||||
font-weight: normal;
|
||||
color: #fff;
|
||||
text-shadow: 0px 1px 1px #b574a8;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
float: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
p {
|
||||
margin: 0 !important;
|
||||
padding: 2px 0 !important;
|
||||
float: left !important;
|
||||
line-height: 32px;
|
||||
vertical-align: middle;
|
||||
a.button-primary {
|
||||
font-size: 16px !important;
|
||||
line-height: 16px !important;
|
||||
margin: 0 5px 0 0;
|
||||
padding: 6px 15px;
|
||||
vertical-align: middle;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #88537e;
|
||||
background: #a46497;
|
||||
-moz-box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
|
||||
-webkit-box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
|
||||
box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
|
||||
text-shadow: 0px -1px 0px rgba( 0,0,0,0.3);
|
||||
-webkit-transition-duration: .3s;
|
||||
-moz-transition-duration: .3s;
|
||||
cursor: pointer;
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
|
||||
}
|
||||
a.button-primary:hover, a.button-primary:active {
|
||||
background-color: #f0a000;
|
||||
border-color: #c87800;
|
||||
-webkit-transition-duration: .3s;
|
||||
outline: none;
|
||||
opacity: 1;
|
||||
}
|
||||
a.skip, a.docs {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
.twitter-share-button {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 426 B |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
After Width: | Height: | Size: 329 B |
Binary file not shown.
After Width: | Height: | Size: 355 B |
Binary file not shown.
After Width: | Height: | Size: 244 B |
|
@ -0,0 +1,103 @@
|
|||
jQuery(document).ready(function(){
|
||||
jQuery('#the-list').on('click', '.editinline', function(){
|
||||
|
||||
inlineEditPost.revert();
|
||||
|
||||
var post_id = jQuery(this).closest('tr').attr('id');
|
||||
|
||||
post_id = post_id.replace("post-", "");
|
||||
|
||||
var $wc_inline_data = jQuery('#woocommerce_inline_' + post_id );
|
||||
|
||||
var sku = $wc_inline_data.find('.sku').text();
|
||||
var regular_price = $wc_inline_data.find('.regular_price').text();
|
||||
var sale_price = $wc_inline_data.find('.sale_price').text();
|
||||
var weight = $wc_inline_data.find('.weight').text();
|
||||
var length = $wc_inline_data.find('.length').text();
|
||||
var width = $wc_inline_data.find('.width').text();
|
||||
var height = $wc_inline_data.find('.height').text();
|
||||
var visibility = $wc_inline_data.find('.visibility').text();
|
||||
var stock_status = $wc_inline_data.find('.stock_status').text();
|
||||
var stock = $wc_inline_data.find('.stock').text();
|
||||
var featured = $wc_inline_data.find('.featured').text();
|
||||
var manage_stock = $wc_inline_data.find('.manage_stock').text();
|
||||
|
||||
jQuery('input[name="_sku"]', '.inline-edit-row').val(sku);
|
||||
jQuery('input[name="_regular_price"]', '.inline-edit-row').val(regular_price);
|
||||
jQuery('input[name="_sale_price"]', '.inline-edit-row').val(sale_price);
|
||||
jQuery('input[name="_weight"]', '.inline-edit-row').val(weight);
|
||||
jQuery('input[name="_length"]', '.inline-edit-row').val(length);
|
||||
jQuery('input[name="_width"]', '.inline-edit-row').val(width);
|
||||
jQuery('input[name="_height"]', '.inline-edit-row').val(height);
|
||||
jQuery('input[name="_stock"]', '.inline-edit-row').val(stock);
|
||||
|
||||
jQuery('select[name="_visibility"] option, select[name="_stock_status"] option').removeAttr('selected');
|
||||
|
||||
jQuery('select[name="_visibility"] option[value="' + visibility + '"]', '.inline-edit-row').attr('selected', 'selected');
|
||||
jQuery('select[name="_stock_status"] option[value="' + stock_status + '"]', '.inline-edit-row').attr('selected', 'selected');
|
||||
|
||||
if (featured=='yes') {
|
||||
jQuery('input[name="_featured"]', '.inline-edit-row').attr('checked', 'checked');
|
||||
} else {
|
||||
jQuery('input[name="_featured"]', '.inline-edit-row').removeAttr('checked');
|
||||
}
|
||||
|
||||
if (manage_stock=='yes') {
|
||||
jQuery('.stock_qty_field', '.inline-edit-row').show().removeAttr('style');
|
||||
jQuery('input[name="_manage_stock"]', '.inline-edit-row').attr('checked', 'checked');
|
||||
} else {
|
||||
jQuery('.stock_qty_field', '.inline-edit-row').hide();
|
||||
jQuery('input[name="_manage_stock"]', '.inline-edit-row').removeAttr('checked');
|
||||
}
|
||||
|
||||
// Conditional display
|
||||
var product_type = $wc_inline_data.find('.product_type').text();
|
||||
var product_is_virtual = $wc_inline_data.find('.product_is_virtual').text();
|
||||
|
||||
if (product_type=='simple' || product_type=='external') {
|
||||
jQuery('.price_fields', '.inline-edit-row').show().removeAttr('style');
|
||||
} else {
|
||||
jQuery('.price_fields', '.inline-edit-row').hide();
|
||||
}
|
||||
|
||||
if (product_is_virtual=='yes') {
|
||||
jQuery('.dimension_fields', '.inline-edit-row').hide();
|
||||
} else {
|
||||
jQuery('.dimension_fields', '.inline-edit-row').show().removeAttr('style');
|
||||
}
|
||||
|
||||
if (product_type=='grouped') {
|
||||
jQuery('.stock_fields', '.inline-edit-row').hide();
|
||||
} else {
|
||||
jQuery('.stock_fields', '.inline-edit-row').show().removeAttr('style');
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#the-list').on('change', '.inline-edit-row input[name="_manage_stock"]', function(){
|
||||
|
||||
if (jQuery(this).is(':checked')) {
|
||||
jQuery('.stock_qty_field', '.inline-edit-row').show().removeAttr('style');
|
||||
} else {
|
||||
jQuery('.stock_qty_field', '.inline-edit-row').hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
jQuery('#wpbody').on('click', '#doaction, #doaction2', function(){
|
||||
|
||||
jQuery('select, input.text', '.inline-edit-row').val('');
|
||||
jQuery('select option', '.inline-edit-row').removeAttr('checked');
|
||||
jQuery('#woocommerce-fields-bulk .inline-edit-group .alignright').hide();
|
||||
|
||||
});
|
||||
|
||||
jQuery('#wpbody').on('change', '#woocommerce-fields-bulk .inline-edit-group .change_to', function(){
|
||||
|
||||
if (jQuery(this).val()==1) {
|
||||
jQuery(this).closest('div').find('.alignright').show();
|
||||
} else {
|
||||
jQuery(this).closest('div').find('.alignright').hide();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,25 @@
|
|||
<?php if (get_option('woocommerce_ship_to_billing_address_only')=='no') : ?>
|
||||
|
||||
<div style="float:left; width: 49%;">
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<h3><?php _e('Billing address', 'woocommerce'); ?></h3>
|
||||
|
||||
<p><?php echo $order->get_formatted_billing_address(); ?></p>
|
||||
|
||||
<?php if (get_option('woocommerce_ship_to_billing_address_only')=='no') : ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="float:right; width: 49%;">
|
||||
|
||||
<h3><?php _e('Shipping address', 'woocommerce'); ?></h3>
|
||||
|
||||
<p><?php echo $order->get_formatted_shipping_address(); ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="clear:both;"></div>
|
||||
|
||||
<?php endif; ?>
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
/**
|
||||
* My Addresses
|
||||
*/
|
||||
|
||||
global $woocommerce;
|
||||
|
||||
$customer_id = get_current_user_id();
|
||||
?>
|
||||
|
||||
<?php if (get_option('woocommerce_ship_to_billing_address_only')=='no') : ?>
|
||||
|
||||
<div class="col2-set addresses">
|
||||
|
||||
<div class="col-1">
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<header class="title">
|
||||
<h3><?php _e('Billing Address', 'woocommerce'); ?></h3>
|
||||
<a href="<?php echo esc_url( add_query_arg('address', 'billing', get_permalink(woocommerce_get_page_id('edit_address'))) ); ?>" class="edit"><?php _e('Edit', 'woocommerce'); ?></a>
|
||||
</header>
|
||||
<address>
|
||||
<?php
|
||||
$address = array(
|
||||
'first_name' => get_user_meta( $customer_id, 'billing_first_name', true ),
|
||||
'last_name' => get_user_meta( $customer_id, 'billing_last_name', true ),
|
||||
'company' => get_user_meta( $customer_id, 'billing_company', true ),
|
||||
'address_1' => get_user_meta( $customer_id, 'billing_address_1', true ),
|
||||
'address_2' => get_user_meta( $customer_id, 'billing_address_2', true ),
|
||||
'city' => get_user_meta( $customer_id, 'billing_city', true ),
|
||||
'state' => get_user_meta( $customer_id, 'billing_state', true ),
|
||||
'postcode' => get_user_meta( $customer_id, 'billing_postcode', true ),
|
||||
'country' => get_user_meta( $customer_id, 'billing_country', true )
|
||||
);
|
||||
|
||||
$formatted_address = $woocommerce->countries->get_formatted_address( $address );
|
||||
|
||||
if (!$formatted_address) _e('You have not set up a billing address yet.', 'woocommerce'); else echo $formatted_address;
|
||||
?>
|
||||
</address>
|
||||
|
||||
|
||||
<?php if (get_option('woocommerce_ship_to_billing_address_only')=='no') : ?>
|
||||
|
||||
</div><!-- /.col-1 -->
|
||||
|
||||
<div class="col-2">
|
||||
|
||||
<header class="title">
|
||||
<h3><?php _e('Shipping Address', 'woocommerce'); ?></h3>
|
||||
<a href="<?php echo esc_url( add_query_arg('address', 'shipping', get_permalink(woocommerce_get_page_id('edit_address'))) ); ?>" class="edit"><?php _e('Edit', 'woocommerce'); ?></a>
|
||||
</header>
|
||||
<address>
|
||||
<?php
|
||||
$address = array(
|
||||
'first_name' => get_user_meta( $customer_id, 'shipping_first_name', true ),
|
||||
'last_name' => get_user_meta( $customer_id, 'shipping_last_name', true ),
|
||||
'company' => get_user_meta( $customer_id, 'shipping_company', true ),
|
||||
'address_1' => get_user_meta( $customer_id, 'shipping_address_1', true ),
|
||||
'address_2' => get_user_meta( $customer_id, 'shipping_address_2', true ),
|
||||
'city' => get_user_meta( $customer_id, 'shipping_city', true ),
|
||||
'state' => get_user_meta( $customer_id, 'shipping_state', true ),
|
||||
'postcode' => get_user_meta( $customer_id, 'shipping_postcode', true ),
|
||||
'country' => get_user_meta( $customer_id, 'shipping_country', true )
|
||||
);
|
||||
|
||||
$formatted_address = $woocommerce->countries->get_formatted_address( $address );
|
||||
|
||||
if (!$formatted_address) _e('You have not set up a shipping address yet.', 'woocommerce'); else echo $formatted_address;
|
||||
?>
|
||||
</address>
|
||||
|
||||
</div><!-- /.col-2 -->
|
||||
|
||||
</div><!-- /.col2-set -->
|
||||
|
||||
<?php endif; ?>
|
Loading…
Reference in New Issue