diff --git a/admin/importers/tax-rates-importer.php b/admin/importers/tax-rates-importer.php
index 97a229bfdff..d1275814ebb 100644
--- a/admin/importers/tax-rates-importer.php
+++ b/admin/importers/tax-rates-importer.php
@@ -59,7 +59,7 @@ if ( class_exists( 'WP_Importer' ) ) {
else
$file = ABSPATH . $this->file_url;
- add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
+ add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );
if ( function_exists( 'gc_enable' ) )
gc_enable();
diff --git a/admin/post-types/product.php b/admin/post-types/product.php
index b1de7ee125d..67f790915bf 100644
--- a/admin/post-types/product.php
+++ b/admin/post-types/product.php
@@ -82,7 +82,7 @@ function woocommerce_edit_product_columns( $columns ) {
unset( $columns['title'], $columns['comments'], $columns['date'] );
$columns["cb"] = "";
- $columns["thumb"] = __( 'Image', 'woocommerce' );
+ $columns["thumb"] = '';
$columns["name"] = __( 'Name', 'woocommerce' );
@@ -114,12 +114,14 @@ add_filter('manage_edit-product_columns', 'woocommerce_edit_product_columns');
* @return void
*/
function woocommerce_custom_product_columns( $column ) {
- global $post, $woocommerce;
- $product = get_product($post);
+ global $post, $woocommerce, $the_product;
+
+ if ( empty( $the_product ) || $the_product->id != $post->ID )
+ $the_product = get_product( $post );
switch ($column) {
case "thumb" :
- echo $product->get_image();
+ echo '' . $the_product->get_image() . '';
break;
case "name" :
$edit_link = get_edit_post_link( $post->ID );
@@ -183,51 +185,51 @@ function woocommerce_custom_product_columns( $column ) {
echo '
-
' . $product->sku . '
-
' . $product->regular_price . '
-
' . $product->sale_price . '
-
' . $product->weight . '
-
' . $product->length . '
-
' . $product->width . '
-
' . $product->height . '
-
' . $product->visibility . '
-
' . $product->stock_status . '
-
' . $product->stock . '
-
' . $product->manage_stock . '
-
' . $product->featured . '
-
' . $product->product_type . '
-
' . $product->virtual . '
+
' . $the_product->sku . '
+
' . $the_product->regular_price . '
+
' . $the_product->sale_price . '
+
' . $the_product->weight . '
+
' . $the_product->length . '
+
' . $the_product->width . '
+
' . $the_product->height . '
+
' . $the_product->visibility . '
+
' . $the_product->stock_status . '
+
' . $the_product->stock . '
+
' . $the_product->manage_stock . '
+
' . $the_product->featured . '
+
' . $the_product->product_type . '
+
' . $the_product->virtual . '
';
break;
case "sku" :
- if ($product->get_sku()) echo $product->get_sku(); else echo '–';
+ if ($the_product->get_sku()) echo $the_product->get_sku(); else echo '–';
break;
case "product_type" :
- if( $product->product_type == 'grouped' ):
- echo '';
- elseif ( $product->product_type == 'external' ):
- echo '';
- elseif ( $product->product_type == 'simple' ):
+ if( $the_product->product_type == 'grouped' ):
+ echo '';
+ elseif ( $the_product->product_type == 'external' ):
+ echo '';
+ elseif ( $the_product->product_type == 'simple' ):
- if ($product->is_virtual()) {
+ if ($the_product->is_virtual()) {
echo '';
- } elseif ($product->is_downloadable()) {
+ } elseif ($the_product->is_downloadable()) {
echo '';
} else {
- echo '';
+ echo '';
}
- elseif ( $product->product_type == 'variable' ):
- echo '';
+ elseif ( $the_product->product_type == 'variable' ):
+ echo '';
else:
// Assuming that we have other types in future
- echo '';
+ echo '';
endif;
break;
case "price":
- if ($product->get_price_html()) echo $product->get_price_html(); else echo '–';
+ if ($the_product->get_price_html()) echo $the_product->get_price_html(); else echo '–';
break;
case "product_cat" :
case "product_tag" :
@@ -244,20 +246,20 @@ function woocommerce_custom_product_columns( $column ) {
case "featured" :
$url = wp_nonce_url( admin_url('admin-ajax.php?action=woocommerce-feature-product&product_id=' . $post->ID), 'woocommerce-feature-product' );
echo '';
- if ($product->is_featured()) echo '';
+ if ($the_product->is_featured()) echo '';
else echo '';
echo '';
break;
case "is_in_stock" :
- if ($product->is_in_stock()) {
+ if ($the_product->is_in_stock()) {
echo '' . __( 'In stock', 'woocommerce' ) . '';
} else {
echo '' . __( 'Out of stock', 'woocommerce' ) . '';
}
- if ( $product->managing_stock() ) :
- echo ' × ' . $product->get_total_stock();
+ if ( $the_product->managing_stock() ) :
+ echo ' × ' . $the_product->get_total_stock();
endif;
break;
@@ -1197,3 +1199,24 @@ function woocommerce_disable_checked_ontop( $args ) {
}
add_filter( 'wp_terms_checklist_args', 'woocommerce_disable_checked_ontop' );
+
+/**
+ * Change label for insert buttons.
+ *
+ * @access public
+ * @param mixed $translation
+ * @param mixed $original
+ * @return void
+ */
+function woocommerce_change_insert_into_post( $strings ) {
+ global $post_type;
+
+ if ( $post_type == 'product' ) {
+ $strings['insertIntoPost'] = __( 'Insert into product', 'woocommerce' );
+ $strings['uploadedToThisPost'] = __( 'Uploaded to this product', 'woocommerce' );
+ }
+
+ return $strings;
+}
+
+add_filter( 'media_view_strings', 'woocommerce_change_insert_into_post' );
diff --git a/admin/post-types/shop_order.php b/admin/post-types/shop_order.php
index 6b6f1cd5168..b0a6ca49b73 100644
--- a/admin/post-types/shop_order.php
+++ b/admin/post-types/shop_order.php
@@ -64,20 +64,21 @@ add_filter('manage_edit-shop_order_columns', 'woocommerce_edit_order_columns');
* @return void
*/
function woocommerce_custom_order_columns( $column ) {
+ global $post, $woocommerce, $the_order;
- global $post, $woocommerce;
- $order = new WC_Order( $post->ID );
+ if ( empty( $the_order ) || $the_order->id != $post->ID )
+ $the_order = new WC_Order( $post->ID );
switch ( $column ) {
case "order_status" :
- printf( '%s', sanitize_title( $order->status ), esc_html__( $order->status, 'woocommerce' ) );
+ printf( '%s', sanitize_title( $the_order->status ), esc_html__( $the_order->status, 'woocommerce' ) );
break;
case "order_title" :
- if ( $order->user_id )
- $user_info = get_userdata( $order->user_id );
+ if ( $the_order->user_id )
+ $user_info = get_userdata( $the_order->user_id );
if ( ! empty( $user_info ) ) {
@@ -94,35 +95,35 @@ function woocommerce_custom_order_columns( $column ) {
$user = __( 'Guest', 'woocommerce' );
}
- echo '' . sprintf( __( 'Order %s', 'woocommerce' ), esc_attr( $order->get_order_number() ) ) . ' ' . __( 'made by', 'woocommerce' ) . ' ' . $user;
+ echo '' . sprintf( __( 'Order %s', 'woocommerce' ), esc_attr( $the_order->get_order_number() ) ) . ' ' . __( 'made by', 'woocommerce' ) . ' ' . $user;
- if ( $order->billing_email )
- echo '' . __( 'Email:', 'woocommerce' ) . ' ' . '' . esc_html( $order->billing_email ) . '';
+ if ( $the_order->billing_email )
+ echo '' . __( 'Email:', 'woocommerce' ) . ' ' . '' . esc_html( $the_order->billing_email ) . '';
- if ( $order->billing_phone )
- echo '' . __( 'Tel:', 'woocommerce' ) . ' ' . esc_html( $order->billing_phone ) . '';
+ if ( $the_order->billing_phone )
+ echo '' . __( 'Tel:', 'woocommerce' ) . ' ' . esc_html( $the_order->billing_phone ) . '';
break;
case "billing_address" :
- if ( $order->get_formatted_billing_address() )
- echo '' . esc_html( preg_replace( '#
#i', ', ', $order->get_formatted_billing_address() ) ) .'';
+ if ( $the_order->get_formatted_billing_address() )
+ echo '' . esc_html( preg_replace( '#
#i', ', ', $the_order->get_formatted_billing_address() ) ) .'';
else
echo '–';
- if ( $order->payment_method_title )
- echo '' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $order->payment_method_title ) . '';
+ if ( $the_order->payment_method_title )
+ echo '' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $the_order->payment_method_title ) . '';
break;
case "shipping_address" :
- if ( $order->get_formatted_shipping_address() )
- echo ''. esc_html( preg_replace('#
#i', ', ', $order->get_formatted_shipping_address() ) ) .'';
+ if ( $the_order->get_formatted_shipping_address() )
+ echo ''. esc_html( preg_replace('#
#i', ', ', $the_order->get_formatted_shipping_address() ) ) .'';
else
echo '–';
- if ( $order->shipping_method_title )
- echo '' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $order->shipping_method_title ) . '';
+ if ( $the_order->shipping_method_title )
+ echo '' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $the_order->shipping_method_title ) . '';
break;
case "total_cost" :
- echo esc_html( strip_tags( $order->get_formatted_order_total() ) );
+ echo esc_html( strip_tags( $the_order->get_formatted_order_total() ) );
break;
case "order_date" :
@@ -147,18 +148,18 @@ function woocommerce_custom_order_columns( $column ) {
?>
status, array( 'pending', 'on-hold' ) ) )
+ if ( in_array( $the_order->status, array( 'pending', 'on-hold' ) ) )
$actions[] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce-mark-order-processing&order_id=' . $post->ID ), 'woocommerce-mark-order-processing' ),
'name' => __( 'Processing', 'woocommerce' ),
'action' => "processing"
);
- if ( in_array( $order->status, array( 'pending', 'on-hold', 'processing' ) ) )
+ if ( in_array( $the_order->status, array( 'pending', 'on-hold', 'processing' ) ) )
$actions[] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce-mark-order-complete&order_id=' . $post->ID ), 'woocommerce-mark-order-complete' ),
'name' => __( 'Complete', 'woocommerce' ),
@@ -171,21 +172,21 @@ function woocommerce_custom_order_columns( $column ) {
'action' => "view"
);
- $actions = apply_filters( 'woocommerce_admin_order_actions', $actions, $order );
+ $actions = apply_filters( 'woocommerce_admin_order_actions', $actions, $the_order );
foreach ( $actions as $action ) {
$image = ( isset( $action['image_url'] ) ) ? $action['image_url'] : $woocommerce->plugin_url() . '/assets/images/icons/' . $action['action'] . '.png';
printf( '', esc_url( $action['url'] ), esc_attr( $action['name'] ), esc_attr( $image ), esc_attr( $action['name'] ) );
}
- do_action( 'woocommerce_admin_order_actions_end', $order );
+ do_action( 'woocommerce_admin_order_actions_end', $the_order );
?>
customer_note )
+ if ( $the_order->customer_note )
echo '';
else
echo '';
diff --git a/admin/post-types/writepanels/variation-admin-html.php b/admin/post-types/writepanels/variation-admin-html.php
index 241f68708b2..bbc061a5ef6 100644
--- a/admin/post-types/writepanels/variation-admin-html.php
+++ b/admin/post-types/writepanels/variation-admin-html.php
@@ -132,7 +132,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
diff --git a/admin/post-types/writepanels/writepanel-order_data.php b/admin/post-types/writepanels/writepanel-order_data.php
index 51dd6d496bd..0d4d9497476 100644
--- a/admin/post-types/writepanels/writepanel-order_data.php
+++ b/admin/post-types/writepanels/writepanel-order_data.php
@@ -329,7 +329,7 @@ function woocommerce_order_items_meta_box( $post ) {
$order = $theorder;
- $data = get_post_custom( $post->ID );
+ $data = get_post_meta( $post->ID );
?>
@@ -482,7 +482,7 @@ function woocommerce_order_totals_meta_box( $post ) {
$order = $theorder;
- $data = get_post_custom( $post->ID );
+ $data = get_post_meta( $post->ID );
?>
diff --git a/admin/post-types/writepanels/writepanel-product-type-variable.php b/admin/post-types/writepanels/writepanel-product-type-variable.php
index 3911bb8a4e0..28c17a8fede 100644
--- a/admin/post-types/writepanels/writepanel-product-type-variable.php
+++ b/admin/post-types/writepanels/writepanel-product-type-variable.php
@@ -74,6 +74,10 @@ function variable_product_type_options() {
-
-
+
@@ -131,7 +134,7 @@ function variable_product_type_options() {
$variation_id = absint( $variation->ID );
$variation_post_status = esc_attr( $variation->post_status );
- $variation_data = get_post_custom( $variation_id );
+ $variation_data = get_post_meta( $variation_id );
$variation_data['variation_post_id'] = $variation_id;
// Grab shipping classes
@@ -344,71 +347,73 @@ function variable_product_type_options() {
return false;
});
- jQuery('#variable_product_options').on('click', 'a.delete_variations', function(){
- var answer = confirm('');
- if (answer){
+ jQuery('.wc-metaboxes-wrapper').on('click', 'a.bulk_edit', function(event){
+ var field_to_edit = jQuery('select#field_to_edit').val();
- var answer = confirm('');
+ if ( field_to_edit == 'toggle_enabled' ) {
+ var checkbox = jQuery('input[name^="variable_enabled"]');
+ checkbox.attr('checked', !checkbox.attr('checked'));
+ return false;
+ }
+ else if ( field_to_edit == 'toggle_downloadable' ) {
+ var checkbox = jQuery('input[name^="variable_is_downloadable"]');
+ checkbox.attr('checked', !checkbox.attr('checked'));
+ jQuery('input.variable_is_downloadable').change();
+ return false;
+ }
+ else if ( field_to_edit == 'toggle_virtual' ) {
+ var checkbox = jQuery('input[name^="variable_is_virtual"]');
+ checkbox.attr('checked', !checkbox.attr('checked'));
+ jQuery('input.variable_is_virtual').change();
+ return false;
+ }
+ else if ( field_to_edit == 'delete_all' ) {
- if (answer) {
+ var answer = confirm('');
+ if (answer){
- var variation_ids = [];
+ var answer = confirm('');
- jQuery('.woocommerce_variations .woocommerce_variation').block({ message: null, overlayCSS: { background: '#fff url(plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
+ if (answer) {
- jQuery('.woocommerce_variations .woocommerce_variation .remove_variation').each(function(){
+ var variation_ids = [];
- var variation = jQuery(this).attr('rel');
- if (variation>0) {
- variation_ids.push(variation);
- }
- });
+ jQuery('.woocommerce_variations .woocommerce_variation').block({ message: null, overlayCSS: { background: '#fff url(plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
- var data = {
- action: 'woocommerce_remove_variations',
- variation_ids: variation_ids,
- security: ''
- };
+ jQuery('.woocommerce_variations .woocommerce_variation .remove_variation').each(function(){
- jQuery.post('', data, function(response) {
- jQuery('.woocommerce_variations .woocommerce_variation').fadeOut('300', function(){
- jQuery('.woocommerce_variations .woocommerce_variation').remove();
+ var variation = jQuery(this).attr('rel');
+ if (variation>0) {
+ variation_ids.push(variation);
+ }
});
- });
+
+ var data = {
+ action: 'woocommerce_remove_variations',
+ variation_ids: variation_ids,
+ security: ''
+ };
+
+ jQuery.post('', data, function(response) {
+ jQuery('.woocommerce_variations .woocommerce_variation').fadeOut('300', function(){
+ jQuery('.woocommerce_variations .woocommerce_variation').remove();
+ });
+ });
+
+ }
}
+ return false;
+ }
+ else {
+
+ var input_tag = jQuery('select#field_to_edit :selected').attr('rel') ? jQuery('select#field_to_edit :selected').attr('rel') : 'input';
+
+ var value = prompt("");
+ jQuery(input_tag + '[name^="' + field_to_edit + '"]').val( value );
+ return false;
}
- return false;
- });
-
- jQuery('a.bulk_edit').click(function() {
- var field_to_edit = jQuery('select#field_to_edit').val();
- var input_tag = jQuery('select#field_to_edit :selected').attr('rel') ? jQuery('select#field_to_edit :selected').attr('rel') : 'input';
-
- var value = prompt("");
- jQuery(input_tag + '[name^="' + field_to_edit + '"]').val( value );
- return false;
- });
-
- jQuery('a.toggle_virtual').click(function(){
- var checkbox = jQuery('input[name^="variable_is_virtual"]');
- checkbox.attr('checked', !checkbox.attr('checked'));
- jQuery('input.variable_is_virtual').change();
- return false;
- });
-
- jQuery('a.toggle_downloadable').click(function(){
- var checkbox = jQuery('input[name^="variable_is_downloadable"]');
- checkbox.attr('checked', !checkbox.attr('checked'));
- jQuery('input.variable_is_downloadable').change();
- return false;
- });
-
- jQuery('a.toggle_enabled').click(function(){
- var checkbox = jQuery('input[name^="variable_enabled"]');
- checkbox.attr('checked', !checkbox.attr('checked'));
- return false;
});
jQuery('#variable_product_options').on('change', 'input.variable_is_downloadable', function(){
@@ -459,53 +464,69 @@ function variable_product_type_options() {
});
};
- var current_field_wrapper;
+ // Uploader
+ var variable_image_frame;
+ var setting_variation_image_id;
+ var setting_variation_image;
+ var wp_media_post_id = wp.media.model.settings.post.id;
- window.send_to_editor_default = window.send_to_editor;
+ jQuery('#variable_product_options').on('click', '.upload_image_button', function( event ) {
- jQuery('#variable_product_options').on('click', '.upload_image_button', function(){
+ var $button = jQuery( this );
+ var post_id = $button.attr('rel');
+ var $parent = $button.closest('.upload_image');
+ setting_variation_image = $parent;
+ setting_variation_image_id = post_id;
- var post_id = jQuery(this).attr('rel');
- var parent = jQuery(this).parent();
- current_field_wrapper = parent;
+ event.preventDefault();
- if (jQuery(this).is('.remove')) {
+ if ( $button.is('.remove') ) {
- jQuery('.upload_image_id', current_field_wrapper).val('');
- jQuery('img', current_field_wrapper).attr('src', '');
- jQuery(this).removeClass('remove');
+ setting_variation_image.find( '.upload_image_id' ).val( '' );
+ setting_variation_image.find( 'img' ).attr( 'src', '' );
+ setting_variation_image.find( '.upload_image_button' ).removeClass( 'remove' );
} else {
- window.send_to_editor = window.send_to_cproduct;
- formfield = jQuery('.upload_image_id', parent).attr('name');
- tb_show('', 'media-upload.php?post_id=' + post_id + '&type=image&TB_iframe=true');
+ // If the media frame already exists, reopen it.
+ if ( variable_image_frame ) {
+ variable_image_frame.uploader.uploader.param( 'post_id', setting_variation_image_id );
+ variable_image_frame.open();
+ return;
+ } else {
+ wp.media.model.settings.post.id = setting_variation_image_id;
+ }
+ // Create the media frame.
+ variable_image_frame = wp.media.frames.variable_image = wp.media({
+ // Set the title of the modal.
+ title: '',
+ button: {
+ text: ''
+ }
+ });
+
+ // When an image is selected, run a callback.
+ variable_image_frame.on( 'select', function() {
+
+ attachment = variable_image_frame.state().get('selection').first().toJSON();
+
+ setting_variation_image.find( '.upload_image_id' ).val( attachment.id );
+ setting_variation_image.find( '.upload_image_button' ).addClass( 'remove' );
+ setting_variation_image.find( 'img' ).attr( 'src', attachment.url );
+
+ wp.media.model.settings.post.id = wp_media_post_id;
+ });
+
+ // Finally, open the modal.
+ variable_image_frame.open();
}
-
- return false;
});
- window.send_to_cproduct = function(html) {
-
- jQuery('body').append(' ' + html + ' ');
-
- var img = jQuery('#temp_image').find('img');
-
- imgurl = img.attr('src');
- imgclass = img.attr('class');
- imgid = parseInt(imgclass.replace(/\D/g, ''), 10);
-
- jQuery('.upload_image_id', current_field_wrapper).val(imgid);
- jQuery('.upload_image_button', current_field_wrapper).addClass('remove');
-
- jQuery('img', current_field_wrapper).attr('src', imgurl);
- tb_remove();
- jQuery('#temp_image').remove();
-
- window.send_to_editor = window.send_to_editor_default;
-
- }
+ // Restore ID
+ jQuery('a.add_media').on('click', function() {
+ wp.media.model.settings.post.id = wp_media_post_id;
+ } );
});
-
+
';
// Download Limit
@@ -648,8 +648,9 @@ function woocommerce_process_product_meta( $post_id, $post ) {
update_post_meta( $post_id, '_downloadable', $is_downloadable );
update_post_meta( $post_id, '_virtual', $is_virtual );
- // Set transient for product type
- set_transient( 'wc_product_type_' . $post_id, $product_type );
+ // Gallery Images
+ $attachment_ids = array_filter( explode( ',', woocommerce_clean( $_POST['product_image_gallery'] ) ) );
+ update_post_meta( $post_id, '_product_image_gallery', implode( ',', $attachment_ids ) );
// Update post meta
update_post_meta( $post_id, '_regular_price', stripslashes( $_POST['_regular_price'] ) );
@@ -766,14 +767,10 @@ function woocommerce_process_product_meta( $post_id, $post ) {
);
}
- } else {
- if ( ! $attribute_values[ $i ] ) continue;
- // Format values
- $values = esc_html( stripslashes( $attribute_values[ $i ] ) );
+ } elseif ( isset( $attribute_values[ $i ] ) ) {
+
// Text based, separate by pipe
- $values = explode( '|', $values );
- $values = array_map( 'trim', $values );
- $values = implode( '|', $values );
+ $values = implode( '|', array_map( 'esc_html', array_map( 'trim', explode( '|', stripslashes( $attribute_values[ $i ] ) ) ) ) );
// Custom attribute - Add attribute to array and set the values
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
@@ -1015,29 +1012,6 @@ function woocommerce_process_product_meta( $post_id, $post ) {
add_action('woocommerce_process_product_meta', 'woocommerce_process_product_meta', 1, 2);
-/**
- * Change label for insert buttons.
- *
- * @access public
- * @param mixed $translation
- * @param mixed $original
- * @return void
- */
-function woocommerce_change_insert_into_post( $translation, $original ) {
- if ( ! isset( $_REQUEST['from'] ) )
- return $translation;
-
- $original = strtolower( $original );
-
- if ( $_REQUEST['from'] == 'wc01' && ( $original == 'insert into post' || $original == 'use this image' ) )
- return __( 'Use this file', 'woocommerce' );
-
- return $translation;
-}
-
-add_filter( 'gettext', 'woocommerce_change_insert_into_post', null, 2 );
-
-
/**
* Output product visibility options.
*
diff --git a/admin/post-types/writepanels/writepanel-product_images.php b/admin/post-types/writepanels/writepanel-product_images.php
index 38429458f46..ce20f3d7510 100644
--- a/admin/post-types/writepanels/writepanel-product_images.php
+++ b/admin/post-types/writepanels/writepanel-product_images.php
@@ -24,259 +24,138 @@ function woocommerce_product_images_box() {
ID );
-
- if ( $thumbnail_id )
- echo '-
- ' . wp_get_attachment_image( $thumbnail_id, 'full' ) . '
-
-
-
';
-
- $attachments =& get_children( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image' );
-
- foreach ( $attachments as $attachment_id => $attachment ) {
- if ( $thumbnail_id == $attachment_id )
- continue;
-
- $exclude_class = get_post_meta( $attachment_id, '_woocommerce_exclude_image', true ) == 1 ? 'excluded' : '';
-
- echo '-
- ' . wp_get_attachment_image( $attachment_id, 'full' ) . '
-
-
-
';
+ if ( metadata_exists( 'post', $post->ID, '_product_image_gallery' ) ) {
+ $product_image_gallery = get_post_meta( $post->ID, '_product_image_gallery', true );
+ } else {
+ // Backwards compat
+ $attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
+ $product_image_gallery = implode( ',', $attachment_ids );
}
+
+ $attachments = array_filter( explode( ',', $product_image_gallery ) );
+
+ if ( $attachments )
+ foreach ( $attachments as $attachment_id ) {
+ echo '-
+ ' . wp_get_attachment_image( $attachment_id, 'full' ) . '
+
+
';
+ }
?>
-
-
-
- 'html5,silverlight,flash,html4',
- 'browse_button' => 'plupload-browse-button',
- 'container' => 'plupload-upload-ui',
- 'drop_element' => 'drag-drop-area',
- 'file_data_name' => 'async-upload',
- 'multiple_queues' => true,
- 'max_file_size' => wp_max_upload_size() . 'b',
- 'url' => admin_url('admin-ajax.php'),
- 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
- 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
- 'filters' => array( array( 'title' => __( 'Allowed Files' ), 'extensions' => '*') ),
- 'multipart' => true,
- 'urlstream_upload' => true,
- 'multipart_params' => array(
- '_ajax_nonce' => wp_create_nonce( 'product-images-box-upload' ),
- 'action' => 'woocommerce_product_images_box_upload',
- 'post_id' => $post->ID
- )
- );
+
- // Apply filters to initiate plupload:
- $plupload_init = apply_filters( 'plupload_init', $plupload_init );
- ?>
+
+
+
+
|