Implemented

Download original images in WooCommerce order

Hello.

Add please future to download original images (include designs) in WooCommerce order.

It will be good to download all images in single archive.


Thanks


2 people like this idea
  • Hi, Have you got the same solutions?
  • Hello.

    Try this.


    Add this code to theme functions.php:

    function woodbox_add_original_images_tab() {
    echo '<a href="original-images">' . __( 'Original Images', 'radykal' ) . '</a>';
    }

    add_action( 'fpd_order_viewer_tabs_end', 'woodbox_add_original_images_tab' );

    function woodbox_add_original_images_tab_content() {
    ?>
    <div data-id="original-images">
    <h4><?php _e( 'Original Images', 'radykal' ); ?></h4>

    <ul id="fpd-original-images-list"></ul>

    </div>
    <?php
    }

    add_action( 'fpd_order_viewer_tabs_content_end', 'woodbox_add_original_images_tab_content' );


    function woodbox_load_admin_scripts() {
    wp_register_script( 'woodbox-admin',
    get_stylesheet_directory_uri() . '/assets/js/admin.js',
    [],
    wp_get_theme()->get( 'Version' ) . microtime(),
    true );

    wp_enqueue_script( 'woodbox-admin' );
    }

    add_action( 'admin_enqueue_scripts', 'woodbox_load_admin_scripts' );

    Вo not forget to change the path to your admin.js file


    Create admin.js:

    jQuery(document).ready(function () {
    var $fancyProductDesigner = jQuery('#fpd-order-designer'),
    $originalImagesList = jQuery('#fpd-original-images-list'),
    customElements = null;


    $fancyProductDesigner.on('productCreate', function () {

    $originalImagesList.empty();

    customElements = fancyProductDesigner.getCustomElements();
    for (var i = 0; i < customElements.length; ++i) {
    var customElement = customElements[i].element;
    if (customElement.type === 'image' || customElement.type === 'path-group') {
    $originalImagesList.append('<li><a href="' + customElement.source + '" download>' + customElement.title + '</a></li>');
    }

    }
    });
    });


    This code add new tab "ORIGINAL IMAGES" in admin order viewer.


    I hope this helps you.

  • Included in V4.0.0

  • Thanks!

Login or Signup to post a comment