1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Dotdigitalgroup\Email\Plugin;
/**
* Class CatalogProductAttributeSavePlugin - reset product in email_catalog when update attribute mass action is used.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
class CatalogProductAttributeSavePlugin
{
/**
* @var \Magento\Catalog\Helper\Product\Edit\Action\Attribute
*/
private $attributeHelper;
/**
* @var \Dotdigitalgroup\Email\Model\ResourceModel\Catalog
*/
private $catalogResource;
public function __construct(
\Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeHelper,
\Dotdigitalgroup\Email\Model\ResourceModel\Catalog $catalogResource
) {
$this->attributeHelper = $attributeHelper;
$this->catalogResource = $catalogResource;
}
/**
* @param \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute\Save $subject
* @param $result
*
* @return mixed
*/
public function afterExecute(
\Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute\Save $subject,
$result
) {
$productIds = $this->attributeHelper->getProductIds();
if (! empty($productIds)) {
$this->catalogResource->setModified($productIds);
}
return $result;
}
}