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