@@ -29,23 +29,35 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
29
29
*/
30
30
protected $ string ;
31
31
32
+ /**
33
+ * @var array
34
+ */
35
+ private $ singleSelectionTypes ;
36
+
32
37
/**
33
38
* @param \Magento\Checkout\Model\Session $checkoutSession
34
39
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
35
40
* @param \Magento\Framework\Stdlib\StringUtils $string
36
41
* @param \Magento\Framework\Escaper $escaper
37
42
* @param array $data
43
+ * @param array $singleSelectionTypes
38
44
*/
39
45
public function __construct (
40
46
\Magento \Checkout \Model \Session $ checkoutSession ,
41
47
\Magento \Framework \App \Config \ScopeConfigInterface $ scopeConfig ,
42
48
\Magento \Framework \Stdlib \StringUtils $ string ,
43
49
\Magento \Framework \Escaper $ escaper ,
44
- array $ data = []
50
+ array $ data = [],
51
+ array $ singleSelectionTypes = []
45
52
) {
46
53
$ this ->string = $ string ;
47
54
$ this ->_escaper = $ escaper ;
48
55
parent ::__construct ($ checkoutSession , $ scopeConfig , $ data );
56
+
57
+ $ this ->singleSelectionTypes = $ singleSelectionTypes ?: [
58
+ \Magento \Catalog \Api \Data \ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN ,
59
+ \Magento \Catalog \Api \Data \ProductCustomOptionInterface::OPTION_TYPE_RADIO ,
60
+ ];
49
61
}
50
62
51
63
/**
@@ -301,10 +313,6 @@ public function getOptionSku($optionValue, $skuDelimiter)
301
313
*/
302
314
protected function _isSingleSelection ()
303
315
{
304
- $ single = [
305
- \Magento \Catalog \Api \Data \ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN ,
306
- \Magento \Catalog \Api \Data \ProductCustomOptionInterface::OPTION_TYPE_RADIO ,
307
- ];
308
- return in_array ($ this ->getOption ()->getType (), $ single );
316
+ return in_array ($ this ->getOption ()->getType (), $ this ->singleSelectionTypes , true );
309
317
}
310
318
}
0 commit comments