From 4395ea068d276ce632ba3c8f7d55b21f61fee419 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Thu, 14 Mar 2019 12:54:55 +0200 Subject: [PATCH 1/3] Custom option type select - Allow modify list of single selection option types --- .../Model/Product/Option/Type/Select.php | 20 +++++++++++++------ app/code/Magento/Catalog/etc/di.xml | 8 ++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index d14f56718d159..7f622dcb54e48 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -29,23 +29,35 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ protected $string; + /** + * @var array + */ + private $singleSelectionTypes; + /** * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Escaper $escaper * @param array $data + * @param array $singleSelectionTypes */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Escaper $escaper, - array $data = [] + array $data = [], + array $singleSelectionTypes = [] ) { $this->string = $string; $this->_escaper = $escaper; parent::__construct($checkoutSession, $scopeConfig, $data); + + $this->singleSelectionTypes = $singleSelectionTypes ?: [ + \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, + \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO, + ]; } /** @@ -301,10 +313,6 @@ public function getOptionSku($optionValue, $skuDelimiter) */ protected function _isSingleSelection() { - $single = [ - \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, - \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO, - ]; - return in_array($this->getOption()->getType(), $single); + return in_array($this->getOption()->getType(), $this->singleSelectionTypes, true); } } diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 1d3e9a931b677..185e3017ec447 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -1164,4 +1164,12 @@ + + + + Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN + Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO + + + From a91de2bed2acc7408d6a2e6cdb35c1282f834aaf Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 8 May 2019 16:10:56 -0500 Subject: [PATCH 2/3] Renamed travis.yml file to travis.yml.sample - travis build is not required on magento2 repository - all required builds are implemented as GitHub checks --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .travis.yml => .travis.yml.sample | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .travis.yml => .travis.yml.sample (100%) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f191bd9aaba67..9d66ee40d6f59 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -35,4 +35,4 @@ - [ ] Pull request has a meaningful description of its purpose - [ ] All commits are accompanied by meaningful commit messages - [ ] All new or changed code is covered with unit/integration tests (if applicable) - - [ ] All automated tests passed successfully (all builds on Travis CI are green) + - [ ] All automated tests passed successfully (all builds are green) diff --git a/.travis.yml b/.travis.yml.sample similarity index 100% rename from .travis.yml rename to .travis.yml.sample From 9c8fa5dc40d56ce011db1cc32f85ef999ac2c081 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Thu, 9 May 2019 10:20:12 -0500 Subject: [PATCH 3/3] Renamed travis.yml file to travis.yml.sample - updated readme file --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d64ac8061528f..5a200505ec576 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.2-develop)](https://travis-ci.org/magento/magento2) [![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)