14
14
use Magento \Catalog \Model \Product \Gallery \ReadHandler as GalleryReadHandler ;
15
15
use Magento \ConfigurableProduct \Model \Product \Type \Collection \SalableProcessor ;
16
16
use Magento \Framework \App \ObjectManager ;
17
+ use Magento \Framework \App \State as AppState ;
17
18
use Magento \Framework \EntityManager \MetadataPool ;
18
19
19
20
/**
@@ -194,6 +195,11 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType
194
195
*/
195
196
private $ salableProcessor ;
196
197
198
+ /**
199
+ * @var AppState
200
+ */
201
+ private $ appState ;
202
+
197
203
/**
198
204
* @codingStandardsIgnoreStart/End
199
205
*
@@ -217,6 +223,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType
217
223
* @param \Magento\Framework\Serialize\Serializer\Json $serializer
218
224
* @param ProductInterfaceFactory $productFactory
219
225
* @param SalableProcessor $salableProcessor
226
+ * @param AppState|null $appState
220
227
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
221
228
*/
222
229
public function __construct (
@@ -241,7 +248,8 @@ public function __construct(
241
248
\Magento \Customer \Model \Session $ customerSession = null ,
242
249
\Magento \Framework \Serialize \Serializer \Json $ serializer = null ,
243
250
ProductInterfaceFactory $ productFactory = null ,
244
- SalableProcessor $ salableProcessor = null
251
+ SalableProcessor $ salableProcessor = null ,
252
+ AppState $ appState = null
245
253
) {
246
254
$ this ->typeConfigurableFactory = $ typeConfigurableFactory ;
247
255
$ this ->_eavAttributeFactory = $ eavAttributeFactory ;
@@ -256,6 +264,7 @@ public function __construct(
256
264
$ this ->productFactory = $ productFactory ?: ObjectManager::getInstance ()
257
265
->get (ProductInterfaceFactory::class);
258
266
$ this ->salableProcessor = $ salableProcessor ?: ObjectManager::getInstance ()->get (SalableProcessor::class);
267
+ $ this ->appState = $ appState ?? ObjectManager::getInstance ()->get (AppState::class);
259
268
parent ::__construct (
260
269
$ catalogProductOption ,
261
270
$ eavConfig ,
@@ -1246,6 +1255,7 @@ public function getUsedProducts($product, $requiredAttributeIds = null)
1246
1255
$ product ->getData ($ metadata ->getLinkField ()),
1247
1256
$ product ->getStoreId (),
1248
1257
$ this ->getCustomerSession ()->getCustomerGroupId (),
1258
+ $ this ->appState ->getAreaCode (),
1249
1259
$ requiredAttributeIds
1250
1260
];
1251
1261
$ cacheKey = $ this ->getUsedProductsCacheKey ($ keyParts );
0 commit comments