diff --git a/admin/includes/duplicate_product.php b/admin/includes/duplicate_product.php index 0d6b3f709ad..0a8ea9a66bf 100644 --- a/admin/includes/duplicate_product.php +++ b/admin/includes/duplicate_product.php @@ -114,7 +114,8 @@ function woocommerce_duplicate_post_taxonomies($id, $new_id, $post_type) { $taxonomies = get_object_taxonomies($post_type); //array("category", "post_tag"); foreach ($taxonomies as $taxonomy) { $post_terms = wp_get_object_terms($id, $taxonomy); - for ($i=0; $islug, $taxonomy, true); } } diff --git a/admin/post-types/writepanels/writepanel-order_data.php b/admin/post-types/writepanels/writepanel-order_data.php index f78d2511300..e9b7c56e2cf 100644 --- a/admin/post-types/writepanels/writepanel-order_data.php +++ b/admin/post-types/writepanels/writepanel-order_data.php @@ -646,8 +646,9 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) { $order_taxes_compound = isset($_POST['_order_taxes_compound']) ? $_POST['_order_taxes_compound'] : array(); $order_taxes_cart = $_POST['_order_taxes_cart']; $order_taxes_shipping = $_POST['_order_taxes_shipping']; + $order_taxes_label_count = sizeof( $order_taxes_label ); - for ($i=0; $iadd( $meta_name, $meta_value ); - endif; - endfor; - endif; - - // Add to array - $order_items[] = apply_filters('update_order_item', array( - 'id' => htmlspecialchars(stripslashes($item_id[$i])), - 'variation_id' => (int) $item_variation[$i], - 'name' => htmlspecialchars(stripslashes($item_name[$i])), - 'qty' => (int) $item_quantity[$i], - 'line_total' => rtrim(rtrim(number_format(woocommerce_clean($line_total[$i]), 4, '.', ''), '0'), '.'), - 'line_tax' => rtrim(rtrim(number_format(woocommerce_clean($line_tax[$i]), 4, '.', ''), '0'), '.'), - 'line_subtotal' => rtrim(rtrim(number_format(woocommerce_clean($line_subtotal[$i]), 4, '.', ''), '0'), '.'), - 'line_subtotal_tax' => rtrim(rtrim(number_format(woocommerce_clean($line_subtotal_tax[$i]), 4, '.', ''), '0'), '.'), - 'item_meta' => $item_meta->meta, - 'tax_class' => woocommerce_clean($item_tax_class[$i]) - )); + for ($ii=0; $ii<$meta_names_count; $ii++) : + $meta_name = esc_attr( $meta_names[$ii] ); + $meta_value = esc_attr( $meta_values[$ii] ); + if ($meta_name && $meta_value) : + $item_meta->add( $meta_name, $meta_value ); + endif; + endfor; + endif; + + // Add to array + $order_items[] = apply_filters('update_order_item', array( + 'id' => htmlspecialchars(stripslashes($item_id[$i])), + 'variation_id' => (int) $item_variation[$i], + 'name' => htmlspecialchars(stripslashes($item_name[$i])), + 'qty' => (int) $item_quantity[$i], + 'line_total' => rtrim(rtrim(number_format(woocommerce_clean($line_total[$i]), 4, '.', ''), '0'), '.'), + 'line_tax' => rtrim(rtrim(number_format(woocommerce_clean($line_tax[$i]), 4, '.', ''), '0'), '.'), + 'line_subtotal' => rtrim(rtrim(number_format(woocommerce_clean($line_subtotal[$i]), 4, '.', ''), '0'), '.'), + 'line_subtotal_tax' => rtrim(rtrim(number_format(woocommerce_clean($line_subtotal_tax[$i]), 4, '.', ''), '0'), '.'), + 'item_meta' => $item_meta->meta, + 'tax_class' => woocommerce_clean($item_tax_class[$i]) + )); endfor; endif; diff --git a/admin/post-types/writepanels/writepanel-order_downloads.php b/admin/post-types/writepanels/writepanel-order_downloads.php index 5bfd3cfb7ef..ba0008fab4b 100644 --- a/admin/post-types/writepanels/writepanel-order_downloads.php +++ b/admin/post-types/writepanels/writepanel-order_downloads.php @@ -257,8 +257,8 @@ function woocommerce_order_downloads_save( $post_id, $post ) { $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 $customer_user, diff --git a/admin/post-types/writepanels/writepanel-product-type-variable.php b/admin/post-types/writepanels/writepanel-product-type-variable.php index d1863b646eb..e8d746e3da3 100644 --- a/admin/post-types/writepanels/writepanel-product-type-variable.php +++ b/admin/post-types/writepanels/writepanel-product-type-variable.php @@ -751,7 +751,9 @@ function process_product_meta_variable( $post_id ) { $attributes = (array) maybe_unserialize( get_post_meta($post_id, '_product_attributes', true) ); - for ( $i=0; $i <= max( array_keys( $_POST['variable_post_id'] ) ); $i++ ) : + $max_loop = max( array_keys( $_POST['variable_post_id'] ) ); + + for ( $i=0; $i <= $max_loop; $i++ ) : if ( ! isset( $variable_post_id[$i] ) ) continue; diff --git a/admin/post-types/writepanels/writepanel-product_data.php b/admin/post-types/writepanels/writepanel-product_data.php index b8623424c9b..e1357ad94ed 100644 --- a/admin/post-types/writepanels/writepanel-product_data.php +++ b/admin/post-types/writepanels/writepanel-product_data.php @@ -575,24 +575,26 @@ function woocommerce_process_product_meta( $post_id, $post ) { $attributes = array(); if (isset($_POST['attribute_names'])) : - $attribute_names = $_POST['attribute_names']; - $attribute_values = $_POST['attribute_values']; - if (isset($_POST['attribute_visibility'])) $attribute_visibility = $_POST['attribute_visibility']; - if (isset($_POST['attribute_variation'])) $attribute_variation = $_POST['attribute_variation']; - $attribute_is_taxonomy = $_POST['attribute_is_taxonomy']; - $attribute_position = $_POST['attribute_position']; - - for ($i=0; $i