From 79a5074dd5e5ebf10dbffc448c3cca1651954353 Mon Sep 17 00:00:00 2001 From: mamazu Date: Thu, 28 May 2020 21:15:34 +0200 Subject: [PATCH 1/7] Using tabs for channel pricing --- .../Admin/Product/CreateSimpleProductPage.php | 4 +-- .../Resources/translations/messages.en.yml | 2 ++ .../views/Product/Tab/_details.html.twig | 36 ++++++++++++++++--- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php b/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php index 0abedcd2a4..fedd128863 100644 --- a/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php +++ b/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php @@ -236,8 +236,8 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd 'locale_tab' => '#attributesContainer .menu [data-tab="%localeCode%"]', 'main_taxon' => '#sylius_product_mainTaxon', 'name' => '#sylius_product_translations_%locale%_name', - 'price' => '#sylius_product_variant_channelPricings > .field:contains("%channelName%") input[name$="[price]"]', - 'original_price' => '#sylius_product_variant_channelPricings > .field:contains("%channelName%") input[name$="[originalPrice]"]', + 'price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[price]"]', + 'original_price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[originalPrice]"]', 'price_calculator' => '#sylius_product_variant_pricingCalculator', 'shipping_category' => '#sylius_product_variant_shippingCategory', 'shipping_required' => '#sylius_product_variant_shippingRequired', diff --git a/src/Sylius/Bundle/AdminBundle/Resources/translations/messages.en.yml b/src/Sylius/Bundle/AdminBundle/Resources/translations/messages.en.yml index 0f81052fae..01a5b9f69a 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/translations/messages.en.yml +++ b/src/Sylius/Bundle/AdminBundle/Resources/translations/messages.en.yml @@ -44,6 +44,8 @@ sylius: header: Sales orders: Orders ui: + product: + product_not_active_in_channel: The product is not yet activated in this channel. gateway: no_sca_support_notice: The chosen payment gateway does not support SCA. sales_summary: Sales summary diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_details.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_details.html.twig index c25e23f946..63854cbb65 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_details.html.twig +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_details.html.twig @@ -29,13 +29,39 @@
{{ form_row(form.channels) }} - - {% if product.simple %} -

{{ 'sylius.ui.pricing'|trans }}

- {{ form_row(form.variant.channelPricings, {'label': false}) }} - {% endif %}
+ {% if product.simple %} +
+
+

{{ 'sylius.ui.pricing'|trans }}

+ + {% for channelCode, channelPricing in form.variant.channelPricings %} + {% if loop.index0 == 0 %} +
+ {% else %} +
+ {% endif %} + + {% if channelCode not in product.channels|map(channel => channel.code) %} +
+ {{ 'sylius.ui.product.product_not_active_in_channel'|trans }} +
+ {% endif %} + {{ form_row(channelPricing, {'label': false}) }} +
+ {% endfor %} +
+
+ {% endif %} {{ translationFormWithSlug(form.translations, '@SyliusAdmin/Product/_slugField.html.twig', product) }} {% if product.simple %} From d4511ea2de29746976d3ec540ad4dff876c64d64 Mon Sep 17 00:00:00 2001 From: mamazu Date: Sat, 30 May 2020 00:09:36 +0200 Subject: [PATCH 2/7] Extracting channel_pricings out to its own template --- .../Page/Admin/ProductVariant/CreatePage.php | 4 +-- .../views/Product/Tab/_details.html.twig | 27 ++----------------- .../views/Product/_channel_pricing.html.twig | 26 ++++++++++++++++++ .../ProductVariant/Tab/_details.html.twig | 3 ++- 4 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig diff --git a/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePage.php b/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePage.php index 4085ba471c..1b9149bf19 100644 --- a/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePage.php +++ b/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePage.php @@ -110,8 +110,8 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface 'price_calculator' => '#sylius_product_variant_pricingCalculator', 'shipping_category' => '#sylius_product_variant_shippingCategory', 'shipping_required' => '#sylius_product_variant_shippingRequired', - 'original_price' => '#sylius_product_variant_channelPricings > .field:contains("%channelName%") input[name$="[originalPrice]"]', - 'price' => '#sylius_product_variant_channelPricings > .field:contains("%channelName%") input[name$="[price]"]', + 'original_price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[originalPrice]"]', + 'price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[price]"]', 'prices_validation_message' => '#sylius_product_variant_channelPricings ~ .sylius-validation-error, #sylius_product_variant_channelPricings .sylius-validation-error', 'weight' => '#sylius_product_variant_weight', 'width' => '#sylius_product_variant_width', diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_details.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_details.html.twig index 63854cbb65..835dbd5e61 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_details.html.twig +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_details.html.twig @@ -34,31 +34,8 @@ {% if product.simple %}
-

{{ 'sylius.ui.pricing'|trans }}

