Skip to content

Commit 0ac67b1

Browse files
committed
ACP2E-2990: Customer "created_at" date Not Converted to store time zone upon export
- Fixed the issue.
1 parent e7b59ae commit 0ac67b1

File tree

3 files changed

+78
-7
lines changed

3 files changed

+78
-7
lines changed

app/code/Magento/CustomerImportExport/Model/Export/Customer.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class Customer extends \Magento\ImportExport\Model\Export\Entity\AbstractEav
2727

2828
const COLUMN_STORE = '_store';
2929

30-
const COLUMN_CREATED_AT = 'created_at';
31-
3230
/**
3331
* Attribute collection name
3432
*/
@@ -160,11 +158,6 @@ public function exportItem($item)
160158
$row = $this->_addAttributeValuesToRow($item);
161159
$row[self::COLUMN_WEBSITE] = $this->_websiteIdToCode[$item->getWebsiteId()];
162160
$row[self::COLUMN_STORE] = $this->_storeIdToCode[$item->getStoreId()];
163-
$row[self::COLUMN_CREATED_AT] = $this->_localeDate->formatDate(
164-
$row[self::COLUMN_CREATED_AT],
165-
\IntlDateFormatter::MEDIUM,
166-
true
167-
);
168161

169162
$this->getWriter()->writeRow($row);
170163
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/************************************************************************
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*
6+
* NOTICE: All information contained herein is, and remains
7+
* the property of Adobe and its suppliers, if any. The intellectual
8+
* and technical concepts contained herein are proprietary to Adobe
9+
* and its suppliers and are protected by all applicable intellectual
10+
* property laws, including trade secret and copyright laws.
11+
* Dissemination of this information or reproduction of this material
12+
* is strictly forbidden unless prior written permission is obtained
13+
* from Adobe.
14+
* ***********************************************************************
15+
*/
16+
namespace Magento\CustomerImportExport\Plugin\Model\Export;
17+
18+
use Magento\CustomerImportExport\Model\Export\Customer;
19+
use Magento\Customer\Model\Customer as Item;
20+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
21+
22+
/**
23+
* Plugin for format the Customer item created at date column
24+
*
25+
*/
26+
class FormatCustomerCreatedAt
27+
{
28+
private const COLUMN_CREATED_AT = 'created_at';
29+
30+
/**
31+
* @param TimezoneInterface $localeDate
32+
*/
33+
public function __construct(
34+
private TimezoneInterface $localeDate
35+
) {
36+
}
37+
38+
/**
39+
* @param Customer $subject
40+
* @param Item $item
41+
* @return Item
42+
*/
43+
public function beforeExportItem(
44+
Customer $subject,
45+
Item $item
46+
) {
47+
$item->setData(
48+
self::COLUMN_CREATED_AT,
49+
$this->localeDate->formatDate(
50+
$item->getData(self::COLUMN_CREATED_AT),
51+
\IntlDateFormatter::MEDIUM,
52+
true
53+
)
54+
);
55+
}
56+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/************************************************************************
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*
7+
* NOTICE: All information contained herein is, and remains
8+
* the property of Adobe and its suppliers, if any. The intellectual
9+
* and technical concepts contained herein are proprietary to Adobe
10+
* and its suppliers and are protected by all applicable intellectual
11+
* property laws, including trade secret and copyright laws.
12+
* Dissemination of this information or reproduction of this material
13+
* is strictly forbidden unless prior written permission is obtained
14+
* from Adobe.
15+
* ***********************************************************************
16+
*/
17+
-->
18+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
19+
<type name="Magento\CustomerImportExport\Model\Export\Customer">
20+
<plugin name="formatCustomerCreatedAt" type="Magento\CustomerImportExport\Plugin\Model\Export\FormatCustomerCreatedAt" />
21+
</type>
22+
</config>

0 commit comments

Comments
 (0)