diff --git a/features/channel/managing_channels/adding_new_channel_with_menu_taxon.feature b/features/channel/managing_channels/adding_new_channel_with_menu_taxon.feature index 4d23169530..8158a6d414 100644 --- a/features/channel/managing_channels/adding_new_channel_with_menu_taxon.feature +++ b/features/channel/managing_channels/adding_new_channel_with_menu_taxon.feature @@ -11,15 +11,11 @@ Feature: Adding a new channel with menu taxon And the store classifies its products as "Clothes" and "Guns" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Adding a new channel with menu taxon Given I want to create a new channel When I specify its code as "MOBILE" And I name it "Mobile channel" - And I choose "Euro" as the base currency - And I choose "English (United States)" as a default locale - And I specify company as "Ragnarok" - And I specify tax ID as "1100110011" And I specify menu taxon as "Clothes" And I add it Then I should be notified that it has been successfully created diff --git a/features/channel/managing_channels/editing_menu_taxon_on_channel.feature b/features/channel/managing_channels/editing_menu_taxon_on_channel.feature index 16e012e561..bb32cbf8b5 100644 --- a/features/channel/managing_channels/editing_menu_taxon_on_channel.feature +++ b/features/channel/managing_channels/editing_menu_taxon_on_channel.feature @@ -11,7 +11,7 @@ Feature: Editing menu taxon on channel And channel "Web Store" has menu taxon "Clothes" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Editing menu taxon on the channel When I want to modify a channel "Web Store" And I change its menu taxon to "Guns" diff --git a/src/Sylius/Behat/Page/Admin/Channel/CreatePage.php b/src/Sylius/Behat/Page/Admin/Channel/CreatePage.php index 98a277997f..e8d89da7f8 100644 --- a/src/Sylius/Behat/Page/Admin/Channel/CreatePage.php +++ b/src/Sylius/Behat/Page/Admin/Channel/CreatePage.php @@ -19,6 +19,7 @@ use Sylius\Behat\Behaviour\NamesIt; use Sylius\Behat\Behaviour\SpecifiesItsCode; use Sylius\Behat\Behaviour\Toggles; use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage; +use Sylius\Behat\Service\AutocompleteHelper; class CreatePage extends BaseCreatePage implements CreatePageInterface { @@ -94,7 +95,9 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface public function specifyMenuTaxon(string $menuTaxon): void { - $this->getElement('menu_taxon')->selectOption($menuTaxon); + $menuTaxonElement = $this->getElement('menu_taxon')->getParent(); + + AutocompleteHelper::chooseValue($this->getSession(), $menuTaxonElement, $menuTaxon); } protected function getToggleableElement(): NodeElement diff --git a/src/Sylius/Behat/Page/Admin/Channel/UpdatePage.php b/src/Sylius/Behat/Page/Admin/Channel/UpdatePage.php index cc6fc59bd7..306631edd8 100644 --- a/src/Sylius/Behat/Page/Admin/Channel/UpdatePage.php +++ b/src/Sylius/Behat/Page/Admin/Channel/UpdatePage.php @@ -17,6 +17,7 @@ use Behat\Mink\Element\NodeElement; use Sylius\Behat\Behaviour\ChecksCodeImmutability; use Sylius\Behat\Behaviour\Toggles; use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage; +use Sylius\Behat\Service\AutocompleteHelper; class UpdatePage extends BaseUpdatePage implements UpdatePageInterface { @@ -99,12 +100,14 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface public function changeMenuTaxon(string $menuTaxon): void { - $this->getElement('menu_taxon')->selectOption($menuTaxon); + $menuTaxonElement = $this->getElement('menu_taxon')->getParent(); + + AutocompleteHelper::chooseValue($this->getSession(), $menuTaxonElement, $menuTaxon); } public function getMenuTaxon(): string { - return $this->getElement('menu_taxon')->find('css', 'option:selected')->getText(); + return $this->getElement('menu_taxon')->getParent()->find('css', '.search > .text')->getText(); } public function getUsedTheme(): string diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/Channel/_form.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/Channel/_form.html.twig index c84b016284..6d76e2b376 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/views/Channel/_form.html.twig +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/Channel/_form.html.twig @@ -69,6 +69,9 @@ {{ form_row(form.locales) }} {{ form_row(form.defaultLocale) }} +
+ {{ form_row(form.menuTaxon) }} +
{{ form_row(form.skippingShippingStepAllowed) }} diff --git a/src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php b/src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php index 882d12f25e..fd3825eeda 100644 --- a/src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php +++ b/src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php @@ -21,6 +21,7 @@ use Sylius\Bundle\CoreBundle\Form\Type\ShopBillingDataType; use Sylius\Bundle\CoreBundle\Form\Type\TaxCalculationStrategyChoiceType; use Sylius\Bundle\CurrencyBundle\Form\Type\CurrencyChoiceType; use Sylius\Bundle\LocaleBundle\Form\Type\LocaleChoiceType; +use Sylius\Bundle\TaxonomyBundle\Form\Type\TaxonAutocompleteChoiceType; use Sylius\Bundle\ThemeBundle\Form\Type\ThemeNameChoiceType; use Sylius\Component\Core\Model\Scope; use Symfony\Component\Form\AbstractTypeExtension; @@ -86,6 +87,9 @@ final class ChannelTypeExtension extends AbstractTypeExtension ->add('shopBillingData', ShopBillingDataType::class, [ 'label' => 'sylius.form.channel.shop_billing_data', ]) + ->add('menuTaxon', TaxonAutocompleteChoiceType::class, [ + 'label' => 'sylius.form.channel.menu_taxon', + ]) ->addEventSubscriber(new AddBaseCurrencySubscriber()) ->addEventSubscriber(new ChannelFormSubscriber()) ; diff --git a/src/Sylius/Bundle/CoreBundle/Resources/translations/messages.en.yml b/src/Sylius/Bundle/CoreBundle/Resources/translations/messages.en.yml index 8937e1c406..047a7224bd 100644 --- a/src/Sylius/Bundle/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Sylius/Bundle/CoreBundle/Resources/translations/messages.en.yml @@ -37,6 +37,7 @@ sylius: hostname: Hostname locale_default: Default locale locales: Locales + menu_taxon: Menu taxon payment_methods: Payment Methods shipping_methods: Shipping Methods shop_billing_data: Shop billing data