Download original images in WooCommerce order

Posted almost 4 years by Oleksii

Post a topic
Implemented
O
Oleksii

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 Votes


4 Comments

Sorted by
O

Oleksii posted almost 4 years

Thanks!

0 Votes

rady kal

rady kal posted almost 4 years Admin

Included in V4.0.0

0 Votes

O

Oleksii posted almost 4 years

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.

0 Votes

r

rahul posted almost 4 years

Hi, Have you got the same solutions?

0 Votes

Login or Sign up to post a comment