- - {% for channelCode, channelPricing in form.variant.channelPricings %} - {% if loop.index0 == 0 %} -
- {% else %} -
- {% endif %} - - {% if channelCode not in product.channels|map(channel => channel.code) %} -
- {{ 'sylius.ui.product.product_not_active_in_channel'|trans }} -
- {% endif %} - {{ form_row(channelPricing, {'label': false}) }} -
- {% endfor %} +

{{ 'sylius.ui.pricing'|trans }}

+ {% include "@SyliusAdmin/Product/_channel_pricing.html.twig" with { product: product, variantForm: form.variant } only %}
{% endif %} diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig new file mode 100644 index 0000000000..6635784e07 --- /dev/null +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig @@ -0,0 +1,26 @@ +
+ + {% for channelCode, channelPricing in variantForm.channelPricings %} + {% if loop.index0 == 0 %} +
+ {% else %} +
+ {% endif %} + + {% if channelCode not in product.channels|map(channel => channel.code) %} +
+ {{ 'sylius.ui.product.product_not_active_in_channel'|trans }} +
+ {% endif %} + {{ form_row(channelPricing, {'label': false}) }} +
+ {% endfor %} +
\ No newline at end of file diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/ProductVariant/Tab/_details.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/ProductVariant/Tab/_details.html.twig index 1300d5da10..6f6167c67e 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/views/ProductVariant/Tab/_details.html.twig +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/ProductVariant/Tab/_details.html.twig @@ -12,7 +12,8 @@
{{ form_row(form.shippingCategory) }}
- {{ form_row(form.channelPricings) }} + {{form_label(form.channelPricings)}} + {% include "@SyliusAdmin/Product/_channel_pricing.html.twig" with { product: product_variant.product, variantForm: form } only %}
From 80661a577167fd707dbf4c33ee0b795a886cd78c Mon Sep 17 00:00:00 2001 From: mamazu Date: Mon, 1 Jun 2020 20:44:40 +0200 Subject: [PATCH 3/7] Fixing tests --- .../Behat/Page/Admin/Product/UpdateSimpleProductPage.php | 4 ++-- src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPage.php b/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPage.php index 8f65656357..522e53f0f8 100644 --- a/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPage.php +++ b/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPage.php @@ -411,8 +411,8 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd 'language_tab' => '[data-locale="%locale%"] .title', 'locale_tab' => '#attributesContainer .menu [data-tab="%localeCode%"]', 'name' => '#sylius_product_translations_%locale%_name', - 'original_price' => '#sylius_product_variant_channelPricings > .field:contains("%channelName%") input[name$="[originalPrice]"]', - 'price' => '#sylius_product_variant_channelPricings > .field:contains("%channelName%") input[name$="[price]"]', + 'original_price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[originalPrice]"]', + 'price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[price]"]', 'pricing_configuration' => '#sylius_calculator_container', 'main_taxon' => '#sylius_product_mainTaxon', 'shipping_required' => '#sylius_product_variant_shippingRequired', diff --git a/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php b/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php index c3b993b332..8c7e344308 100644 --- a/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php +++ b/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php @@ -112,8 +112,8 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface 'name' => '#sylius_product_variant_translations_%language%_name', 'on_hand' => '#sylius_product_variant_onHand', 'option_values' => '#sylius_product_variant_optionValues_%optionName%', - 'original_price' => '#sylius_product_variant_channelPricings > .field:contains("%channelName%") input[name$="[originalPrice]"]', - 'price' => '#sylius_product_variant_channelPricings > .field:contains("%channelName%") input[name$="[price]"]', + 'original_price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[originalPrice]"]', + 'price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[price]"]', 'pricing_configuration' => '#sylius_calculator_container', 'shipping_required' => '#sylius_product_variant_shippingRequired', 'show_product_dropdown' => '.scrolling.menu', From 4de3ba117de5b7b03840513aafd085fdf07376d0 Mon Sep 17 00:00:00 2001 From: mamazu Date: Tue, 2 Jun 2020 15:30:09 +0200 Subject: [PATCH 4/7] Adding label back in to fix behat tests --- .../Resources/views/Product/_channel_pricing.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig index 6635784e07..1197fb1a19 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig @@ -1,7 +1,7 @@
{% endfor %} -
\ No newline at end of file +
From fc34aca7ce356b25ddf6d3767d30afa76b3ac4c3 Mon Sep 17 00:00:00 2001 From: mamazu Date: Tue, 2 Jun 2020 16:37:34 +0200 Subject: [PATCH 5/7] Adding a transformer for channels --- .../Ui/Admin/ManagingProductVariantsContext.php | 9 +++++---- .../Behat/Page/Admin/ProductVariant/CreatePage.php | 13 +++++++------ .../Admin/ProductVariant/CreatePageInterface.php | 5 +++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php index c55fec6e48..05f509643e 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php @@ -22,6 +22,7 @@ use Sylius\Behat\Page\Admin\ProductVariant\UpdatePageInterface; use Sylius\Behat\Service\NotificationCheckerInterface; use Sylius\Behat\Service\Resolver\CurrentPageResolverInterface; use Sylius\Behat\Service\SharedStorageInterface; +use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Core\Model\ProductVariantInterface; use Webmozart\Assert\Assert; @@ -129,17 +130,17 @@ final class ManagingProductVariantsContext implements Context * @When /^I set its(?:| default) price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ * @When I do not set its price */ - public function iSetItsPriceTo(?string $price = null, $channelName = null) + public function iSetItsPriceTo(?string $price = null, ?ChannelInterface $channel = null) { - $this->createPage->specifyPrice($price ?? '', $channelName ?? (string) $this->sharedStorage->get('channel')); + $this->createPage->specifyPrice($price ?? '', $channel ?? $this->sharedStorage->get('channel')); } /** * @When /^I set its original price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ */ - public function iSetItsOriginalPriceTo($originalPrice, $channelName) + public function iSetItsOriginalPriceTo($originalPrice, ChannelInterface $channel) { - $this->createPage->specifyOriginalPrice($originalPrice, $channelName); + $this->createPage->specifyOriginalPrice($originalPrice, $channel); } /** diff --git a/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePage.php b/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePage.php index 1b9149bf19..4a6dca7a50 100644 --- a/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePage.php +++ b/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePage.php @@ -16,19 +16,20 @@ namespace Sylius\Behat\Page\Admin\ProductVariant; use Behat\Mink\Exception\ElementNotFoundException; use Sylius\Behat\Behaviour\SpecifiesItsCode; use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage; +use Sylius\Component\Core\Model\ChannelInterface; class CreatePage extends BaseCreatePage implements CreatePageInterface { use SpecifiesItsCode; - public function specifyPrice(string $price, string $channelName): void + public function specifyPrice(string $price, ChannelInterface $channel): void { - $this->getElement('price', ['%channelName%' => $channelName])->setValue($price); + $this->getElement('price', ['%channelCode%' => $channel->getCode()])->setValue($price); } - public function specifyOriginalPrice(string $originalPrice, string $channelName): void + public function specifyOriginalPrice(string $originalPrice, ChannelInterface $channel): void { - $this->getElement('original_price', ['%channelName%' => $channelName])->setValue($originalPrice); + $this->getElement('original_price', ['%channelCode%' => $channel->getCode()])->setValue($originalPrice); } public function specifyCurrentStock(string $currentStock): void @@ -110,8 +111,8 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface 'price_calculator' => '#sylius_product_variant_pricingCalculator', 'shipping_category' => '#sylius_product_variant_shippingCategory', 'shipping_required' => '#sylius_product_variant_shippingRequired', - 'original_price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[originalPrice]"]', - 'price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[price]"]', + 'original_price' => '#sylius_product_variant_channelPricings input[name$="[originalPrice]"][id*="%channelCode%"]', + 'price' => '#sylius_product_variant_channelPricings input[id*="%channelCode%"]', 'prices_validation_message' => '#sylius_product_variant_channelPricings ~ .sylius-validation-error, #sylius_product_variant_channelPricings .sylius-validation-error', 'weight' => '#sylius_product_variant_weight', 'width' => '#sylius_product_variant_width', diff --git a/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePageInterface.php b/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePageInterface.php index 1aa3fd23fd..e6dfa09b24 100644 --- a/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePageInterface.php +++ b/src/Sylius/Behat/Page/Admin/ProductVariant/CreatePageInterface.php @@ -14,12 +14,13 @@ declare(strict_types=1); namespace Sylius\Behat\Page\Admin\ProductVariant; use Sylius\Behat\Page\Admin\Crud\CreatePageInterface as BaseCreatePageInterface; +use Sylius\Component\Core\Model\ChannelInterface; interface CreatePageInterface extends BaseCreatePageInterface { - public function specifyPrice(string $price, string $channelName): void; + public function specifyPrice(string $price, ChannelInterface $channelName): void; - public function specifyOriginalPrice(string $originalPrice, string $channelName): void; + public function specifyOriginalPrice(string $originalPrice, ChannelInterface $channelName): void; public function specifyHeightWidthDepthAndWeight(string $height, string $width, string $depth, string $weight): void; From a5e37128b7a8c31ddca45b11b6cc6ebef68e3931 Mon Sep 17 00:00:00 2001 From: mamazu Date: Tue, 2 Jun 2020 16:41:14 +0200 Subject: [PATCH 6/7] Update src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Łukasz Chruściel --- .../Behat/Context/Ui/Admin/ManagingProductVariantsContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php index 05f509643e..21fe8827f7 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php @@ -136,7 +136,7 @@ final class ManagingProductVariantsContext implements Context } /** - * @When /^I set its original price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ + * @When /^I set its original price to "(?:€|£|\$)([^"]+)" for ("([^"]+)" channel)$/ */ public function iSetItsOriginalPriceTo($originalPrice, ChannelInterface $channel) { From 0df50ab725210e95d91cd59fe7465ef92bf36cfa Mon Sep 17 00:00:00 2001 From: mamazu Date: Tue, 2 Jun 2020 18:15:10 +0200 Subject: [PATCH 7/7] Fixing the tests --- ...oduct_price_after_channel_deletion.feature | 2 +- .../Admin/ManagingProductVariantsContext.php | 26 ++++----- .../Ui/Admin/ManagingProductsContext.php | 53 +++++++++---------- .../Admin/Product/CreateSimpleProductPage.php | 20 ++++--- .../CreateSimpleProductPageInterface.php | 7 ++- .../Admin/Product/UpdateSimpleProductPage.php | 26 +++++---- .../UpdateSimpleProductPageInterface.php | 10 ++-- .../Admin/ProductVariant/GeneratePage.php | 7 +-- .../ProductVariant/GeneratePageInterface.php | 3 +- .../Page/Admin/ProductVariant/UpdatePage.php | 12 ++--- .../ProductVariant/UpdatePageInterface.php | 4 +- .../views/Product/_channel_pricing.html.twig | 1 + 12 files changed, 94 insertions(+), 77 deletions(-) diff --git a/features/product/managing_products/removing_product_price_after_channel_deletion.feature b/features/product/managing_products/removing_product_price_after_channel_deletion.feature index cdca459075..88fbe4771e 100644 --- a/features/product/managing_products/removing_product_price_after_channel_deletion.feature +++ b/features/product/managing_products/removing_product_price_after_channel_deletion.feature @@ -3,7 +3,7 @@ Feature: Removing a product's price after channel deletion In order to have product's prices specified only for existing channels As an Administrator I want to have product's price removed after corresponding channel deletion - + Background: Given the store has currency "USD" And the store operates on a channel named "Web-US" in "USD" currency diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php index 21fe8827f7..f4abbdb381 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductVariantsContext.php @@ -127,7 +127,7 @@ final class ManagingProductVariantsContext implements Context } /** - * @When /^I set its(?:| default) price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ + * @When /^I set its(?:| default) price to "(?:€|£|\$)([^"]+)" for ("([^"]+)" channel)$/ * @When I do not set its price */ public function iSetItsPriceTo(?string $price = null, ?ChannelInterface $channel = null) @@ -216,13 +216,13 @@ final class ManagingProductVariantsContext implements Context } /** - * @Then /^the (variant with code "[^"]+") should be priced at (?:€|£|\$)([^"]+) for channel "([^"]+)"$/ + * @Then /^the (variant with code "[^"]+") should be priced at (?:€|£|\$)([^"]+) for (channel "([^"]+)")$/ */ - public function theVariantWithCodeShouldBePricedAtForChannel(ProductVariantInterface $productVariant, string $price, $channelName) + public function theVariantWithCodeShouldBePricedAtForChannel(ProductVariantInterface $productVariant, string $price, ChannelInterface $channel) { $this->updatePage->open(['id' => $productVariant->getId(), 'productId' => $productVariant->getProduct()->getId()]); - Assert::same($this->updatePage->getPriceForChannel($channelName), $price); + Assert::same($this->updatePage->getPriceForChannel($channel), $price); } /** @@ -236,14 +236,14 @@ final class ManagingProductVariantsContext implements Context } /** - * @Then /^the (variant with code "[^"]+") should have an original price of (?:€|£|\$)([^"]+) for channel "([^"]+)"$/ + * @Then /^the (variant with code "[^"]+") should have an original price of (?:€|£|\$)([^"]+) for (channel "([^"]+)")$/ */ - public function theVariantWithCodeShouldHaveAnOriginalPriceOfForChannel(ProductVariantInterface $productVariant, $originalPrice, $channelName) + public function theVariantWithCodeShouldHaveAnOriginalPriceOfForChannel(ProductVariantInterface $productVariant, $originalPrice, ChannelInterface $channel) { $this->updatePage->open(['id' => $productVariant->getId(), 'productId' => $productVariant->getProduct()->getId()]); Assert::same( - $this->updatePage->getOriginalPriceForChannel($channelName), + $this->updatePage->getOriginalPriceForChannel($channel), $originalPrice ); } @@ -442,12 +442,12 @@ final class ManagingProductVariantsContext implements Context } /** - * @When /^I specify that the (\d)(?:st|nd|rd|th) variant is identified by "([^"]+)" code and costs "(?:€|£|\$)([^"]+)" in ("[^"]+") channel$/ + * @When /^I specify that the (\d)(?:st|nd|rd|th) variant is identified by "([^"]+)" code and costs "(?:€|£|\$)([^"]+)" in (("[^"]+") channel)$/ */ - public function iSpecifyThereAreVariantsIdentifiedByCodeWithCost($nthVariant, $code, int $price, $channelName) + public function iSpecifyThereAreVariantsIdentifiedByCodeWithCost($nthVariant, $code, int $price, ChannelInterface $channel) { $this->generatePage->specifyCode($nthVariant - 1, $code); - $this->generatePage->specifyPrice($nthVariant - 1, $price, $channelName); + $this->generatePage->specifyPrice($nthVariant - 1, $price, $channel); } /** @@ -459,11 +459,11 @@ final class ManagingProductVariantsContext implements Context } /** - * @When /^I specify that the (\d)(?:st|nd|rd|th) variant costs "(?:€|£|\$)([^"]+)" in ("[^"]+") channel$/ + * @When /^I specify that the (\d)(?:st|nd|rd|th) variant costs "(?:€|£|\$)([^"]+)" in (("[^"]+") channel)$/ */ - public function iSpecifyThereAreVariantsWithCost($nthVariant, int $price, $channelName) + public function iSpecifyThereAreVariantsWithCost($nthVariant, int $price, ChannelInterface $channel) { - $this->generatePage->specifyPrice($nthVariant - 1, $price, $channelName); + $this->generatePage->specifyPrice($nthVariant - 1, $price, $channel); } /** diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductsContext.php index e9e4acde4c..eb4a6f1c43 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductsContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductsContext.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Sylius\Behat\Context\Ui\Admin; use Behat\Behat\Context\Context; -use Behat\Mink\Exception\ElementNotFoundException; use Sylius\Behat\NotificationType; use Sylius\Behat\Page\Admin\Crud\CreatePageInterface; use Sylius\Behat\Page\Admin\Crud\UpdatePageInterface; @@ -178,19 +177,19 @@ final class ManagingProductsContext implements Context } /** - * @When /^I set its(?:| default) price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ + * @When /^I set its(?:| default) price to "(?:€|£|\$)([^"]+)" for ("([^"]+)" channel)$/ */ - public function iSetItsPriceTo(string $price, string $channelName) + public function iSetItsPriceTo(string $price, ChannelInterface $channel) { - $this->createSimpleProductPage->specifyPrice($channelName, $price); + $this->createSimpleProductPage->specifyPrice($channel, $price); } /** - * @When /^I set its original price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ + * @When /^I set its original price to "(?:€|£|\$)([^"]+)" for ("([^"]+)" channel)$/ */ - public function iSetItsOriginalPriceTo(int $originalPrice, $channelName) + public function iSetItsOriginalPriceTo(int $originalPrice, ChannelInterface $channel) { - $this->createSimpleProductPage->specifyOriginalPrice($channelName, $originalPrice); + $this->createSimpleProductPage->specifyOriginalPrice($channel, $originalPrice); } /** @@ -487,19 +486,19 @@ final class ManagingProductsContext implements Context } /** - * @When /^I change its price to (?:€|£|\$)([^"]+) for "([^"]+)" channel$/ + * @When /^I change its price to (?:€|£|\$)([^"]+) for ("([^"]+)" channel)$/ */ - public function iChangeItsPriceTo(string $price, $channelName) + public function iChangeItsPriceTo(string $price, ChannelInterface $channel) { - $this->updateSimpleProductPage->specifyPrice($channelName, $price); + $this->updateSimpleProductPage->specifyPrice($channel, $price); } /** - * @When /^I change its original price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ + * @When /^I change its original price to "(?:€|£|\$)([^"]+)" for ("([^"]+)" channel)$/ */ - public function iChangeItsOriginalPriceTo(string $price, $channelName) + public function iChangeItsOriginalPriceTo(string $price, ChannelInterface $channel) { - $this->updateSimpleProductPage->specifyOriginalPrice($channelName, $price); + $this->updateSimpleProductPage->specifyOriginalPrice($channel, $price); } /** @@ -885,7 +884,10 @@ final class ManagingProductsContext implements Context */ public function iShouldBeNotifiedThatPriceMustBeDefinedForEveryChannel() { - $this->assertValidationMessage('channel_pricings', 'You must define price for every channel.'); + Assert::same( + $this->createSimpleProductPage->getChannelPricingValidationMessage(), + 'You must define price for every channel.' + ); } /** @@ -929,25 +931,25 @@ final class ManagingProductsContext implements Context } /** - * @Then /^(it|this product) should be priced at (?:€|£|\$)([^"]+) for channel "([^"]+)"$/ - * @Then /^(product "[^"]+") should be priced at (?:€|£|\$)([^"]+) for channel "([^"]+)"$/ + * @Then /^(it|this product) should be priced at (?:€|£|\$)([^"]+) for (channel "([^"]+)")$/ + * @Then /^(product "[^"]+") should be priced at (?:€|£|\$)([^"]+) for (channel "([^"]+)")$/ */ - public function itShouldBePricedAtForChannel(ProductInterface $product, string $price, $channelName) + public function itShouldBePricedAtForChannel(ProductInterface $product, string $price, ChannelInterface $channel) { $this->updateSimpleProductPage->open(['id' => $product->getId()]); - Assert::same($this->updateSimpleProductPage->getPriceForChannel($channelName), $price); + Assert::same($this->updateSimpleProductPage->getPriceForChannel($channel), $price); } /** - * @Then /^(its|this products) original price should be "(?:€|£|\$)([^"]+)" for channel "([^"]+)"$/ + * @Then /^(its|this products) original price should be "(?:€|£|\$)([^"]+)" for (channel "([^"]+)")$/ */ - public function itsOriginalPriceForChannel(ProductInterface $product, $originalPrice, $channelName) + public function itsOriginalPriceForChannel(ProductInterface $product, string $originalPrice, ChannelInterface $channel) { $this->updateSimpleProductPage->open(['id' => $product->getId()]); Assert::same( - $this->updateSimpleProductPage->getOriginalPriceForChannel($channelName), + $this->updateSimpleProductPage->getOriginalPriceForChannel($channel), $originalPrice ); } @@ -959,13 +961,8 @@ final class ManagingProductsContext implements Context { $this->updateSimpleProductPage->open(['id' => $product->getId()]); - try { - $this->updateSimpleProductPage->getPriceForChannel($channelName); - } catch (ElementNotFoundException $exception) { - return; - } - - throw new \Exception( + Assert::true( + $this->updateSimpleProductPage->hasNoPriceForChannel($channelName), sprintf('Product "%s" should not have price defined for channel "%s".', $product->getName(), $channelName) ); } diff --git a/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php b/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php index fedd128863..b761d881f9 100644 --- a/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php +++ b/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php @@ -20,6 +20,7 @@ use Sylius\Behat\Behaviour\SpecifiesItsCode; use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage; use Sylius\Behat\Service\AutocompleteHelper; use Sylius\Behat\Service\SlugGenerationHelper; +use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\TaxonInterface; use Sylius\Component\Product\Model\ProductAssociationTypeInterface; use WebDriver\Exception; @@ -55,14 +56,14 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd $this->getElement('slug', ['%locale%' => $locale])->setValue($slug); } - public function specifyPrice(string $channelName, string $price): void + public function specifyPrice(ChannelInterface $channel, string $price): void { - $this->getElement('price', ['%channelName%' => $channelName])->setValue($price); + $this->getElement('price', ['%channelCode%' => $channel->getCode()])->setValue($price); } - public function specifyOriginalPrice(string $channelName, int $originalPrice): void + public function specifyOriginalPrice(ChannelInterface $channel, int $originalPrice): void { - $this->getElement('original_price', ['%channelName%' => $channelName])->setValue($originalPrice); + $this->getElement('original_price', ['%channelCode%' => $channel->getCode()])->setValue($originalPrice); } public function addAttribute(string $attributeName, string $value, string $localeCode): void @@ -208,6 +209,11 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd $this->getElement('shipping_required')->uncheck(); } + public function getChannelPricingValidationMessage(): string + { + return $this->getElement('prices_validation_message')->getText(); + } + protected function getElement(string $name, array $parameters = []): NodeElement { if (!isset($parameters['%locale%'])) { @@ -228,7 +234,6 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd 'attribute_value' => '.tab[data-tab="%localeCode%"] .attribute .label:contains("%attributeName%") ~ input', 'attributes_choice' => '#sylius_product_attribute_choice', 'channel_checkbox' => '.checkbox:contains("%channelName%") input', - 'channel_pricings' => '#sylius_product_variant_channelPricings', 'code' => '#sylius_product_code', 'form' => 'form[name="sylius_product"]', 'images' => '#sylius_product_images', @@ -236,8 +241,9 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd 'locale_tab' => '#attributesContainer .menu [data-tab="%localeCode%"]', 'main_taxon' => '#sylius_product_mainTaxon', 'name' => '#sylius_product_translations_%locale%_name', - 'price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[price]"]', - 'original_price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[originalPrice]"]', + 'original_price' => '#sylius_product_variant_channelPricings input[name$="[originalPrice]"][id*="%channelCode%"]', + 'price' => '#sylius_product_variant_channelPricings input[id*="%channelCode%"]', + 'prices_validation_message' => '#sylius_product_variant_channelPricings ~ .sylius-validation-error, #sylius_product_variant_channelPricings .sylius-validation-error', 'price_calculator' => '#sylius_product_variant_pricingCalculator', 'shipping_category' => '#sylius_product_variant_shippingCategory', 'shipping_required' => '#sylius_product_variant_shippingRequired', diff --git a/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPageInterface.php b/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPageInterface.php index 9188bcad42..63c18a9b8e 100644 --- a/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPageInterface.php +++ b/src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPageInterface.php @@ -14,14 +14,15 @@ declare(strict_types=1); namespace Sylius\Behat\Page\Admin\Product; use Sylius\Behat\Page\Admin\Crud\CreatePageInterface as BaseCreatePageInterface; +use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\TaxonInterface; use Sylius\Component\Product\Model\ProductAssociationTypeInterface; interface CreateSimpleProductPageInterface extends BaseCreatePageInterface { - public function specifyPrice(string $channelName, string $price): void; + public function specifyPrice(ChannelInterface $channel, string $price): void; - public function specifyOriginalPrice(string $channelName, int $originalPrice): void; + public function specifyOriginalPrice(ChannelInterface $channel, int $originalPrice): void; public function choosePricingCalculator(string $name): void; @@ -57,4 +58,6 @@ interface CreateSimpleProductPageInterface extends BaseCreatePageInterface public function selectShippingCategory(string $shippingCategoryName): void; public function setShippingRequired(bool $isShippingRequired): void; + + public function getChannelPricingValidationMessage(): string; } diff --git a/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPage.php b/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPage.php index 522e53f0f8..0b7bfbe44b 100644 --- a/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPage.php +++ b/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPage.php @@ -46,14 +46,14 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd } } - public function specifyPrice(string $channelName, string $price): void + public function specifyPrice(ChannelInterface $channel, string $price): void { - $this->getElement('price', ['%channelName%' => $channelName])->setValue($price); + $this->getElement('price', ['%channelCode%' => $channel->getCode()])->setValue($price); } - public function specifyOriginalPrice(string $channelName, string $originalPrice): void + public function specifyOriginalPrice(ChannelInterface $channel, string $originalPrice): void { - $this->getElement('original_price', ['%channelName%' => $channelName])->setValue($originalPrice); + $this->getElement('original_price', ['%channelCode%' => $channel->getCode()])->setValue($originalPrice); } public function addSelectedAttributes(): void @@ -318,14 +318,14 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd } } - public function getPriceForChannel(string $channelName): string + public function getPriceForChannel(ChannelInterface $channel): string { - return $this->getElement('price', ['%channelName%' => $channelName])->getValue(); + return $this->getElement('price', ['%channelCode%' => $channel->getCode()])->getValue(); } - public function getOriginalPriceForChannel(string $channelName): string + public function getOriginalPriceForChannel(ChannelInterface $channel): string { - return $this->getElement('original_price', ['%channelName%' => $channelName])->getValue(); + return $this->getElement('original_price', ['%channelCode%' => $channel->getCode()])->getValue(); } public function isShippingRequired(): bool @@ -383,6 +383,11 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd $this->getElement('enabled')->check(); } + public function hasNoPriceForChannel(string $channelName): bool + { + return strpos($this->getElement('prices')->getHtml(), $channelName) === false; + } + protected function getCodeElement(): NodeElement { return $this->getElement('code'); @@ -411,8 +416,9 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd 'language_tab' => '[data-locale="%locale%"] .title', 'locale_tab' => '#attributesContainer .menu [data-tab="%localeCode%"]', 'name' => '#sylius_product_translations_%locale%_name', - 'original_price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[originalPrice]"]', - 'price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[price]"]', + 'prices' => '#sylius_product_variant_channelPricings', + 'original_price' => '#sylius_product_variant_channelPricings input[name$="[originalPrice]"][id*="%channelCode%"]', + 'price' => '#sylius_product_variant_channelPricings input[id*="%channelCode%"]', 'pricing_configuration' => '#sylius_calculator_container', 'main_taxon' => '#sylius_product_mainTaxon', 'shipping_required' => '#sylius_product_variant_shippingRequired', diff --git a/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPageInterface.php b/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPageInterface.php index 2e3f3c14ae..0bb64dc4d5 100644 --- a/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPageInterface.php +++ b/src/Sylius/Behat/Page/Admin/Product/UpdateSimpleProductPageInterface.php @@ -25,9 +25,9 @@ interface UpdateSimpleProductPageInterface extends BaseUpdatePageInterface public function isSlugReadonlyIn(string $locale): bool; - public function specifyPrice(string $channelName, string $price): void; + public function specifyPrice(ChannelInterface $channel, string $price): void; - public function specifyOriginalPrice(string $channelName, string $originalPrice): void; + public function specifyOriginalPrice(ChannelInterface $channel, string $originalPrice): void; public function nameItIn(string $name, string $localeCode): void; @@ -89,9 +89,9 @@ interface UpdateSimpleProductPageInterface extends BaseUpdatePageInterface public function specifySlugIn(string $slug, string $locale): void; - public function getPriceForChannel(string $channelName): string; + public function getPriceForChannel(ChannelInterface $channel): string; - public function getOriginalPriceForChannel(string $channelName): string; + public function getOriginalPriceForChannel(ChannelInterface $channel): string; public function isShippingRequired(): bool; @@ -114,4 +114,6 @@ interface UpdateSimpleProductPageInterface extends BaseUpdatePageInterface public function isEnabled(): bool; public function enable(): void; + + public function hasNoPriceForChannel(string $channelName): bool; } diff --git a/src/Sylius/Behat/Page/Admin/ProductVariant/GeneratePage.php b/src/Sylius/Behat/Page/Admin/ProductVariant/GeneratePage.php index a70f5d6bea..a63ac7a76a 100644 --- a/src/Sylius/Behat/Page/Admin/ProductVariant/GeneratePage.php +++ b/src/Sylius/Behat/Page/Admin/ProductVariant/GeneratePage.php @@ -16,6 +16,7 @@ namespace Sylius\Behat\Page\Admin\ProductVariant; use Behat\Mink\Element\NodeElement; use Behat\Mink\Exception\ElementNotFoundException; use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage; +use Sylius\Component\Core\Model\ChannelInterface; class GeneratePage extends SymfonyPage implements GeneratePageInterface { @@ -24,9 +25,9 @@ class GeneratePage extends SymfonyPage implements GeneratePageInterface $this->getDocument()->pressButton('Generate'); } - public function specifyPrice(int $nth, int $price, string $channelName): void + public function specifyPrice(int $nth, int $price, ChannelInterface $channel): void { - $this->getElement('price', ['%position%' => $nth, '%channelName%' => $channelName])->setValue($price); + $this->getElement('price', ['%position%' => $nth, '%channelCode%' => $channel->getCode()])->setValue($price); } public function specifyCode(int $nth, string $code): void @@ -66,7 +67,7 @@ class GeneratePage extends SymfonyPage implements GeneratePageInterface { return array_merge(parent::getDefinedElements(), [ 'code' => '#sylius_product_generate_variants_variants_%position%_code', - 'price' => '#sylius_product_generate_variants_variants_%position%_channelPricings > .field:contains("%channelName%") input', + 'price' => '#sylius_product_generate_variants_variants_%position%_channelPricings input[id*="%channelCode%"]', 'prices_validation_message' => '#sylius_product_generate_variants_variants_%position%_channelPricings ~ .sylius-validation-error', ]); } diff --git a/src/Sylius/Behat/Page/Admin/ProductVariant/GeneratePageInterface.php b/src/Sylius/Behat/Page/Admin/ProductVariant/GeneratePageInterface.php index 60a4ca49c4..fc0d770d03 100644 --- a/src/Sylius/Behat/Page/Admin/ProductVariant/GeneratePageInterface.php +++ b/src/Sylius/Behat/Page/Admin/ProductVariant/GeneratePageInterface.php @@ -14,12 +14,13 @@ declare(strict_types=1); namespace Sylius\Behat\Page\Admin\ProductVariant; use FriendsOfBehat\PageObjectExtension\Page\SymfonyPageInterface; +use Sylius\Component\Core\Model\ChannelInterface; interface GeneratePageInterface extends SymfonyPageInterface { public function generate(): void; - public function specifyPrice(int $nth, int $price, string $channelName): void; + public function specifyPrice(int $nth, int $price, ChannelInterface $channel): void; public function specifyCode(int $nth, string $code): void; diff --git a/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php b/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php index 8c7e344308..83cd5813be 100644 --- a/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php +++ b/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePage.php @@ -55,14 +55,14 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface return $priceElement->find('css', 'input')->getValue(); } - public function getPriceForChannel(string $channelName): string + public function getPriceForChannel(ChannelInterface $channel): string { - return $this->getElement('price', ['%channelName%' => $channelName])->getValue(); + return $this->getElement('price', ['%channelCode%' => $channel->getCode()])->getValue(); } - public function getOriginalPriceForChannel(string $channelName): string + public function getOriginalPriceForChannel(ChannelInterface $channel): string { - return $this->getElement('original_price', ['%channelName%' => $channelName])->getValue(); + return $this->getElement('original_price', ['%channelCode%' => $channel->getCode()])->getValue(); } public function getNameInLanguage(string $language): string @@ -112,8 +112,8 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface 'name' => '#sylius_product_variant_translations_%language%_name', 'on_hand' => '#sylius_product_variant_onHand', 'option_values' => '#sylius_product_variant_optionValues_%optionName%', - 'original_price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[originalPrice]"]', - 'price' => '#sylius_product_variant_channelPricings .field:contains("%channelName%") input[name$="[price]"]', + 'original_price' => '#sylius_product_variant_channelPricings input[name$="[originalPrice]"][id*="%channelCode%"]', + 'price' => '#sylius_product_variant_channelPricings input[id*="%channelCode%"]', 'pricing_configuration' => '#sylius_calculator_container', 'shipping_required' => '#sylius_product_variant_shippingRequired', 'show_product_dropdown' => '.scrolling.menu', diff --git a/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePageInterface.php b/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePageInterface.php index 3a5959d96c..c7e903d365 100644 --- a/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePageInterface.php +++ b/src/Sylius/Behat/Page/Admin/ProductVariant/UpdatePageInterface.php @@ -33,9 +33,9 @@ interface UpdatePageInterface extends BaseUpdatePageInterface public function getPricingConfigurationForChannelAndCurrencyCalculator(ChannelInterface $channel, CurrencyInterface $currency): string; - public function getPriceForChannel(string $channelName): string; + public function getPriceForChannel(ChannelInterface $channel): string; - public function getOriginalPriceForChannel(string $channelName): string; + public function getOriginalPriceForChannel(ChannelInterface $channel): string; public function getNameInLanguage(string $language): string; diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig index 1197fb1a19..6d4014a50e 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/Product/_channel_pricing.html.twig @@ -1,4 +1,5 @@
+ {{ form_errors(variantForm.channelPricings) }}