WooCommerce integration
-
Hello,
for a couple of hours now I am trying to integrate EML with WooCommerce.
I am using variable product and there is a selector for variation image.From their code, the frame to select the image is opened like so:
// 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: '<?php echo esc_js( __( 'Choose an image', 'woocommerce' ) ); ?>', button: { text: '<?php echo esc_js( __( 'Set variation image', 'woocommerce' ) ); ?>' } }); // 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();
Similar code opens the media frame to select multiple images for the product, this frame is also without EML filters.
As there may be hundreds of products and variations, the filters are necessary.Do you know how to alter the code to open the frame along with the EML filters? I see that in eml-media-uploader.js you extend AttachmentsBrowser but I guess the default media frame invoked by the wp.media() is using some other defaults and so far I wasn’t able to find out how to hook EML filters there.
Please let me know if you have any advice on this.
Thank you very much!
Best regards
Vithttps://www.ads-software.com/plugins/enhanced-media-library/
- The topic ‘WooCommerce integration’ is closed to new replies.