5
5
*/
6
6
declare (strict_types=1 );
7
7
8
- namespace Magento \ConfigurableProduct \Model \Plugin \ Frontend ;
8
+ namespace Magento \ConfigurableProduct \Model \Plugin ;
9
9
10
10
use Magento \Catalog \Api \Data \ProductInterface ;
11
11
use Magento \Catalog \Api \Data \ProductInterfaceFactory ;
12
12
use Magento \Catalog \Model \Category ;
13
13
use Magento \Catalog \Model \Product ;
14
14
use Magento \ConfigurableProduct \Model \Product \Type \Configurable ;
15
15
use Magento \Customer \Model \Session ;
16
+ use Magento \Framework \App \State as AppState ;
16
17
use Magento \Framework \Cache \FrontendInterface ;
17
18
use Magento \Framework \EntityManager \MetadataPool ;
18
19
use Magento \Framework \Serialize \SerializerInterface ;
24
25
*/
25
26
class UsedProductsCache
26
27
{
28
+ /**
29
+ * @var AppState
30
+ */
31
+ private $ appState ;
32
+
27
33
/**
28
34
* @var MetadataPool
29
35
*/
@@ -50,19 +56,22 @@ class UsedProductsCache
50
56
private $ customerSession ;
51
57
52
58
/**
59
+ * @param AppState $appState
53
60
* @param MetadataPool $metadataPool
54
61
* @param FrontendInterface $cache
55
62
* @param SerializerInterface $serializer
56
63
* @param ProductInterfaceFactory $productFactory
57
64
* @param Session $customerSession
58
65
*/
59
66
public function __construct (
67
+ AppState $ appState ,
60
68
MetadataPool $ metadataPool ,
61
69
FrontendInterface $ cache ,
62
70
SerializerInterface $ serializer ,
63
71
ProductInterfaceFactory $ productFactory ,
64
72
Session $ customerSession
65
73
) {
74
+ $ this ->appState = $ appState ;
66
75
$ this ->metadataPool = $ metadataPool ;
67
76
$ this ->cache = $ cache ;
68
77
$ this ->serializer = $ serializer ;
@@ -111,6 +120,7 @@ private function getCacheKey($product, $requiredAttributeIds = null): string
111
120
$ product ->getData ($ metadata ->getLinkField ()),
112
121
$ product ->getStoreId (),
113
122
$ this ->customerSession ->getCustomerGroupId (),
123
+ $ this ->appState ->getAreaCode (),
114
124
];
115
125
if ($ requiredAttributeIds !== null ) {
116
126
sort ($ requiredAttributeIds );
0 commit comments