Hello everyone.
I have good news for you. I've done it. See below how to duplicate product without images:
1. Modification of file /html/src/Adapter/Product/AdminProductDataUpdater.php
look for
use Validate;
and add after it
use Tools;
look for
if (!Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
and change to
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
2. Modification of file html/src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/list.html.twig
look for this block
{% set buttons_action = buttons_action|merge([
{
"onclick": "unitProductAction(this, 'duplicate');",
"icon": "content_copy",
"label": "Duplicate"|trans({}, 'Admin.Actions')
}
]) %}
and add after it
{% set buttons_action = buttons_action|merge([
{
"onclick": "unitProductAction(this, 'duplicate noimage=1');",
"icon": "content_copy",
"label": "Duplicate without images"|trans({}, 'Admin.Actions')
}
]) %}
3. Modification of file html/ADMINFOLDER/themes/default/js/bundle/product/catalog.js
look for this function and
function unitProductAction(element, action) {
...
}
and do like this (only two changes)
function unitProductAction(element, action) {
a = action.split(' '); action = a[0]; params = (a.length == 1) ? '' : a[1]; // <-- add this line
var form = $('form#product_catalog_list');
// save action URL for redirection and update to post to bulk action instead
// using form action URL allow to get route attributes and stay on the same page & ordering.
var urlHandler = $(element).closest('[data-uniturl]');
var redirectUrlHandler = $(element).closest('[redirecturl]');
var redirectionInput = $('<input>')
.attr('type', 'hidden')
.attr('name', 'redirect_url').val(redirectUrlHandler.attr('redirecturl'));
switch (action) {
case 'delete':
// Confirmation popup and callback...
$('#catalog_deletion_modal').modal('show');
$('#catalog_deletion_modal button[value="confirm"]').off('click');
$('#catalog_deletion_modal button[value="confirm"]').on('click', function () {
form.append($(redirectionInput));
var url = urlHandler.attr('data-uniturl').replace(/duplicate/, action);
form.attr('action', url);
form.submit();
$('#catalog_deletion_modal').modal('hide');
});
return;
// Other cases, nothing to do, continue.
//default:
}
form.append($(redirectionInput));
var url = urlHandler.attr('data-uniturl').replace(/duplicate/, action) + (params.length > 0 ? '&' + params : ''); // <-- and change this line
form.attr('action', url);
form.submit();
}
4. Clear cache in Performance and clear your browser cache.
That's all.
Have good clients $)