Version Description
- Fixed: Billing State and Shipping State required validation
- Fixed: Display required state for Billing Address 2 and Shipping Address 2 (thanks James)
Download this release
Release Info
Developer | visser |
Plugin | WooCommerce Checkout Manager |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.7 to 4.2
- includes/admin.php +108 -77
- includes/checkout-billing.php +17 -0
- includes/checkout.php +20 -1
- includes/classes/field_filters.php +15 -13
- includes/email.php +267 -260
- includes/install.php +2 -2
- includes/pickers/css/backend_css.css +11 -4
- includes/template.php +49 -6
- includes/templates/admin/edit-order-uploads-file_editing_table.css +18 -1
- includes/templates/admin/woocheckout-general-uploads.php +1 -1
- includes/templates/functions/add_wooccmupload.php +2 -4
- includes/templates/functions/required/billing_required.php +6 -6
- includes/templates/functions/shipping_wooccmupload.php +1 -1
- readme.txt +14 -2
- woocommerce-checkout-manager.php +4 -3
includes/admin.php
CHANGED
@@ -81,7 +81,8 @@ function wooccm_admin_notice_print() {
|
|
81 |
function wooccm_admin_menu() {
|
82 |
|
83 |
add_menu_page( 'WooCheckout', 'WooCheckout', 'manage_options', 'woocommerce-checkout-manager' , 'wooccm_options_page', 'dashicons-businessman', 57);
|
84 |
-
|
|
|
85 |
|
86 |
}
|
87 |
add_action( 'admin_menu', 'wooccm_admin_menu' );
|
@@ -677,7 +678,7 @@ function wooccm_options_validate( $input ) {
|
|
677 |
|
678 |
$detect_error = 0;
|
679 |
// translate additional fields
|
680 |
-
if( !empty($input['buttons']) ) {
|
681 |
foreach( $input['buttons'] as $i => $btn ) {
|
682 |
|
683 |
if( function_exists( 'icl_register_string' ) ) {
|
@@ -690,7 +691,7 @@ function wooccm_options_validate( $input ) {
|
|
690 |
|
691 |
if( !empty($btn['option_array']) ) {
|
692 |
$mysecureop = explode( '||', $btn['option_array']);
|
693 |
-
foreach
|
694 |
icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
|
695 |
}
|
696 |
}
|
@@ -892,18 +893,18 @@ function wooccm_options_validate_billing( $input ) {
|
|
892 |
$detect_error = 0;
|
893 |
|
894 |
// translate billing fields
|
895 |
-
if( !empty($input['billing_buttons']) ) {
|
896 |
foreach( $input['billing_buttons'] as $i => $btn ) {
|
897 |
|
898 |
if( function_exists( 'icl_register_string' ) ) {
|
899 |
if( !empty($btn['label']) ) {
|
900 |
-
icl_register_string( 'WooCommerce Checkout Manager', $btn['label'], $btn['label']);
|
901 |
}
|
902 |
if( !empty($btn['placeholder']) ) {
|
903 |
-
icl_register_string( 'WooCommerce Checkout Manager', $btn['placeholder'], $btn['placeholder']);
|
904 |
}
|
905 |
|
906 |
-
if
|
907 |
$mysecureop = explode( '||', $btn['option_array']);
|
908 |
foreach( $mysecureop as $one ) {
|
909 |
icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
|
@@ -1143,6 +1144,7 @@ function wooccm_admin_edit_order_additional_details( $order ) {
|
|
1143 |
<p> </p>
|
1144 |
<h4>' . __( 'Additional Details', 'woocommerce-checkout-manager' ) . '</h4>';
|
1145 |
foreach( $buttons as $btn ) {
|
|
|
1146 |
if(
|
1147 |
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
1148 |
!empty( $btn['label'] ) &&
|
@@ -1207,19 +1209,26 @@ function wooccm_admin_edit_order_additional_details( $order ) {
|
|
1207 |
$attachments = ( $attachments !== '' ? explode( ",", $attachments ) : false );
|
1208 |
echo '
|
1209 |
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1210 |
-
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong
|
|
|
|
|
|
|
|
|
|
|
|
|
1211 |
if( !empty( $attachments ) ) {
|
|
|
1212 |
foreach( $attachments as $attachment ) {
|
1213 |
$attachment_url = wp_get_attachment_url( $attachment );
|
1214 |
-
|
|
|
1215 |
}
|
1216 |
-
|
1217 |
-
echo '-';
|
1218 |
}
|
1219 |
echo '
|
1220 |
-
</p>
|
1221 |
<!-- .form-field-type-wooccmupload -->';
|
1222 |
}
|
|
|
1223 |
}
|
1224 |
}
|
1225 |
|
@@ -1249,6 +1258,7 @@ function wooccm_admin_edit_order_billing_details( $order ) {
|
|
1249 |
'phone'
|
1250 |
);
|
1251 |
foreach( $buttons as $btn ) {
|
|
|
1252 |
if( !in_array( $btn['cow'], $fields ) ) {
|
1253 |
if(
|
1254 |
( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) !== '' ) &&
|
@@ -1318,20 +1328,27 @@ function wooccm_admin_edit_order_billing_details( $order ) {
|
|
1318 |
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
1319 |
echo '
|
1320 |
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1321 |
-
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong
|
|
|
|
|
|
|
|
|
|
|
|
|
1322 |
if( !empty( $attachments ) ) {
|
|
|
1323 |
foreach( $attachments as $attachment ) {
|
1324 |
$attachment_url = wp_get_attachment_url( $attachment );
|
1325 |
-
|
|
|
1326 |
}
|
1327 |
-
|
1328 |
-
echo '-';
|
1329 |
}
|
1330 |
echo '
|
1331 |
-
</p>
|
1332 |
<!-- .form-field-type-wooccmupload -->';
|
1333 |
}
|
1334 |
}
|
|
|
1335 |
}
|
1336 |
}
|
1337 |
|
@@ -1427,17 +1444,23 @@ function wooccm_admin_edit_order_shipping_details( $order ) {
|
|
1427 |
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
1428 |
echo '
|
1429 |
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1430 |
-
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong
|
|
|
|
|
|
|
|
|
|
|
|
|
1431 |
if( !empty( $attachments ) ) {
|
|
|
1432 |
foreach( $attachments as $attachment ) {
|
1433 |
$attachment_url = wp_get_attachment_url( $attachment );
|
1434 |
-
|
|
|
1435 |
}
|
1436 |
-
|
1437 |
-
echo '-';
|
1438 |
}
|
1439 |
echo '
|
1440 |
-
</p>
|
1441 |
<!-- .form-field-type-wooccmupload -->';
|
1442 |
}
|
1443 |
}
|
@@ -1591,10 +1614,10 @@ jQuery(document).ready(function($) {
|
|
1591 |
<attr title="<?php _e( 'Attachment ID', 'woocommerce-checkout-manager' ); ?>"><?php _e('ID','woocommerce-checkout-manager'); ?></attr>
|
1592 |
</th>
|
1593 |
<th><?php _e( 'Image', 'woocommerce-checkout-manager' ); ?></th>
|
1594 |
-
<th><?php _e( '
|
1595 |
<th><?php _e( 'Dimensions', 'woocommerce-checkout-manager' ); ?></th>
|
1596 |
<th><?php _e( 'Extension',' woocommerce-checkout-manager' ); ?></th>
|
1597 |
-
<th><?php _e( '
|
1598 |
</tr>
|
1599 |
</thead>
|
1600 |
|
@@ -1623,11 +1646,8 @@ jQuery(document).ready(function($) {
|
|
1623 |
});
|
1624 |
</script>
|
1625 |
<td>' . $attachment_id . '</td>
|
1626 |
-
<td>' . wp_get_attachment_image( $attachment_id, array( 75, 75 ),
|
1627 |
-
<td
|
1628 |
-
<a href="' . $image_attributes2[0] . '" target="_blank">' . __( 'Download', 'woocommerce-checkout-manager' ) . '</a><br />
|
1629 |
-
<a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . '" data-tip="' . __( 'Delete image', 'woocommerce-checkout-manager' ) . '">' . __( 'Delete', 'woocommerce-checkout-manager' ) . '</a>
|
1630 |
-
</td>
|
1631 |
<td>';
|
1632 |
if( $image_attributes2[1] == '' ) {
|
1633 |
echo '-';
|
@@ -1636,7 +1656,10 @@ jQuery(document).ready(function($) {
|
|
1636 |
}
|
1637 |
echo '</td>
|
1638 |
<td>' . strtoupper( $wp_filetype['ext'] ) . '</td>
|
1639 |
-
<td
|
|
|
|
|
|
|
1640 |
</tr>
|
1641 |
';
|
1642 |
|
@@ -1692,14 +1715,14 @@ jQuery(document).ready(function($) {
|
|
1692 |
|
1693 |
if(formdata) {
|
1694 |
$.ajax({
|
1695 |
-
url: "<?php echo admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id='.$
|
1696 |
type: "POST",
|
1697 |
data: formdata,
|
1698 |
processData: false,
|
1699 |
contentType: false,
|
1700 |
success: function (res) {
|
1701 |
$('#files_wccm').show();
|
1702 |
-
$(".wccm_results").html("Files
|
1703 |
/* $(".wccm_results").html(res); */
|
1704 |
|
1705 |
$.ajax({
|
@@ -1707,7 +1730,7 @@ jQuery(document).ready(function($) {
|
|
1707 |
data: {},
|
1708 |
success: function (data) {
|
1709 |
$("div#product_images_container").html($(data).find("div#product_images_container"));
|
1710 |
-
$(".wccm_results").html("Files
|
1711 |
/* $(".wccm_results").html(data); */
|
1712 |
},
|
1713 |
dataType: 'html'
|
@@ -1799,7 +1822,7 @@ jQuery(document).ready(function($) {
|
|
1799 |
|
1800 |
<?php wp_enqueue_style( 'wccm_upload_file_style', plugins_url( 'includes/templates/admin/edit-order-uploads-file_editing_table.css', WOOCCM_RELPATH ) ); ?>
|
1801 |
|
1802 |
-
<h2><?php echo ( empty( $options['checkness']['upload_title'] )
|
1803 |
<div class="woocommerce_order_items_wrapper front_end">
|
1804 |
<table class="woocommerce_order_items front_end">
|
1805 |
|
@@ -1807,11 +1830,10 @@ jQuery(document).ready(function($) {
|
|
1807 |
<tr>
|
1808 |
<th style="width:15%;text-align: center;"><?php _e( 'Attachment ID', 'woocommerce-checkout-manager' ); ?></th>
|
1809 |
<th style="width:12%"><?php _e( 'Image', 'woocommerce-checkout-manager' ); ?></th>
|
1810 |
-
<th style="width:
|
1811 |
<th style="width:12%"><?php _e( 'Dimensions', 'woocommerce-checkout-manager' ); ?></th>
|
1812 |
<th style="width:8%"><?php _e( 'Extension' ,'woocommerce-checkout-manager' ); ?></th>
|
1813 |
-
<th style="width:
|
1814 |
-
<th style="width:30%;text-align: center;"><?php _e( 'Name', 'woocommerce-checkout-manager' ); ?></th>
|
1815 |
</tr>
|
1816 |
</thead>
|
1817 |
|
@@ -1846,9 +1868,7 @@ jQuery(document).ready(function($) {
|
|
1846 |
</td>
|
1847 |
<td>'.$attachment_id.'</td>
|
1848 |
<td>'.wp_get_attachment_link( $attachment_id, '' , false, false, wp_get_attachment_image( $attachment_id, array(75,75), true ) ).'</td>
|
1849 |
-
<td>
|
1850 |
-
<a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . '" data-tip="' . __( 'Delete image', 'woocommerce-checkout-manager' ) . '">' . __( 'Delete', 'woocommerce-checkout-manager' ) . '</a>
|
1851 |
-
</td>
|
1852 |
<td>';
|
1853 |
if( $image_attributes2[1] == '' ) {
|
1854 |
echo '-';
|
@@ -1857,9 +1877,10 @@ jQuery(document).ready(function($) {
|
|
1857 |
}
|
1858 |
echo '
|
1859 |
</td>
|
1860 |
-
<td>'
|
1861 |
-
<td
|
1862 |
-
|
|
|
1863 |
</tr>';
|
1864 |
}
|
1865 |
} else {
|
@@ -1878,7 +1899,7 @@ jQuery(document).ready(function($) {
|
|
1878 |
</div>
|
1879 |
<!-- .woocommerce_order_items_wrapper -->
|
1880 |
|
1881 |
-
<button type="button" id="wccm_save_order_submit" class="file_upload_delete wooccm-btn wooccm-btn-danger delete"
|
1882 |
|
1883 |
<span id="wccm_uploader_select">
|
1884 |
<input type="file" style="display:none;" name="files_wccm" id="files_wccm" multiple />
|
@@ -1916,7 +1937,7 @@ jQuery(document).ready(function($){
|
|
1916 |
|
1917 |
var length = '.$length.';
|
1918 |
var file_array = ' . wooccm_js_array( $file_types ) . ';
|
1919 |
-
var wooempt = ' . implode( ',', $file_types ) . ';
|
1920 |
|
1921 |
for ( i = 0; i < length; i++ ) {
|
1922 |
file = this.files[i];
|
@@ -1931,7 +1952,7 @@ jQuery(document).ready(function($){
|
|
1931 |
|
1932 |
if (formdata) {
|
1933 |
$.ajax({
|
1934 |
-
url: "'.admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id='.$
|
1935 |
type: "POST",
|
1936 |
data: formdata,
|
1937 |
processData: false,
|
@@ -1972,8 +1993,6 @@ function wccs_upload_file_func_callback( $order_id ) {
|
|
1972 |
|
1973 |
$order_id = ( isset( $_REQUEST['order_id'] ) ? absint( $_REQUEST['order_id'] ) : false );
|
1974 |
|
1975 |
-
$order = new WC_Order( $order_id );
|
1976 |
-
|
1977 |
// load files
|
1978 |
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1979 |
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
@@ -1992,6 +2011,9 @@ function wccs_upload_file_func_callback( $order_id ) {
|
|
1992 |
die();
|
1993 |
}
|
1994 |
|
|
|
|
|
|
|
1995 |
$files = $_FILES[''. $name .''];
|
1996 |
// $upload_overrides = array( 'test_form' => false );
|
1997 |
|
@@ -2010,7 +2032,7 @@ function wccs_upload_file_func_callback( $order_id ) {
|
|
2010 |
);
|
2011 |
|
2012 |
// $movefile = wp_handle_upload($file, $upload_overrides);
|
2013 |
-
$movefile = wp_handle_upload($file);
|
2014 |
|
2015 |
// Check if the save process failed
|
2016 |
if( isset( $movefile['error'] ) ) {
|
@@ -2036,20 +2058,7 @@ function wccs_upload_file_func_callback( $order_id ) {
|
|
2036 |
$attach_data = wp_generate_attachment_metadata( $attach_id, $movefile['url'] );
|
2037 |
wp_update_attachment_metadata( $attach_id, $attach_data );
|
2038 |
|
2039 |
-
|
2040 |
-
$email_recipients = $options['checkness']['wooccm_notification_email'];
|
2041 |
-
$message_content = '
|
2042 |
-
This is an automatic message from WooCommerce Checkout Manager, reporting that files has been uploaded by '.$order->billing_first_name.' '.$order->billing_last_name.'.<br />
|
2043 |
-
<h3>Customer Details</h3>
|
2044 |
-
Name: '.$order->billing_first_name.' '.$order->billing_last_name.'<br />
|
2045 |
-
E-mail: '.$order->billing_email.'<br />
|
2046 |
-
Order Number: '.$order_id.' <br />
|
2047 |
-
You can view the files and order details via back-end by following this <a href="'.admin_url('/post.php?post='.$order_id.'&action=edit').'">link</a>.
|
2048 |
-
';
|
2049 |
-
|
2050 |
-
add_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2051 |
-
wp_mail( $email_recipients, sprintf( __( 'WooCommerce Checkout Manager - Files Uploaded by Customer [%s]', 'woocommerce-checkout-manager' ), $order->billing_first_name . ' ' . $order->billing_last_name ), $message_content );
|
2052 |
-
remove_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2053 |
|
2054 |
} else {
|
2055 |
|
@@ -2080,24 +2089,46 @@ You can view the files and order details via back-end by following this <a href=
|
|
2080 |
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
2081 |
$attach_data = wp_generate_attachment_metadata( $attach_id, $URLpath );
|
2082 |
wp_update_attachment_metadata( $attach_id, $attach_data );
|
2083 |
-
// send email
|
2084 |
-
$email_recipients = get_option('admin_email');
|
2085 |
-
$message_content = '
|
2086 |
-
This is an automatic message from WooCommerce Checkout Manager, reporting that files has been uploaded by '.$order->billing_first_name.' '.$order->billing_last_name.'.<br />
|
2087 |
-
<h3>Customer Details</h3>
|
2088 |
-
Name: '.$order->billing_first_name.' '.$order->billing_last_name.'<br />
|
2089 |
-
E-mail: '.$order->billing_email.'<br />
|
2090 |
-
Order Number: '.$order_id.' <br />
|
2091 |
-
You can view the files and order details via back-end by following this <a href="'.admin_url( '/post.php?post='.$order_id.'&action=edit' ).'">link</a>.
|
2092 |
-
';
|
2093 |
|
2094 |
-
|
2095 |
-
wp_mail( $email_recipients, __( 'WooCommerce Checkout Manager - Files Uploaded by Customer', 'woocommerce-checkout-manager' ), $message_content );
|
2096 |
-
remove_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2097 |
|
2098 |
}
|
2099 |
}
|
2100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2101 |
echo ' '.__('Files were uploaded successfully.','woocommerce-checkout-manager').'';
|
2102 |
} else {
|
2103 |
echo ' '.__('No uploads were recognised. Files were not uploaded.','woocommerce-checkout-manager').'';
|
@@ -2141,7 +2172,7 @@ function update_attachment_wccm_callback() {
|
|
2141 |
wp_delete_attachment( $attachment_ids[$key] );
|
2142 |
}
|
2143 |
}
|
2144 |
-
echo __('Deleted
|
2145 |
}
|
2146 |
die();
|
2147 |
|
81 |
function wooccm_admin_menu() {
|
82 |
|
83 |
add_menu_page( 'WooCheckout', 'WooCheckout', 'manage_options', 'woocommerce-checkout-manager' , 'wooccm_options_page', 'dashicons-businessman', 57);
|
84 |
+
// @mod - Remove until exports are fixed...
|
85 |
+
// add_submenu_page( 'woocommerce-checkout-manager', 'Export', 'Export', 'manage_options', 'wooccm-advance-export', 'wooccm_advance_export' );
|
86 |
|
87 |
}
|
88 |
add_action( 'admin_menu', 'wooccm_admin_menu' );
|
678 |
|
679 |
$detect_error = 0;
|
680 |
// translate additional fields
|
681 |
+
if( !empty( $input['buttons'] ) ) {
|
682 |
foreach( $input['buttons'] as $i => $btn ) {
|
683 |
|
684 |
if( function_exists( 'icl_register_string' ) ) {
|
691 |
|
692 |
if( !empty($btn['option_array']) ) {
|
693 |
$mysecureop = explode( '||', $btn['option_array']);
|
694 |
+
foreach( $mysecureop as $one ) {
|
695 |
icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
|
696 |
}
|
697 |
}
|
893 |
$detect_error = 0;
|
894 |
|
895 |
// translate billing fields
|
896 |
+
if( !empty( $input['billing_buttons'] ) ) {
|
897 |
foreach( $input['billing_buttons'] as $i => $btn ) {
|
898 |
|
899 |
if( function_exists( 'icl_register_string' ) ) {
|
900 |
if( !empty($btn['label']) ) {
|
901 |
+
icl_register_string( 'WooCommerce Checkout Manager', $btn['label'], $btn['label'] );
|
902 |
}
|
903 |
if( !empty($btn['placeholder']) ) {
|
904 |
+
icl_register_string( 'WooCommerce Checkout Manager', $btn['placeholder'], $btn['placeholder'] );
|
905 |
}
|
906 |
|
907 |
+
if( !empty($btn['option_array']) ) {
|
908 |
$mysecureop = explode( '||', $btn['option_array']);
|
909 |
foreach( $mysecureop as $one ) {
|
910 |
icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
|
1144 |
<p> </p>
|
1145 |
<h4>' . __( 'Additional Details', 'woocommerce-checkout-manager' ) . '</h4>';
|
1146 |
foreach( $buttons as $btn ) {
|
1147 |
+
|
1148 |
if(
|
1149 |
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
1150 |
!empty( $btn['label'] ) &&
|
1209 |
$attachments = ( $attachments !== '' ? explode( ",", $attachments ) : false );
|
1210 |
echo '
|
1211 |
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1212 |
+
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong>';
|
1213 |
+
if( empty( $attachments ) ) {
|
1214 |
+
echo '<br />';
|
1215 |
+
echo '-';
|
1216 |
+
}
|
1217 |
+
echo '
|
1218 |
+
</p>' . "\n";
|
1219 |
if( !empty( $attachments ) ) {
|
1220 |
+
echo '<ul>' . "\n";
|
1221 |
foreach( $attachments as $attachment ) {
|
1222 |
$attachment_url = wp_get_attachment_url( $attachment );
|
1223 |
+
if( !empty( $attachment_url ) )
|
1224 |
+
echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a></li>' . "\n";
|
1225 |
}
|
1226 |
+
echo '</ul>';
|
|
|
1227 |
}
|
1228 |
echo '
|
|
|
1229 |
<!-- .form-field-type-wooccmupload -->';
|
1230 |
}
|
1231 |
+
|
1232 |
}
|
1233 |
}
|
1234 |
|
1258 |
'phone'
|
1259 |
);
|
1260 |
foreach( $buttons as $btn ) {
|
1261 |
+
|
1262 |
if( !in_array( $btn['cow'], $fields ) ) {
|
1263 |
if(
|
1264 |
( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) !== '' ) &&
|
1328 |
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
1329 |
echo '
|
1330 |
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1331 |
+
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong>';
|
1332 |
+
if( empty( $attachments ) ) {
|
1333 |
+
echo '<br />';
|
1334 |
+
echo '-';
|
1335 |
+
}
|
1336 |
+
echo '
|
1337 |
+
</p>' . "\n";
|
1338 |
if( !empty( $attachments ) ) {
|
1339 |
+
echo '<ul>' . "\n";
|
1340 |
foreach( $attachments as $attachment ) {
|
1341 |
$attachment_url = wp_get_attachment_url( $attachment );
|
1342 |
+
if( !empty( $attachment_url ) )
|
1343 |
+
echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a></li>' . "\n";
|
1344 |
}
|
1345 |
+
echo '</ul>';
|
|
|
1346 |
}
|
1347 |
echo '
|
|
|
1348 |
<!-- .form-field-type-wooccmupload -->';
|
1349 |
}
|
1350 |
}
|
1351 |
+
|
1352 |
}
|
1353 |
}
|
1354 |
|
1444 |
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
1445 |
echo '
|
1446 |
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1447 |
+
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong>';
|
1448 |
+
if( empty( $attachments ) ) {
|
1449 |
+
echo '<br />';
|
1450 |
+
echo '-';
|
1451 |
+
}
|
1452 |
+
echo '
|
1453 |
+
</p>' . "\n";
|
1454 |
if( !empty( $attachments ) ) {
|
1455 |
+
echo '<ul>' . "\n";
|
1456 |
foreach( $attachments as $attachment ) {
|
1457 |
$attachment_url = wp_get_attachment_url( $attachment );
|
1458 |
+
if( !empty( $attachment_url ) )
|
1459 |
+
echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a></li>' . "\n";
|
1460 |
}
|
1461 |
+
echo '</ul>';
|
|
|
1462 |
}
|
1463 |
echo '
|
|
|
1464 |
<!-- .form-field-type-wooccmupload -->';
|
1465 |
}
|
1466 |
}
|
1614 |
<attr title="<?php _e( 'Attachment ID', 'woocommerce-checkout-manager' ); ?>"><?php _e('ID','woocommerce-checkout-manager'); ?></attr>
|
1615 |
</th>
|
1616 |
<th><?php _e( 'Image', 'woocommerce-checkout-manager' ); ?></th>
|
1617 |
+
<th><?php _e( 'Filename', 'woocommerce-checkout-manager' ); ?></th>
|
1618 |
<th><?php _e( 'Dimensions', 'woocommerce-checkout-manager' ); ?></th>
|
1619 |
<th><?php _e( 'Extension',' woocommerce-checkout-manager' ); ?></th>
|
1620 |
+
<th class="column-actions"><?php _e( 'Actions', 'woocommerce-checkout-manager' ); ?></th>
|
1621 |
</tr>
|
1622 |
</thead>
|
1623 |
|
1646 |
});
|
1647 |
</script>
|
1648 |
<td>' . $attachment_id . '</td>
|
1649 |
+
<td>' . wp_get_attachment_link( $attachment_id, '' , false, false, wp_get_attachment_image( $attachment_id, array( 75, 75 ), false ) ) . '</td>
|
1650 |
+
<td>' . wp_get_attachment_link( $attachment_id, '' , false, false, preg_replace( '/\.[^.]+$/', '', $filename ) ) . '</td>
|
|
|
|
|
|
|
1651 |
<td>';
|
1652 |
if( $image_attributes2[1] == '' ) {
|
1653 |
echo '-';
|
1656 |
}
|
1657 |
echo '</td>
|
1658 |
<td>' . strtoupper( $wp_filetype['ext'] ) . '</td>
|
1659 |
+
<td class="column-actions" nowrap>
|
1660 |
+
<a href="' . $image_attributes2[0] . '" target="_blank" class="button">' . __( 'Download', 'woocommerce-checkout-manager' ) . '</a>
|
1661 |
+
<a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . ' button" data-tip="' . __( 'Delete file', 'woocommerce-checkout-manager' ) . '">' . __( 'Delete file', 'woocommerce-checkout-manager' ) . '</a>
|
1662 |
+
</td>
|
1663 |
</tr>
|
1664 |
';
|
1665 |
|
1715 |
|
1716 |
if(formdata) {
|
1717 |
$.ajax({
|
1718 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id='.$order_id.'&name=files_wccm'); ?>",
|
1719 |
type: "POST",
|
1720 |
data: formdata,
|
1721 |
processData: false,
|
1722 |
contentType: false,
|
1723 |
success: function (res) {
|
1724 |
$('#files_wccm').show();
|
1725 |
+
$(".wccm_results").html("Files uploaded successfully.");
|
1726 |
/* $(".wccm_results").html(res); */
|
1727 |
|
1728 |
$.ajax({
|
1730 |
data: {},
|
1731 |
success: function (data) {
|
1732 |
$("div#product_images_container").html($(data).find("div#product_images_container"));
|
1733 |
+
$(".wccm_results").html("Files uploaded successfully.");
|
1734 |
/* $(".wccm_results").html(data); */
|
1735 |
},
|
1736 |
dataType: 'html'
|
1822 |
|
1823 |
<?php wp_enqueue_style( 'wccm_upload_file_style', plugins_url( 'includes/templates/admin/edit-order-uploads-file_editing_table.css', WOOCCM_RELPATH ) ); ?>
|
1824 |
|
1825 |
+
<h2><?php echo ( empty( $options['checkness']['upload_title'] ) ? 'Order Uploaded Files' : esc_attr( $options['checkness']['upload_title'] ) ); ?></h2>
|
1826 |
<div class="woocommerce_order_items_wrapper front_end">
|
1827 |
<table class="woocommerce_order_items front_end">
|
1828 |
|
1830 |
<tr>
|
1831 |
<th style="width:15%;text-align: center;"><?php _e( 'Attachment ID', 'woocommerce-checkout-manager' ); ?></th>
|
1832 |
<th style="width:12%"><?php _e( 'Image', 'woocommerce-checkout-manager' ); ?></th>
|
1833 |
+
<th style="width:30%;text-align: center;"><?php _e( 'Name', 'woocommerce-checkout-manager' ); ?></th>
|
1834 |
<th style="width:12%"><?php _e( 'Dimensions', 'woocommerce-checkout-manager' ); ?></th>
|
1835 |
<th style="width:8%"><?php _e( 'Extension' ,'woocommerce-checkout-manager' ); ?></th>
|
1836 |
+
<th style="width:10%" class="column-actions"><?php _e( 'Actions', 'woocommerce-checkout-manager' ); ?></th>
|
|
|
1837 |
</tr>
|
1838 |
</thead>
|
1839 |
|
1868 |
</td>
|
1869 |
<td>'.$attachment_id.'</td>
|
1870 |
<td>'.wp_get_attachment_link( $attachment_id, '' , false, false, wp_get_attachment_image( $attachment_id, array(75,75), true ) ).'</td>
|
1871 |
+
<td>'.wp_get_attachment_link( $attachment_id, '' , false, false, preg_replace( '/\.[^.]+$/', '', $filename ) ).'</td>
|
|
|
|
|
1872 |
<td>';
|
1873 |
if( $image_attributes2[1] == '' ) {
|
1874 |
echo '-';
|
1877 |
}
|
1878 |
echo '
|
1879 |
</td>
|
1880 |
+
<td>' . strtoupper( $wp_filetype['ext'] ) . '</td>
|
1881 |
+
<td class="column-actions" nowrap>
|
1882 |
+
<a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . ' button" data-tip="' . __( 'Delete file', 'woocommerce-checkout-manager' ) . '">' . __( 'Delete file', 'woocommerce-checkout-manager' ) . '</a>
|
1883 |
+
</td>
|
1884 |
</tr>';
|
1885 |
}
|
1886 |
} else {
|
1899 |
</div>
|
1900 |
<!-- .woocommerce_order_items_wrapper -->
|
1901 |
|
1902 |
+
<button type="button" id="wccm_save_order_submit" class="file_upload_delete wooccm-btn wooccm-btn-danger delete"><?php _e( 'Confirm Delete', 'woocommerce-checkout-manager' ); ?></button>
|
1903 |
|
1904 |
<span id="wccm_uploader_select">
|
1905 |
<input type="file" style="display:none;" name="files_wccm" id="files_wccm" multiple />
|
1937 |
|
1938 |
var length = '.$length.';
|
1939 |
var file_array = ' . wooccm_js_array( $file_types ) . ';
|
1940 |
+
var wooempt = "' . implode( ',', $file_types ) . '";
|
1941 |
|
1942 |
for ( i = 0; i < length; i++ ) {
|
1943 |
file = this.files[i];
|
1952 |
|
1953 |
if (formdata) {
|
1954 |
$.ajax({
|
1955 |
+
url: "'.admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id='.$order_id.'&name=files_wccm').'",
|
1956 |
type: "POST",
|
1957 |
data: formdata,
|
1958 |
processData: false,
|
1993 |
|
1994 |
$order_id = ( isset( $_REQUEST['order_id'] ) ? absint( $_REQUEST['order_id'] ) : false );
|
1995 |
|
|
|
|
|
1996 |
// load files
|
1997 |
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1998 |
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
2011 |
die();
|
2012 |
}
|
2013 |
|
2014 |
+
$has_uploads = false;
|
2015 |
+
$order = new WC_Order( $order_id );
|
2016 |
+
|
2017 |
$files = $_FILES[''. $name .''];
|
2018 |
// $upload_overrides = array( 'test_form' => false );
|
2019 |
|
2032 |
);
|
2033 |
|
2034 |
// $movefile = wp_handle_upload($file, $upload_overrides);
|
2035 |
+
$movefile = wp_handle_upload( $file );
|
2036 |
|
2037 |
// Check if the save process failed
|
2038 |
if( isset( $movefile['error'] ) ) {
|
2058 |
$attach_data = wp_generate_attachment_metadata( $attach_id, $movefile['url'] );
|
2059 |
wp_update_attachment_metadata( $attach_id, $attach_data );
|
2060 |
|
2061 |
+
$has_uploads = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2062 |
|
2063 |
} else {
|
2064 |
|
2089 |
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
2090 |
$attach_data = wp_generate_attachment_metadata( $attach_id, $URLpath );
|
2091 |
wp_update_attachment_metadata( $attach_id, $attach_data );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2092 |
|
2093 |
+
$has_uploads = true;
|
|
|
|
|
2094 |
|
2095 |
}
|
2096 |
}
|
2097 |
}
|
2098 |
+
if( $has_uploads ) {
|
2099 |
+
|
2100 |
+
// send email
|
2101 |
+
$email_recipients = $options['checkness']['wooccm_notification_email'];
|
2102 |
+
if( empty( $email_recipients ) )
|
2103 |
+
$email_recipients = get_option( 'admin_email' );
|
2104 |
+
$email_heading = __( 'Files Uploaded by Customer', 'woocommerce-checkout-manager' );
|
2105 |
+
$subject = sprintf( __( 'WooCommerce Checkout Manager - %s [%s]', 'woocommerce-checkout-manager' ), $email_heading, $order->billing_first_name . ' ' . $order->billing_last_name );
|
2106 |
+
|
2107 |
+
$mailer = WC()->mailer();
|
2108 |
+
|
2109 |
+
// Buffer
|
2110 |
+
ob_start();
|
2111 |
+
?>
|
2112 |
+
<p>This is an automatic message from WooCommerce Checkout Manager, reporting that files have been uploaded by <?php echo $order->billing_first_name; ?> <?php echo $order->billing_last_name; ?>.</p>
|
2113 |
+
<h3>Customer Details</h3>
|
2114 |
+
<ul>
|
2115 |
+
<li>Name: <?php echo $order->billing_first_name; ?> <?php $order->billing_last_name; ?></li>
|
2116 |
+
<li>E-mail: <?php echo $order->billing_email; ?></li>
|
2117 |
+
<li>Order Number: <?php echo $order_id; ?></li>
|
2118 |
+
</ul>
|
2119 |
+
<p>You can view the files and order details via back-end by following this <a href="<?php echo admin_url( '/post.php?post='.$order_id.'&action=edit' ); ?>" target="_blank">link</a>.</p>
|
2120 |
+
<?php
|
2121 |
+
// Get contents
|
2122 |
+
$message = ob_get_clean();
|
2123 |
+
|
2124 |
+
$message = $mailer->wrap_message( $email_heading, $message );
|
2125 |
+
|
2126 |
+
// add_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2127 |
+
// wc_mail( $email_recipients, $subject, $message );
|
2128 |
+
$mailer->send( $email_recipients, strip_tags( $subject ), $message );
|
2129 |
+
// remove_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2130 |
+
|
2131 |
+
}
|
2132 |
echo ' '.__('Files were uploaded successfully.','woocommerce-checkout-manager').'';
|
2133 |
} else {
|
2134 |
echo ' '.__('No uploads were recognised. Files were not uploaded.','woocommerce-checkout-manager').'';
|
2172 |
wp_delete_attachment( $attachment_ids[$key] );
|
2173 |
}
|
2174 |
}
|
2175 |
+
echo __('Deleted successfully.','woocommerce-checkout-manager');
|
2176 |
}
|
2177 |
die();
|
2178 |
|
includes/checkout-billing.php
CHANGED
@@ -63,6 +63,23 @@ function wooccm_checkout_billing_fields( $fields ) {
|
|
63 |
$fields[$key]['class'][] = 'address-field';
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
// Remove disabled fields
|
67 |
if( !empty( $btn['disabled'] ) ) {
|
68 |
unset( $fields[$key] );
|
63 |
$fields[$key]['class'][] = 'address-field';
|
64 |
}
|
65 |
|
66 |
+
// Override for State fields
|
67 |
+
if( $fields[$key]['type'] == 'wooccmstate' ) {
|
68 |
+
$country_key = false;
|
69 |
+
if( $key == 'billing_state' )
|
70 |
+
$country_key = 'billing_country';
|
71 |
+
if( $key == 'shipping_state' )
|
72 |
+
$country_key = 'shipping_country';
|
73 |
+
if( !empty( $country_key ) ) {
|
74 |
+
$current_cc = WC()->checkout->get_value( $country_key );
|
75 |
+
$states = WC()->countries->get_states( $current_cc );
|
76 |
+
if( empty( $states ) ) {
|
77 |
+
$fields[$key]['required'] = false;
|
78 |
+
$fields[$key]['wooccm_required'] = false;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
// Remove disabled fields
|
84 |
if( !empty( $btn['disabled'] ) ) {
|
85 |
unset( $fields[$key] );
|
includes/checkout.php
CHANGED
@@ -19,6 +19,25 @@ function wooccm_checkout_additional_positioning() {
|
|
19 |
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
function wooccm_autocreate_account( $fields ) {
|
23 |
|
24 |
$options = get_option( 'wccs_settings' );
|
@@ -436,7 +455,7 @@ function wooccm_custom_checkout_field_process() {
|
|
436 |
$btn['type'] !== 'heading'
|
437 |
) {
|
438 |
if( ( sanitize_text_field( $_POST[$btn['cow']] ) == $btn['check_2'] ) && ( !empty ($btn['checkbox'] ) ) ) {
|
439 |
-
$message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
440 |
wc_add_notice( $message, 'error' );
|
441 |
}
|
442 |
}
|
19 |
|
20 |
}
|
21 |
|
22 |
+
function wooccm_checkout_default_address_fields( $fields ) {
|
23 |
+
|
24 |
+
// Billing fields
|
25 |
+
$options = get_option( 'wccs_settings3' );
|
26 |
+
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
27 |
+
if( !empty( $buttons ) ) {
|
28 |
+
foreach( $buttons as $btn ) {
|
29 |
+
if( !empty( $btn['cow'] ) && empty( $btn['deny_checkout'] ) ) {
|
30 |
+
$key = $btn['cow'];
|
31 |
+
if( isset( $fields[$key] ) )
|
32 |
+
$fields[$key]['required'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : $fields[$key]['required'] );
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
return $fields;
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
function wooccm_autocreate_account( $fields ) {
|
42 |
|
43 |
$options = get_option( 'wccs_settings' );
|
455 |
$btn['type'] !== 'heading'
|
456 |
) {
|
457 |
if( ( sanitize_text_field( $_POST[$btn['cow']] ) == $btn['check_2'] ) && ( !empty ($btn['checkbox'] ) ) ) {
|
458 |
+
$message = sprintf( __( '%s is a required field.bbb', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
459 |
wc_add_notice( $message, 'error' );
|
460 |
}
|
461 |
}
|
includes/classes/field_filters.php
CHANGED
@@ -17,12 +17,12 @@ function wooccm_checkout_field_text_handler( $field = '', $key, $args, $value )
|
|
17 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
18 |
$rolekeys = explode('||',$args['role_options']);
|
19 |
$rolekeys2 = explode('||',$args['role_options2']);
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
}
|
27 |
|
28 |
if( !empty( $args['clear'] ) )
|
@@ -30,11 +30,10 @@ function wooccm_checkout_field_text_handler( $field = '', $key, $args, $value )
|
|
30 |
else
|
31 |
$after = '';
|
32 |
|
|
|
33 |
if( $args['wooccm_required'] ) {
|
34 |
$args['class'][] = 'validate-required';
|
35 |
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
36 |
-
} else {
|
37 |
-
$required = '';
|
38 |
}
|
39 |
|
40 |
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
@@ -412,18 +411,21 @@ function wooccm_checkout_field_state_handler( $field = '', $key, $args, $value )
|
|
412 |
|
413 |
$args['class'][] = 'address-field';
|
414 |
|
415 |
-
// Get Country
|
416 |
-
// @mod - This is where the Billing/Shipping State bug lies...
|
417 |
$country_key = $key == 'billing_state' ? 'billing_country' : 'shipping_country';
|
418 |
$current_cc = WC()->checkout->get_value( $country_key );
|
419 |
$states = WC()->countries->get_states( $current_cc );
|
420 |
|
421 |
if( $args['wooccm_required'] ) {
|
422 |
-
if( !empty( $states ) )
|
423 |
-
$args['class']
|
424 |
-
|
|
|
|
|
|
|
|
|
425 |
} else {
|
426 |
$required = '';
|
|
|
427 |
}
|
428 |
|
429 |
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
17 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
18 |
$rolekeys = explode('||',$args['role_options']);
|
19 |
$rolekeys2 = explode('||',$args['role_options2']);
|
20 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
24 |
+
return;
|
25 |
+
}
|
26 |
}
|
27 |
|
28 |
if( !empty( $args['clear'] ) )
|
30 |
else
|
31 |
$after = '';
|
32 |
|
33 |
+
$required = false;
|
34 |
if( $args['wooccm_required'] ) {
|
35 |
$args['class'][] = 'validate-required';
|
36 |
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
|
|
|
|
37 |
}
|
38 |
|
39 |
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
411 |
|
412 |
$args['class'][] = 'address-field';
|
413 |
|
|
|
|
|
414 |
$country_key = $key == 'billing_state' ? 'billing_country' : 'shipping_country';
|
415 |
$current_cc = WC()->checkout->get_value( $country_key );
|
416 |
$states = WC()->countries->get_states( $current_cc );
|
417 |
|
418 |
if( $args['wooccm_required'] ) {
|
419 |
+
if( !empty( $states ) ) {
|
420 |
+
if( !in_array( 'validate-required', $args['class'] ) )
|
421 |
+
$args['class'][] = 'validate-required';
|
422 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
423 |
+
} else {
|
424 |
+
$args['class'][] = 'woocommerce-validated';
|
425 |
+
}
|
426 |
} else {
|
427 |
$required = '';
|
428 |
+
$args['class'][] = 'woocommerce-validated';
|
429 |
}
|
430 |
|
431 |
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
includes/email.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
function
|
3 |
|
4 |
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
|
5 |
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
@@ -35,337 +35,344 @@ function wooccm_add_payment_method_to_new_order( $order, $sent_to_admin, $plain_
|
|
35 |
$names = array( 'billing', 'shipping' );
|
36 |
$inc = 3;
|
37 |
|
38 |
-
|
|
|
|
|
39 |
|
40 |
-
|
|
|
|
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
92 |
}
|
93 |
-
|
|
|
94 |
}
|
95 |
} else {
|
96 |
-
echo
|
97 |
}
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
-
echo "\n";
|
102 |
-
} elseif( $btn['type'] == 'wooccmupload' ) {
|
103 |
-
$info = explode( "||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true));
|
104 |
-
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
105 |
-
echo wooccm_wpml_string( trim( $btn['label'] ) ).': '.$info[0];
|
106 |
-
echo "\n";
|
107 |
}
|
108 |
-
}
|
109 |
|
|
|
110 |
}
|
111 |
-
|
112 |
-
$inc--;
|
113 |
|
114 |
-
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
163 |
}
|
164 |
-
|
|
|
165 |
}
|
166 |
} else {
|
167 |
-
echo
|
168 |
}
|
169 |
-
|
170 |
-
|
|
|
|
|
|
|
|
|
171 |
}
|
172 |
-
echo "\n";
|
173 |
-
} elseif( $btn['type'] == 'wooccmupload' ) {
|
174 |
-
$info = explode( "||", get_post_meta( $order_id, $btn['cow'], true ) );
|
175 |
-
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
176 |
-
echo wooccm_wpml_string( trim( $btn['label'] ) ).': '.$info[0];
|
177 |
-
echo "\n";
|
178 |
-
}
|
179 |
|
|
|
180 |
}
|
181 |
-
}
|
182 |
-
|
183 |
-
if ( !empty( $options['checkness']['set_timezone'] ) ) {
|
184 |
-
date_default_timezone_set( $options['checkness']['set_timezone'] );
|
185 |
-
}
|
186 |
-
$date = ( !empty( $options['checkness']['twenty_hour'] ) ) ? date( "G:i T (P" ).' GMT)' : date( "g:i a" );
|
187 |
-
$options['checkness']['time_stamp'] = ( isset( $options['checkness']['time_stamp'] ) ? $options['checkness']['time_stamp'] : false );
|
188 |
-
if ( $options['checkness']['time_stamp'] == true ) {
|
189 |
-
echo $options['checkness']['time_stamp_title'].' ' . $date . "\n";
|
190 |
-
}
|
191 |
-
if( method_exists( $order, 'get_payment_method_title' ) ) {
|
192 |
-
if( $order->get_payment_method_title() && isset( $options['checkness']['payment_method_t'] ) && $options['checkness']['payment_method_t'] == true )
|
193 |
-
echo $options['checkness']['payment_method_d'].': ' . $order->get_payment_method_title() . "\n";
|
194 |
-
}
|
195 |
-
if( method_exists( $order, 'get_shipping_method' ) ) {
|
196 |
-
if( $order->get_shipping_method() && isset( $options['checkness']['shipping_method_t'] ) && $options['checkness']['shipping_method_t'] == true )
|
197 |
-
echo $options['checkness']['shipping_method_d'].': ' . $order->get_shipping_method() . "\n";
|
198 |
-
}
|
199 |
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
-
|
|
|
203 |
|
204 |
-
|
|
|
|
|
|
|
205 |
|
206 |
-
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
<p>
|
224 |
<strong>'.wooccm_wpml_string($btn['label']).':</strong> '.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) ).'
|
225 |
</p>';
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
<h2>' .wooccm_wpml_string($btn['label']). '</h2>';
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
<p>
|
250 |
<strong>'.wooccm_wpml_string($btn['label']).':</strong> ';
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
|
|
|
|
260 |
}
|
261 |
-
|
|
|
262 |
}
|
263 |
} else {
|
264 |
-
echo
|
265 |
}
|
266 |
-
|
267 |
-
echo '-';
|
268 |
-
}
|
269 |
-
echo '
|
270 |
</p>';
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
<p>
|
276 |
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> '.$info[0].'
|
277 |
</p>';
|
|
|
278 |
}
|
279 |
-
}
|
280 |
|
|
|
281 |
}
|
282 |
-
|
283 |
-
$inc--;
|
284 |
|
285 |
-
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
<p>
|
308 |
<strong>'.wooccm_wpml_string($btn['label']).':</strong> ';
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
|
|
|
|
318 |
}
|
319 |
-
|
|
|
320 |
}
|
321 |
} else {
|
322 |
-
echo
|
323 |
}
|
324 |
-
|
325 |
-
echo '-';
|
326 |
-
}
|
327 |
-
echo '
|
328 |
</p>';
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
<p>
|
334 |
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> '.$info[0].'
|
335 |
</p>';
|
336 |
-
|
337 |
|
|
|
338 |
}
|
339 |
-
}
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
<p>
|
350 |
<strong>'.$options['checkness']['time_stamp_title'].':</strong> ' . $date . '
|
351 |
</p>';
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
<p>
|
357 |
<strong>'.$options['checkness']['payment_method_d'].':</strong> ' . $order->get_payment_method_title() . '
|
358 |
</p>';
|
|
|
359 |
}
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
echo '
|
364 |
<p>
|
365 |
<strong>'.$options['checkness']['shipping_method_d'].':</strong> ' . $order->get_shipping_method() . '
|
366 |
</p>';
|
|
|
367 |
}
|
368 |
-
|
369 |
|
370 |
}
|
371 |
|
1 |
<?php
|
2 |
+
function wooccm_order_receipt_checkout_details( $order, $sent_to_admin, $plain_text = '' ) {
|
3 |
|
4 |
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
|
5 |
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
35 |
$names = array( 'billing', 'shipping' );
|
36 |
$inc = 3;
|
37 |
|
38 |
+
// Are we generating a plain-text or HTML message?
|
39 |
+
$plain_text = absint( $plain_text );
|
40 |
+
switch( $plain_text ) {
|
41 |
|
42 |
+
// Plain text
|
43 |
+
case '1':
|
44 |
+
foreach( $names as $name ) {
|
45 |
|
46 |
+
$array = ($name == 'billing') ? $billing : $shipping;
|
47 |
|
48 |
+
$options = get_option( 'wccs_settings'.$inc );
|
49 |
+
if( !empty( $options[$name.'_buttons'] ) ) {
|
50 |
+
foreach( $options[$name.'_buttons'] as $btn ) {
|
51 |
|
52 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
53 |
+
if(
|
54 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
55 |
+
!empty( $btn['label'] ) &&
|
56 |
+
empty( $btn['deny_receipt'] ) &&
|
57 |
+
$btn['type'] !== 'heading' &&
|
58 |
+
$btn['type'] !== 'multiselect' &&
|
59 |
+
$btn['type'] !== 'wooccmupload' &&
|
60 |
+
$btn['type'] !== 'multicheckbox'
|
61 |
+
) {
|
62 |
+
echo wooccm_wpml_string( $btn['label'] ).': '.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
|
63 |
+
echo "\n";
|
64 |
+
} elseif (
|
65 |
+
!empty( $btn['label'] ) &&
|
66 |
+
empty( $btn['deny_receipt'] ) &&
|
67 |
+
$btn['type'] == 'heading' &&
|
68 |
+
$btn['type'] !== 'multiselect' &&
|
69 |
+
$btn['type'] !== 'wooccmupload' &&
|
70 |
+
$btn['type'] !== 'multicheckbox'
|
71 |
+
) {
|
72 |
+
echo wooccm_wpml_string( $btn['label'] );
|
73 |
+
echo "\n";
|
74 |
+
} elseif(
|
75 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
76 |
+
!empty( $btn['label'] ) &&
|
77 |
+
empty( $btn['deny_receipt'] ) &&
|
78 |
+
$btn['type'] !== 'heading' &&
|
79 |
+
$btn['type'] !== 'wooccmupload' &&
|
80 |
+
(
|
81 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
82 |
+
)
|
83 |
+
) {
|
84 |
+
$value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
85 |
+
$strings = maybe_unserialize( $value );
|
86 |
+
echo wooccm_wpml_string($btn['label']).': ';
|
87 |
+
if( !empty( $strings ) ) {
|
88 |
+
if( is_array( $strings ) ) {
|
89 |
+
$iww = 0;
|
90 |
+
$len = count( $strings );
|
91 |
+
foreach( $strings as $key ) {
|
92 |
+
if( $iww == $len - 1 ) {
|
93 |
+
echo $key;
|
94 |
+
} else {
|
95 |
+
echo $key.', ';
|
96 |
+
}
|
97 |
+
$iww++;
|
98 |
}
|
99 |
+
} else {
|
100 |
+
echo $strings;
|
101 |
}
|
102 |
} else {
|
103 |
+
echo '-';
|
104 |
}
|
105 |
+
echo "\n";
|
106 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
107 |
+
$info = explode( "||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
|
108 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
109 |
+
echo wooccm_wpml_string( trim( $btn['label'] ) ).': '.$info[0];
|
110 |
+
echo "\n";
|
111 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
|
|
113 |
|
114 |
+
}
|
115 |
}
|
116 |
+
$inc--;
|
|
|
117 |
|
118 |
+
}
|
119 |
|
120 |
+
$options = get_option( 'wccs_settings' );
|
121 |
+
if( !empty( $options['buttons'] ) ) {
|
122 |
+
foreach( $options['buttons'] as $btn ) {
|
123 |
|
124 |
+
if(
|
125 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
126 |
+
!empty( $btn['label'] ) &&
|
127 |
+
empty( $btn['deny_receipt'] ) &&
|
128 |
+
$btn['type'] !== 'heading' &&
|
129 |
+
$btn['type'] !== 'multiselect' &&
|
130 |
+
$btn['type'] !== 'wooccmupload' &&
|
131 |
+
$btn['type'] !== 'multicheckbox'
|
132 |
+
) {
|
133 |
+
echo wooccm_wpml_string( $btn['label'] ).': '.nl2br( get_post_meta( $order_id , $btn['cow'], true ) );
|
134 |
+
echo "\n";
|
135 |
+
} elseif(
|
136 |
+
!empty( $btn['label'] ) &&
|
137 |
+
empty( $btn['deny_receipt'] ) &&
|
138 |
+
$btn['type'] == 'heading' &&
|
139 |
+
$btn['type'] !== 'multiselect' &&
|
140 |
+
$btn['type'] !== 'wooccmupload' &&
|
141 |
+
$btn['type'] !== 'multicheckbox'
|
142 |
+
) {
|
143 |
+
echo wooccm_wpml_string( $btn['label'] );
|
144 |
+
echo "\n";
|
145 |
+
} elseif(
|
146 |
+
( get_post_meta( $order_id, $btn['cow'], true ) !== '' ) &&
|
147 |
+
!empty( $btn['label'] ) &&
|
148 |
+
empty( $btn['deny_receipt'] ) &&
|
149 |
+
$btn['type'] !== 'heading' &&
|
150 |
+
$btn['type'] !== 'wooccmupload' &&
|
151 |
+
(
|
152 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
153 |
+
)
|
154 |
+
) {
|
155 |
+
$value = get_post_meta( $order_id , $btn['cow'], true );
|
156 |
+
$strings = maybe_unserialize( $value );
|
157 |
+
echo wooccm_wpml_string($btn['label']).': ';
|
158 |
+
if( !empty( $strings ) ) {
|
159 |
+
if( is_array( $strings ) ) {
|
160 |
+
$iww = 0;
|
161 |
+
$len = count($strings);
|
162 |
+
foreach($strings as $key ) {
|
163 |
+
if( $iww == $len - 1 ) {
|
164 |
+
echo $key;
|
165 |
+
} else {
|
166 |
+
echo $key.', ';
|
167 |
+
}
|
168 |
+
$iww++;
|
169 |
}
|
170 |
+
} else {
|
171 |
+
echo $strings;
|
172 |
}
|
173 |
} else {
|
174 |
+
echo '-';
|
175 |
}
|
176 |
+
echo "\n";
|
177 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
178 |
+
$info = explode( "||", get_post_meta( $order_id, $btn['cow'], true ) );
|
179 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
180 |
+
echo wooccm_wpml_string( trim( $btn['label'] ) ).': '.$info[0];
|
181 |
+
echo "\n";
|
182 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
+
}
|
185 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
+
if ( !empty( $options['checkness']['set_timezone'] ) ) {
|
188 |
+
date_default_timezone_set( $options['checkness']['set_timezone'] );
|
189 |
+
}
|
190 |
+
$date = ( !empty( $options['checkness']['twenty_hour'] ) ) ? date( "G:i T (P" ).' GMT)' : date( "g:i a" );
|
191 |
+
$options['checkness']['time_stamp'] = ( isset( $options['checkness']['time_stamp'] ) ? $options['checkness']['time_stamp'] : false );
|
192 |
+
if ( $options['checkness']['time_stamp'] == true ) {
|
193 |
+
echo $options['checkness']['time_stamp_title'].' ' . $date . "\n";
|
194 |
+
}
|
195 |
+
if( method_exists( $order, 'get_payment_method_title' ) ) {
|
196 |
+
if( $order->get_payment_method_title() && isset( $options['checkness']['payment_method_t'] ) && $options['checkness']['payment_method_t'] == true )
|
197 |
+
echo $options['checkness']['payment_method_d'].': ' . $order->get_payment_method_title() . "\n";
|
198 |
+
}
|
199 |
+
if( method_exists( $order, 'get_shipping_method' ) ) {
|
200 |
+
if( $order->get_shipping_method() && isset( $options['checkness']['shipping_method_t'] ) && $options['checkness']['shipping_method_t'] == true )
|
201 |
+
echo $options['checkness']['shipping_method_d'].': ' . $order->get_shipping_method() . "\n";
|
202 |
+
}
|
203 |
|
204 |
+
echo "\n";
|
205 |
+
break;
|
206 |
|
207 |
+
// HTML formatting
|
208 |
+
case '0':
|
209 |
+
default:
|
210 |
+
foreach( $names as $name ) {
|
211 |
|
212 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
213 |
|
214 |
+
$options = get_option( 'wccs_settings'.$inc );
|
215 |
+
if( !empty( $options[$name.'_buttons'] ) ) {
|
216 |
+
foreach( $options[$name.'_buttons'] as $btn ) {
|
217 |
|
218 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
219 |
+
if(
|
220 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
221 |
+
!empty( $btn['label'] ) &&
|
222 |
+
empty( $btn['deny_receipt'] ) &&
|
223 |
+
$btn['type'] !== 'heading' &&
|
224 |
+
$btn['type'] !== 'multiselect' &&
|
225 |
+
$btn['type'] !== 'wooccmupload' &&
|
226 |
+
$btn['type'] !== 'multicheckbox'
|
227 |
+
) {
|
228 |
+
echo '
|
229 |
<p>
|
230 |
<strong>'.wooccm_wpml_string($btn['label']).':</strong> '.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) ).'
|
231 |
</p>';
|
232 |
+
} elseif (
|
233 |
+
!empty( $btn['label'] ) &&
|
234 |
+
empty( $btn['deny_receipt'] ) &&
|
235 |
+
$btn['type'] == 'heading' &&
|
236 |
+
$btn['type'] !== 'multiselect' &&
|
237 |
+
$btn['type'] !== 'wooccmupload' &&
|
238 |
+
$btn['type'] !== 'multicheckbox'
|
239 |
+
) {
|
240 |
+
echo '
|
241 |
<h2>' .wooccm_wpml_string($btn['label']). '</h2>';
|
242 |
+
} elseif (
|
243 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
244 |
+
!empty( $btn['label'] ) &&
|
245 |
+
empty( $btn['deny_receipt'] ) &&
|
246 |
+
$btn['type'] !== 'heading' &&
|
247 |
+
$btn['type'] !== 'wooccmupload' &&
|
248 |
+
(
|
249 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
250 |
+
)
|
251 |
+
) {
|
252 |
+
$value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
253 |
+
$strings = maybe_unserialize( $value );
|
254 |
+
echo '
|
255 |
<p>
|
256 |
<strong>'.wooccm_wpml_string($btn['label']).':</strong> ';
|
257 |
+
if( !empty( $strings ) ) {
|
258 |
+
if( is_array( $strings ) ) {
|
259 |
+
$iww = 0;
|
260 |
+
$len = count( $strings );
|
261 |
+
foreach( $strings as $key ) {
|
262 |
+
if( $iww == $len - 1 ) {
|
263 |
+
echo $key;
|
264 |
+
} else {
|
265 |
+
echo $key.', ';
|
266 |
+
}
|
267 |
+
$iww++;
|
268 |
}
|
269 |
+
} else {
|
270 |
+
echo $strings;
|
271 |
}
|
272 |
} else {
|
273 |
+
echo '-';
|
274 |
}
|
275 |
+
echo '
|
|
|
|
|
|
|
276 |
</p>';
|
277 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
278 |
+
$info = explode( "||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
|
279 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
280 |
+
echo '
|
281 |
<p>
|
282 |
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> '.$info[0].'
|
283 |
</p>';
|
284 |
+
}
|
285 |
}
|
|
|
286 |
|
287 |
+
}
|
288 |
}
|
289 |
+
$inc--;
|
|
|
290 |
|
291 |
+
}
|
292 |
|
293 |
+
$options = get_option( 'wccs_settings' );
|
294 |
+
if( !empty( $options['buttons'] ) ) {
|
295 |
+
foreach( $options['buttons'] as $btn ) {
|
296 |
|
297 |
+
if(
|
298 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
299 |
+
!empty( $btn['label'] ) &&
|
300 |
+
empty( $btn['deny_receipt'] ) &&
|
301 |
+
$btn['type'] !== 'heading' &&
|
302 |
+
$btn['type'] !== 'multiselect' &&
|
303 |
+
$btn['type'] !== 'wooccmupload' &&
|
304 |
+
$btn['type'] !== 'multicheckbox'
|
305 |
+
) {
|
306 |
+
echo '<p><strong>'.wooccm_wpml_string( $btn['label'] ).':</strong> '.nl2br( get_post_meta( $order_id , $btn['cow'], true ) ).'</p>';
|
307 |
+
} elseif ( !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
308 |
+
echo '<h2>'.wooccm_wpml_string($btn['label']).'</h2>';
|
309 |
+
} elseif ( ( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) && !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
310 |
+
$value = get_post_meta( $order_id , $btn['cow'], true );
|
311 |
+
$strings = maybe_unserialize( $value );
|
312 |
+
echo '
|
313 |
<p>
|
314 |
<strong>'.wooccm_wpml_string($btn['label']).':</strong> ';
|
315 |
+
if( !empty( $strings ) ) {
|
316 |
+
if( is_array( $strings ) ) {
|
317 |
+
$iww = 0;
|
318 |
+
$len = count( $strings );
|
319 |
+
foreach( $strings as $key ) {
|
320 |
+
if( $iww == $len - 1 ) {
|
321 |
+
echo $key;
|
322 |
+
} else {
|
323 |
+
echo $key.', ';
|
324 |
+
}
|
325 |
+
$iww++;
|
326 |
}
|
327 |
+
} else {
|
328 |
+
echo $strings;
|
329 |
}
|
330 |
} else {
|
331 |
+
echo '-';
|
332 |
}
|
333 |
+
echo '
|
|
|
|
|
|
|
334 |
</p>';
|
335 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
336 |
+
$info = explode( "||", get_post_meta( $order_id , $btn['cow'], true ) );
|
337 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
338 |
+
echo '
|
339 |
<p>
|
340 |
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> '.$info[0].'
|
341 |
</p>';
|
342 |
+
}
|
343 |
|
344 |
+
}
|
345 |
}
|
|
|
346 |
|
347 |
+
// @mod - We are not doing any checking for valid TimeZone
|
348 |
+
if ( !empty($options['checkness']['set_timezone']) ) {
|
349 |
+
date_default_timezone_set( $options['checkness']['set_timezone'] );
|
350 |
+
}
|
351 |
+
$date = ( !empty($options['checkness']['twenty_hour'])) ? date("G:i T (P").' GMT)' : date("g:i a");
|
352 |
+
$options['checkness']['time_stamp'] = ( isset( $options['checkness']['time_stamp'] ) ? $options['checkness']['time_stamp'] : false );
|
353 |
+
if( $options['checkness']['time_stamp'] == true ) {
|
354 |
+
echo '
|
355 |
<p>
|
356 |
<strong>'.$options['checkness']['time_stamp_title'].':</strong> ' . $date . '
|
357 |
</p>';
|
358 |
+
}
|
359 |
+
if( method_exists( $order, 'get_payment_method_title' ) ) {
|
360 |
+
if( $order->get_payment_method_title() && isset( $options['checkness']['payment_method_t'] ) && $options['checkness']['payment_method_t'] == true ) {
|
361 |
+
echo '
|
362 |
<p>
|
363 |
<strong>'.$options['checkness']['payment_method_d'].':</strong> ' . $order->get_payment_method_title() . '
|
364 |
</p>';
|
365 |
+
}
|
366 |
}
|
367 |
+
if( method_exists( $order, 'get_shipping_method' ) ) {
|
368 |
+
if( $order->get_shipping_method() && isset( $options['checkness']['shipping_method_t'] ) && $options['checkness']['shipping_method_t'] == true ) {
|
369 |
+
echo '
|
|
|
370 |
<p>
|
371 |
<strong>'.$options['checkness']['shipping_method_d'].':</strong> ' . $order->get_shipping_method() . '
|
372 |
</p>';
|
373 |
+
}
|
374 |
}
|
375 |
+
break;
|
376 |
|
377 |
}
|
378 |
|
includes/install.php
CHANGED
@@ -8,9 +8,9 @@ function wooccm_install() {
|
|
8 |
|
9 |
update_option( WOOCCM_PREFIX . '_update_notice', 0 );
|
10 |
|
11 |
-
if( function_exists( 'icl_register_string' ) )
|
12 |
icl_register_string( 'WooCommerce Checkout Manager', 'is a required field.', 'is a required field.' );
|
13 |
-
|
14 |
if( empty( $options['checkness']['position'] ) ) {
|
15 |
$options['checkness']['position'] = 'after_order_notes';
|
16 |
}
|
8 |
|
9 |
update_option( WOOCCM_PREFIX . '_update_notice', 0 );
|
10 |
|
11 |
+
if( function_exists( 'icl_register_string' ) )
|
12 |
icl_register_string( 'WooCommerce Checkout Manager', 'is a required field.', 'is a required field.' );
|
13 |
+
|
14 |
if( empty( $options['checkness']['position'] ) ) {
|
15 |
$options['checkness']['position'] = 'after_order_notes';
|
16 |
}
|
includes/pickers/css/backend_css.css
CHANGED
@@ -156,20 +156,25 @@ th.hide_stuff_days {
|
|
156 |
}
|
157 |
input.wccs_submit_button {
|
158 |
float: left;
|
159 |
-
margin-bottom:
|
160 |
margin-left: 15px;
|
161 |
}
|
|
|
162 |
input#wccs_reset_submit,
|
163 |
input#wccs_submit_button {
|
164 |
margin-top:10px;
|
165 |
}
|
|
|
166 |
.reset_form {
|
167 |
float: left;
|
168 |
}
|
|
|
|
|
|
|
|
|
169 |
.import_form {
|
170 |
float: left;
|
171 |
margin-left: 15px;
|
172 |
-
margin-top: 10px;
|
173 |
}
|
174 |
.wccm_importer {
|
175 |
font-size:16px;
|
@@ -180,7 +185,7 @@ input#wccs_submit_button {
|
|
180 |
}
|
181 |
#wccs_reset_submit {
|
182 |
float: left;
|
183 |
-
margin-bottom:
|
184 |
width: inherit;
|
185 |
}
|
186 |
span.heading_smalla {
|
@@ -281,7 +286,9 @@ table.widefat {
|
|
281 |
cursor: pointer;
|
282 |
}
|
283 |
|
284 |
-
.wccs-table-footer,
|
|
|
|
|
285 |
position: relative;
|
286 |
overflow: hidden;
|
287 |
margin-top: 10px;
|
156 |
}
|
157 |
input.wccs_submit_button {
|
158 |
float: left;
|
159 |
+
margin-bottom: 10px;
|
160 |
margin-left: 15px;
|
161 |
}
|
162 |
+
/*
|
163 |
input#wccs_reset_submit,
|
164 |
input#wccs_submit_button {
|
165 |
margin-top:10px;
|
166 |
}
|
167 |
+
*/
|
168 |
.reset_form {
|
169 |
float: left;
|
170 |
}
|
171 |
+
.import_form,
|
172 |
+
.reset_form {
|
173 |
+
margin-top:10px;
|
174 |
+
}
|
175 |
.import_form {
|
176 |
float: left;
|
177 |
margin-left: 15px;
|
|
|
178 |
}
|
179 |
.wccm_importer {
|
180 |
font-size:16px;
|
185 |
}
|
186 |
#wccs_reset_submit {
|
187 |
float: left;
|
188 |
+
margin-bottom: 10px;
|
189 |
width: inherit;
|
190 |
}
|
191 |
span.heading_smalla {
|
286 |
cursor: pointer;
|
287 |
}
|
288 |
|
289 |
+
.wccs-table-footer,
|
290 |
+
.billing-wccs-table-footer,
|
291 |
+
.shipping-wccs-table-footer {
|
292 |
position: relative;
|
293 |
overflow: hidden;
|
294 |
margin-top: 10px;
|
includes/template.php
CHANGED
@@ -104,6 +104,9 @@ add_action("wp_ajax_nopriv_wooccm_front_enduploadsave", "wooccm_front_enduploads
|
|
104 |
|
105 |
function wooccm_update_attachment_ids( $order_id = 0 ) {
|
106 |
|
|
|
|
|
|
|
107 |
$shipping = array(
|
108 |
'country',
|
109 |
'first_name',
|
@@ -151,10 +154,12 @@ function wooccm_update_attachment_ids( $order_id = 0 ) {
|
|
151 |
if( !empty( $attachments ) ) {
|
152 |
foreach( $attachments as $image_id ) {
|
153 |
|
154 |
-
if( !empty( $image_id ) ){
|
|
|
155 |
wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ) );
|
156 |
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
157 |
wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) ) );
|
|
|
158 |
}
|
159 |
|
160 |
}
|
@@ -180,9 +185,11 @@ function wooccm_update_attachment_ids( $order_id = 0 ) {
|
|
180 |
foreach( $attachments as $image_id ) {
|
181 |
|
182 |
if( !empty( $image_id ) ) {
|
|
|
183 |
wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ) );
|
184 |
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
185 |
wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) ) );
|
|
|
186 |
}
|
187 |
|
188 |
}
|
@@ -192,19 +199,55 @@ function wooccm_update_attachment_ids( $order_id = 0 ) {
|
|
192 |
}
|
193 |
}
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
add_action( 'woocommerce_thankyou', 'wooccm_update_attachment_ids' );
|
197 |
// @mod - Change to thank you page to catch all Order Status
|
198 |
-
add_action( 'woocommerce_order_status_completed', 'wooccm_update_attachment_ids' );
|
199 |
|
200 |
// Checkout - Order Received
|
201 |
-
function
|
202 |
|
203 |
-
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) )
|
204 |
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
205 |
-
|
206 |
$order_id = ( isset( $order->id ) ? $order->id : 0 );
|
207 |
-
}
|
208 |
|
209 |
$shipping = array(
|
210 |
'country',
|
104 |
|
105 |
function wooccm_update_attachment_ids( $order_id = 0 ) {
|
106 |
|
107 |
+
$has_uploads = false;
|
108 |
+
$email_attachments = array();
|
109 |
+
|
110 |
$shipping = array(
|
111 |
'country',
|
112 |
'first_name',
|
154 |
if( !empty( $attachments ) ) {
|
155 |
foreach( $attachments as $image_id ) {
|
156 |
|
157 |
+
if( !empty( $image_id ) ) {
|
158 |
+
$has_uploads = true;
|
159 |
wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ) );
|
160 |
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
161 |
wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) ) );
|
162 |
+
$email_attachments[] = get_attached_file( $image_id );
|
163 |
}
|
164 |
|
165 |
}
|
185 |
foreach( $attachments as $image_id ) {
|
186 |
|
187 |
if( !empty( $image_id ) ) {
|
188 |
+
$has_uploads = true;
|
189 |
wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ) );
|
190 |
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
191 |
wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) ) );
|
192 |
+
$email_attachments[] = get_attached_file( $image_id );
|
193 |
}
|
194 |
|
195 |
}
|
199 |
}
|
200 |
}
|
201 |
|
202 |
+
if( $has_uploads ) {
|
203 |
+
|
204 |
+
$order = new WC_Order( $order_id );
|
205 |
+
|
206 |
+
// send email
|
207 |
+
$email_recipients = $options['checkness']['wooccm_notification_email'];
|
208 |
+
if( empty( $email_recipients ) )
|
209 |
+
$email_recipients = get_option( 'admin_email' );
|
210 |
+
$email_heading = __( 'Files Uploaded at Checkout', 'woocommerce-checkout-manager' );
|
211 |
+
$subject = sprintf( __( 'WooCommerce Checkout Manager - %s', 'woocommerce-checkout-manager' ), $email_heading );
|
212 |
+
|
213 |
+
$mailer = WC()->mailer();
|
214 |
+
|
215 |
+
// Buffer
|
216 |
+
ob_start();
|
217 |
+
?>
|
218 |
+
<p>This is an automatic message from WooCommerce Checkout Manager, reporting that files have been uploaded by <?php echo $order->billing_first_name; ?> <?php echo $order->billing_last_name; ?>.</p>
|
219 |
+
<h3>Customer Details</h3>
|
220 |
+
<ul>
|
221 |
+
<li>Name: <?php echo $order->billing_first_name; ?> <?php $order->billing_last_name; ?></li>
|
222 |
+
<li>E-mail: <?php echo $order->billing_email; ?></li>
|
223 |
+
<li>Order Number: <?php echo $order_id; ?></li>
|
224 |
+
</ul>
|
225 |
+
<p>You can view the files and order details via back-end by following this <a href="<?php echo admin_url( '/post.php?post='.$order_id.'&action=edit' ); ?>" target="_blank">link</a>.</p>
|
226 |
+
<?php
|
227 |
+
// Get contents
|
228 |
+
$message = ob_get_clean();
|
229 |
+
|
230 |
+
$message = $mailer->wrap_message( $email_heading, $message );
|
231 |
+
|
232 |
+
// add_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
233 |
+
// wc_mail( $email_recipients, $message_subject, $message_content );
|
234 |
+
$mailer->send( $email_recipients, strip_tags( $subject ), $message, $email_attachments );
|
235 |
+
// remove_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
236 |
+
|
237 |
+
}
|
238 |
+
|
239 |
}
|
240 |
add_action( 'woocommerce_thankyou', 'wooccm_update_attachment_ids' );
|
241 |
// @mod - Change to thank you page to catch all Order Status
|
242 |
+
// add_action( 'woocommerce_order_status_completed', 'wooccm_update_attachment_ids' );
|
243 |
|
244 |
// Checkout - Order Received
|
245 |
+
function wooccm_order_received_checkout_details( $order ) {
|
246 |
|
247 |
+
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) )
|
248 |
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
249 |
+
else
|
250 |
$order_id = ( isset( $order->id ) ? $order->id : 0 );
|
|
|
251 |
|
252 |
$shipping = array(
|
253 |
'country',
|
includes/templates/admin/edit-order-uploads-file_editing_table.css
CHANGED
@@ -1,8 +1,25 @@
|
|
1 |
/*Copied from bootstrap */
|
2 |
|
3 |
-
.woocommerce_order_items.front_end tbody td
|
4 |
text-align: center;
|
5 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
.btn {
|
8 |
display: inline-block;
|
1 |
/*Copied from bootstrap */
|
2 |
|
3 |
+
.woocommerce_order_items.front_end tbody td {
|
4 |
text-align: center;
|
5 |
}
|
6 |
+
.woocommerce_order_items.back_end {
|
7 |
+
width:100%;
|
8 |
+
}
|
9 |
+
.woocommerce_order_items.back_end th,
|
10 |
+
.woocommerce_order_items.back_end td {
|
11 |
+
text-align:left;
|
12 |
+
line-height:26px;
|
13 |
+
}
|
14 |
+
.woocommerce_order_items.back_end th.column-actions {
|
15 |
+
padding: .75em 1em;
|
16 |
+
}
|
17 |
+
.woocommerce_order_items.back_end td.column-actions {
|
18 |
+
padding-right:1em;
|
19 |
+
}
|
20 |
+
.woocommerce_order_items.back_end .column-actions {
|
21 |
+
text-align:right;
|
22 |
+
}
|
23 |
|
24 |
.btn {
|
25 |
display: inline-block;
|
includes/templates/admin/woocheckout-general-uploads.php
CHANGED
@@ -54,7 +54,7 @@
|
|
54 |
<div class="section">
|
55 |
<h3 class="heading"><?php _e('Notification E-mail', 'woocommerce-checkout-manager'); ?></h3>
|
56 |
<div class="option">
|
57 |
-
<input type="text" name="wccs_settings[checkness][wooccm_notification_email]" class="full-width" value="<?php echo ( isset( $options['checkness']['wooccm_notification_email'] ) ? sanitize_text_field( $options['checkness']['wooccm_notification_email'] ) : '' ); ?>" />
|
58 |
</div>
|
59 |
<!-- .option -->
|
60 |
</div>
|
54 |
<div class="section">
|
55 |
<h3 class="heading"><?php _e('Notification E-mail', 'woocommerce-checkout-manager'); ?></h3>
|
56 |
<div class="option">
|
57 |
+
<input type="text" name="wccs_settings[checkness][wooccm_notification_email]" class="full-width" value="<?php echo ( isset( $options['checkness']['wooccm_notification_email'] ) ? sanitize_text_field( $options['checkness']['wooccm_notification_email'] ) : '' ); ?>" placeholder="<?php echo get_option( 'admin_email' ); ?>" />
|
58 |
</div>
|
59 |
<!-- .option -->
|
60 |
</div>
|
includes/templates/functions/add_wooccmupload.php
CHANGED
@@ -165,16 +165,14 @@ jQuery(document).ready(function($){
|
|
165 |
loadfiles.push(file);
|
166 |
|
167 |
$.ajax({
|
168 |
-
|
169 |
-
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&order_id='.$post->ID.'&name='.$btn['cow'].''); ?>",
|
170 |
-
/* url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name='.$btn['cow'].''); ?>", */
|
171 |
type: "POST",
|
172 |
data: formdata,
|
173 |
cache: false,
|
174 |
processData: false,
|
175 |
contentType: false,
|
176 |
success: function (res) {
|
177 |
-
console.dir(res);
|
178 |
var result = $.parseJSON(res), new_val;
|
179 |
/* @mod - Test formatting change */
|
180 |
/*
|
165 |
loadfiles.push(file);
|
166 |
|
167 |
$.ajax({
|
168 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name='.$btn['cow'].''); ?>",
|
|
|
|
|
169 |
type: "POST",
|
170 |
data: formdata,
|
171 |
cache: false,
|
172 |
processData: false,
|
173 |
contentType: false,
|
174 |
success: function (res) {
|
175 |
+
/* console.dir(res); */
|
176 |
var result = $.parseJSON(res), new_val;
|
177 |
/* @mod - Test formatting change */
|
178 |
/*
|
includes/templates/functions/required/billing_required.php
CHANGED
@@ -29,7 +29,7 @@ function wooccm_billing_custom_checkout_process() {
|
|
29 |
$btn['type'] !== 'heading'
|
30 |
) {
|
31 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
32 |
-
$message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
33 |
wc_add_notice( $message, 'error' );
|
34 |
}
|
35 |
}
|
@@ -46,7 +46,7 @@ function wooccm_billing_custom_checkout_process() {
|
|
46 |
$btn['type'] !== 'heading'
|
47 |
) {
|
48 |
if( ( sanitize_text_field( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) == $btn['check_2'] ) && ( !empty( $btn['checkbox'] ) ) ) {
|
49 |
-
$message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
50 |
wc_add_notice( $message, 'error');
|
51 |
}
|
52 |
}
|
@@ -70,7 +70,7 @@ function wooccm_billing_custom_checkout_process() {
|
|
70 |
if( in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
71 |
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
72 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
73 |
-
$message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
74 |
wc_add_notice( $message, 'error' );
|
75 |
}
|
76 |
}
|
@@ -93,7 +93,7 @@ function wooccm_billing_custom_checkout_process() {
|
|
93 |
if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
94 |
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
95 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
96 |
-
$message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
97 |
wc_add_notice( $message, 'error' );
|
98 |
}
|
99 |
}
|
@@ -117,7 +117,7 @@ function wooccm_billing_custom_checkout_process() {
|
|
117 |
if( array_intersect( $productsarraycm, $show_field_array ) ) {
|
118 |
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
119 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
120 |
-
$message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
121 |
wc_add_notice( $message, 'error' );
|
122 |
}
|
123 |
}
|
@@ -135,7 +135,7 @@ function wooccm_billing_custom_checkout_process() {
|
|
135 |
if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
136 |
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
137 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
138 |
-
$message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
139 |
wc_add_notice( $message, 'error' );
|
140 |
}
|
141 |
}
|
29 |
$btn['type'] !== 'heading'
|
30 |
) {
|
31 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
32 |
+
$message = sprintf( __( '%s is a required field.44', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
33 |
wc_add_notice( $message, 'error' );
|
34 |
}
|
35 |
}
|
46 |
$btn['type'] !== 'heading'
|
47 |
) {
|
48 |
if( ( sanitize_text_field( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) == $btn['check_2'] ) && ( !empty( $btn['checkbox'] ) ) ) {
|
49 |
+
$message = sprintf( __( '%s is a required field.999', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
50 |
wc_add_notice( $message, 'error');
|
51 |
}
|
52 |
}
|
70 |
if( in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
71 |
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
72 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
73 |
+
$message = sprintf( __( '%s is a required field.000', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
74 |
wc_add_notice( $message, 'error' );
|
75 |
}
|
76 |
}
|
93 |
if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
94 |
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
95 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
96 |
+
$message = sprintf( __( '%s is a required field.11', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
97 |
wc_add_notice( $message, 'error' );
|
98 |
}
|
99 |
}
|
117 |
if( array_intersect( $productsarraycm, $show_field_array ) ) {
|
118 |
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
119 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
120 |
+
$message = sprintf( __( '%s is a required field.22', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
121 |
wc_add_notice( $message, 'error' );
|
122 |
}
|
123 |
}
|
135 |
if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
136 |
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
137 |
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
138 |
+
$message = sprintf( __( '%s is a required field.33', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
139 |
wc_add_notice( $message, 'error' );
|
140 |
}
|
141 |
}
|
includes/templates/functions/shipping_wooccmupload.php
CHANGED
@@ -158,7 +158,7 @@ jQuery(document).ready(function($){
|
|
158 |
loadfiles.push(file);
|
159 |
|
160 |
$.ajax({
|
161 |
-
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name='.$btn['cow'].''); ?>",
|
162 |
type: "POST",
|
163 |
data: formdata,
|
164 |
processData: false,
|
158 |
loadfiles.push(file);
|
159 |
|
160 |
$.ajax({
|
161 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name=shipping_'.$btn['cow'].''); ?>",
|
162 |
type: "POST",
|
163 |
data: formdata,
|
164 |
processData: false,
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Contributors: visser, visser.labs, Emark
|
|
4 |
Donate link: https://www.visser.com.au/donations/
|
5 |
Tags: woocommerce, ecommerce, e-commerce, store, cart, checkout, manager, editor, field, shipping, billing, order
|
6 |
Requires at least: 3.0
|
7 |
-
Tested up to: 4.9.
|
8 |
-
Stable tag: 4.
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Manages WooCommerce Checkout, the advanced way.
|
@@ -135,6 +135,18 @@ Example:
|
|
135 |
|
136 |
== Changelog ==
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
= 4.1.7 =
|
139 |
* Fixed: Undefined notice in e-mail template (thanks Vitor)
|
140 |
|
4 |
Donate link: https://www.visser.com.au/donations/
|
5 |
Tags: woocommerce, ecommerce, e-commerce, store, cart, checkout, manager, editor, field, shipping, billing, order
|
6 |
Requires at least: 3.0
|
7 |
+
Tested up to: 4.9.4
|
8 |
+
Stable tag: 4.2
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Manages WooCommerce Checkout, the advanced way.
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 4.2 =
|
139 |
+
* Fixed: Billing State and Shipping State required validation
|
140 |
+
* Fixed: Display required state for Billing Address 2 and Shipping Address 2 (thanks James)
|
141 |
+
|
142 |
+
= 4.1.9 =
|
143 |
+
* Fixed: Styling placement of Reset, Import and Save Changes buttons
|
144 |
+
|
145 |
+
= 4.1.8 =
|
146 |
+
* Changed: Removed Export menu until exports are fixed
|
147 |
+
* Fixed: Uploaded files notification e-mail not working (thanks John)
|
148 |
+
* Changed: Using wc_mail() instead of wp_mail() for e-mail generation
|
149 |
+
|
150 |
= 4.1.7 =
|
151 |
* Fixed: Undefined notice in e-mail template (thanks Vitor)
|
152 |
|
woocommerce-checkout-manager.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WooCommerce Checkout Manager
|
4 |
Plugin URI: https://wordpress.org/plugins/woocommerce-checkout-manager/
|
5 |
Description: Manages WooCommerce Checkout, the advanced way.
|
6 |
-
Version: 4.
|
7 |
Author: Visser Labs
|
8 |
Author URI: http://www.visser.com.au
|
9 |
Contributors: visser, Emark
|
@@ -80,13 +80,13 @@ register_activation_hook( __FILE__, 'wooccm_install' );
|
|
80 |
|
81 |
add_action( 'woocommerce_before_checkout_form' , 'wooccm_autocreate_account' );
|
82 |
// E-mail - Order receipt
|
83 |
-
add_action( 'woocommerce_email_after_order_table', '
|
84 |
// Save the Order meta
|
85 |
add_action( 'woocommerce_checkout_update_order_meta', 'wooccm_custom_checkout_field_update_order_meta' );
|
86 |
add_action( 'woocommerce_checkout_process', 'wooccm_custom_checkout_field_process' );
|
87 |
add_action( 'woocommerce_checkout_update_user_meta', 'wooccm_custom_checkout_field_update_user_meta', 10, 2 );
|
88 |
// Checkout - Order Received
|
89 |
-
add_action( 'woocommerce_order_details_after_customer_details', '
|
90 |
add_action( 'woocommerce_checkout_after_customer_details','wooccm_checkout_text_after' );
|
91 |
add_action( 'woocommerce_checkout_before_customer_details','wooccm_checkout_text_before' );
|
92 |
add_filter( 'woocommerce_checkout_fields', 'wooccm_remove_fields_filter_billing', 15 );
|
@@ -98,6 +98,7 @@ add_action( 'wp_head','wooccm_shipping_hide_required' );
|
|
98 |
// add_action( 'wooccm_run_color_innerpicker','wooccm_run_color_inner'); run color inside options page (proto)
|
99 |
add_action( 'woocommerce_before_checkout_form', 'wooccm_override_this' );
|
100 |
add_filter( 'woocommerce_billing_fields', 'wooccm_checkout_billing_fields' );
|
|
|
101 |
add_filter( 'woocommerce_shipping_fields', 'wooccm_checkout_shipping_fields' );
|
102 |
add_filter( 'wcdn_order_info_fields', 'wooccm_woocommerce_delivery_notes_compat', 10, 2 );
|
103 |
add_filter( 'wc_customer_order_csv_export_order_row', 'wooccm_csv_export_modify_row_data', 10, 3 );
|
3 |
Plugin Name: WooCommerce Checkout Manager
|
4 |
Plugin URI: https://wordpress.org/plugins/woocommerce-checkout-manager/
|
5 |
Description: Manages WooCommerce Checkout, the advanced way.
|
6 |
+
Version: 4.2
|
7 |
Author: Visser Labs
|
8 |
Author URI: http://www.visser.com.au
|
9 |
Contributors: visser, Emark
|
80 |
|
81 |
add_action( 'woocommerce_before_checkout_form' , 'wooccm_autocreate_account' );
|
82 |
// E-mail - Order receipt
|
83 |
+
add_action( 'woocommerce_email_after_order_table', 'wooccm_order_receipt_checkout_details', 10, 3 );
|
84 |
// Save the Order meta
|
85 |
add_action( 'woocommerce_checkout_update_order_meta', 'wooccm_custom_checkout_field_update_order_meta' );
|
86 |
add_action( 'woocommerce_checkout_process', 'wooccm_custom_checkout_field_process' );
|
87 |
add_action( 'woocommerce_checkout_update_user_meta', 'wooccm_custom_checkout_field_update_user_meta', 10, 2 );
|
88 |
// Checkout - Order Received
|
89 |
+
add_action( 'woocommerce_order_details_after_customer_details', 'wooccm_order_received_checkout_details' );
|
90 |
add_action( 'woocommerce_checkout_after_customer_details','wooccm_checkout_text_after' );
|
91 |
add_action( 'woocommerce_checkout_before_customer_details','wooccm_checkout_text_before' );
|
92 |
add_filter( 'woocommerce_checkout_fields', 'wooccm_remove_fields_filter_billing', 15 );
|
98 |
// add_action( 'wooccm_run_color_innerpicker','wooccm_run_color_inner'); run color inside options page (proto)
|
99 |
add_action( 'woocommerce_before_checkout_form', 'wooccm_override_this' );
|
100 |
add_filter( 'woocommerce_billing_fields', 'wooccm_checkout_billing_fields' );
|
101 |
+
add_filter( 'woocommerce_default_address_fields', 'wooccm_checkout_default_address_fields' );
|
102 |
add_filter( 'woocommerce_shipping_fields', 'wooccm_checkout_shipping_fields' );
|
103 |
add_filter( 'wcdn_order_info_fields', 'wooccm_woocommerce_delivery_notes_compat', 10, 2 );
|
104 |
add_filter( 'wc_customer_order_csv_export_order_row', 'wooccm_csv_export_modify_row_data', 10, 3 );
|