Skip to content

Commit

Permalink
Fix issue with merge button in customer duplicates (pimcore#510)
Browse files Browse the repository at this point in the history
* Fix issue with merge button in customer duplicates

* Update src/Resources/public/js/CustomerDuplicates/frontend.js

* Removed unintended code
  • Loading branch information
aryaantony92 authored and webdev-dp committed Nov 29, 2023
1 parent bd4c2bd commit 60c5c68
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/Resources/public/admin/js/cmf.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,13 +853,5 @@ app.SearchFilter.DateRangePicker = (function () {

$(document).ready(function() {
window.app.init($('body'));

const duplicates = $('.customer-duplicates-merge');
$.each(duplicates , function(index,duplicate) {
duplicate.addEventListener('click', (event) => {
const duplicateIds = JSON.parse(duplicate.dataset.duplicateIds);
new window.top.pimcore.plugin.objectmerger.panel(duplicateIds[0], duplicateIds[1]);
});
});
});
})(jQuery);
26 changes: 26 additions & 0 deletions src/Resources/public/js/CustomerDuplicates/frontend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/


$(function() {

// Merge button in customer duplicates view
const duplicates = document.getElementsByClassName('customer-duplicates-merge');
for(let duplicate of duplicates){
duplicate.addEventListener('click', (event) => {
const duplicateIds = JSON.parse(duplicate.dataset.duplicateIds);
new window.top.pimcore.plugin.objectmerger.panel(duplicateIds[0], duplicateIds[1]);
});
}

}());
1 change: 1 addition & 0 deletions src/Resources/views/admin/duplicates/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{% block content %}

{% do cmf_jsConfig().add('declineDuplicates', true) %}
{% do pimcore_head_script().appendFile(asset('/bundles/pimcorecustomermanagementframework/js/CustomerDuplicates/frontend.js')) %}

<div class="container">
<h2>{{ 'cmf_duplicates_potential_duplicates' | trans({}, 'admin') }}</h2>
Expand Down

0 comments on commit 60c5c68

Please sign in to comment.