diff --git a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php index a940e09bd57b56a026bba1a45312b94b7f1c80e3..c144daf8c71bd3dc035338af0283df31009e0126 100644 --- a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php +++ b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php @@ -29,18 +29,8 @@ class FinalPriceBox extends BasePriceBox } $result = parent::_toHtml(); - - try { - /** @var MsrpPrice $msrpPriceType */ - $msrpPriceType = $this->getSaleableItem()->getPriceInfo()->getPrice('msrp_price'); - } catch (\InvalidArgumentException $e) { - $this->_logger->critical($e); - return $this->wrapResult($result); - } - //Renders MSRP in case it is enabled - $product = $this->getSaleableItem(); - if ($msrpPriceType->canApplyMsrp($product) && $msrpPriceType->isMinimalPriceLessMsrp($product)) { + if ($this->isMsrpPriceApplicable()) { /** @var BasePriceBox $msrpBlock */ $msrpBlock = $this->rendererPool->createPriceRender( MsrpPrice::PRICE_CODE, @@ -56,6 +46,25 @@ class FinalPriceBox extends BasePriceBox return $this->wrapResult($result); } + /** + * Check is MSRP applicable for the current product. + * + * @return bool + */ + protected function isMsrpPriceApplicable() + { + try { + /** @var MsrpPrice $msrpPriceType */ + $msrpPriceType = $this->getSaleableItem()->getPriceInfo()->getPrice('msrp_price'); + } catch (\InvalidArgumentException $e) { + $this->_logger->critical($e); + return false; + } + + $product = $this->getSaleableItem(); + return $msrpPriceType->canApplyMsrp($product) && $msrpPriceType->isMinimalPriceLessMsrp($product); + } + /** * Wrap with standard required container * diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index 51c68145b24cf5e72061a51647d4b311f39e60bf..a5f85df1c96f66bb911bf92303c40d14c3be49b6 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -193,6 +193,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView $config = [ 'attributes' => $attributesData['attributes'], 'template' => str_replace('%s', '<%- data.price %>', $store->getCurrentCurrency()->getOutputFormat()), + 'currencyFormat' => $store->getCurrentCurrency()->getOutputFormat(), 'optionPrices' => $this->getOptionPrices(), 'prices' => [ 'oldPrice' => [ @@ -229,7 +230,17 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView { $prices = []; foreach ($this->getAllowProducts() as $product) { + $tierPrices = []; $priceInfo = $product->getPriceInfo(); + $tierPriceModel = $priceInfo->getPrice('tier_price'); + $tierPricesList = $tierPriceModel->getTierPriceList(); + foreach ($tierPricesList as $tierPrice) { + $tierPrices[] = [ + 'qty' => $this->_registerJsPrice($tierPrice['price_qty']), + 'price' => $this->_registerJsPrice($tierPrice['price']->getValue()), + 'percentage' => $this->_registerJsPrice($tierPriceModel->getSavePercent($tierPrice['price'])), + ]; + } $prices[$product->getId()] = [ @@ -247,8 +258,9 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView 'amount' => $this->_registerJsPrice( $priceInfo->getPrice('final_price')->getAmount()->getValue() ), - ] - ]; + ], + 'tierPrices' => $tierPrices, + ]; } return $prices; } @@ -263,4 +275,14 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView { return str_replace(',', '.', $price); } + + /** + * Should we generate "As low as" block or not + * + * @return bool + */ + public function showMinimalPrice() + { + return true; + } } diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Render/TierPriceBox.php b/app/code/Magento/ConfigurableProduct/Pricing/Render/TierPriceBox.php new file mode 100644 index 0000000000000000000000000000000000000000..af2414204fd1a3aea6acecceb34f28c613f3c6dc --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Pricing/Render/TierPriceBox.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\ConfigurableProduct\Pricing\Render; + +/** + * Responsible for displaying tier price box on configurable product page. + * + * @package Magento\ConfigurableProduct\Pricing\Render + */ +class TierPriceBox extends FinalPriceBox +{ + /** + * @inheritdoc + */ + public function toHtml() + { + // Hide tier price block in case of MSRP. + if (!$this->isMsrpPriceApplicable()) { + return parent::toHtml(); + } + } +} diff --git a/app/code/Magento/ConfigurableProduct/view/base/layout/catalog_product_prices.xml b/app/code/Magento/ConfigurableProduct/view/base/layout/catalog_product_prices.xml index 47fe31681b5bf0d96ba4cf4935283d415de23ce7..545b04dc0a3279c92100166bda0ff3922b820bb9 100644 --- a/app/code/Magento/ConfigurableProduct/view/base/layout/catalog_product_prices.xml +++ b/app/code/Magento/ConfigurableProduct/view/base/layout/catalog_product_prices.xml @@ -10,6 +10,10 @@ <arguments> <argument name="configurable" xsi:type="array"> <item name="prices" xsi:type="array"> + <item name="tier_price" xsi:type="array"> + <item name="render_class" xsi:type="string">Magento\ConfigurableProduct\Pricing\Render\TierPriceBox</item> + <item name="render_template" xsi:type="string">Magento_ConfigurableProduct::product/price/tier_price.phtml</item> + </item> <item name="final_price" xsi:type="array"> <item name="render_class" xsi:type="string">Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox</item> <item name="render_template" xsi:type="string">Magento_ConfigurableProduct::product/price/final_price.phtml</item> diff --git a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml new file mode 100644 index 0000000000000000000000000000000000000000..01e6bb4222fd3cf6b178a350b0a3c0667c0263ca --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +?> +<script type="text/x-magento-template" id="tier-prices-template"> + <ul class="prices-tier items"> + <% _.each(tierPrices, function(item, key) { %> + <% var priceStr = '<span class="price-container price-tier_price">' + + '<span data-price-amount="' + priceUtils.formatPrice(item.price, currencyFormat) + '"' + + ' data-price-type=""' + ' class="price-wrapper ">' + + '<span class="price">' + priceUtils.formatPrice(item.price, currencyFormat) + '</span>' + + '</span>' + + '</span>'; %> + <li class="item"> + <%= $t('Buy %1 for %2 each and').replace('%1', item.qty).replace('%2', priceStr) %> + <strong class="benefit"> + <%= $t('save') %><span class="percent tier-<%= key %>"> <%= item.percentage %></span>% + </strong> + </li> + <% }); %> + </ul> +</script> +<div data-role="tier-price-block"></div> diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js index 59b313bcb497ddb64e1fdca9bc480afdbbb2f1d9..0c7157f920d9c5f97ec6429fea11bc2aa0af9403 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js @@ -7,11 +7,12 @@ define([ 'jquery', 'underscore', 'mage/template', + 'mage/translate', 'priceUtils', 'priceBox', 'jquery/ui', 'jquery/jquery.parsequery' -], function ($, _, mageTemplate) { +], function ($, _, mageTemplate, $t, priceUtils) { 'use strict'; $.widget('mage.configurable', { @@ -38,7 +39,10 @@ define([ * * @type {String} */ - gallerySwitchStrategy: 'replace' + gallerySwitchStrategy: 'replace', + tierPriceTemplateSelector: '#tier-prices-template', + tierPriceBlockSelector: '[data-role="tier-price-block"]', + tierPriceTemplate: '' }, /** @@ -84,6 +88,7 @@ define([ options.priceFormat = priceBoxOptions.priceFormat; } options.optionTemplate = mageTemplate(options.optionTemplate); + options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html(); options.settings = options.spConfig.containerId ? $(options.spConfig.containerId).find(options.superSelector) : @@ -259,6 +264,7 @@ define([ } this._reloadPrice(); this._displayRegularPriceBlock(this.simpleProduct); + this._displayTierPriceBlock(this.simpleProduct); this._changeProductImage(); }, @@ -513,6 +519,31 @@ define([ var galleryObject = element.data('gallery'); this.options.mediaGalleryInitial = galleryObject.returnCurrentImages(); + }, + + /** + * Show or hide tier price block + * + * @param {*} optionId + * @private + */ + _displayTierPriceBlock: function (optionId) { + if (typeof optionId != 'undefined' && + this.options.spConfig.optionPrices[optionId].tierPrices != [] + ) { + var options = this.options.spConfig.optionPrices[optionId]; + if (this.options.tierPriceTemplate) { + var tierPriceHtml = mageTemplate(this.options.tierPriceTemplate, { + 'tierPrices': options.tierPrices, + '$t': $t, + 'currencyFormat': this.options.spConfig.currencyFormat, + 'priceUtils': priceUtils + }); + $(this.options.tierPriceBlockSelector).html(tierPriceHtml).show(); + } + } else { + $(this.options.tierPriceBlockSelector).hide(); + } } }); diff --git a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js index 8af48829df438261aaed469c88245fc50a349853..c1d2fd3f910518ddcf15ae50122db3e5f30cd098 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js @@ -6,11 +6,14 @@ define([ 'jquery', 'underscore', + 'mage/template', 'mage/smart-keyboard-handler', + 'mage/translate', + 'priceUtils', 'jquery/ui', 'jquery/jquery.parsequery', 'mage/validation/validation' -], function ($, _, keyboardHandler) { +], function ($, _, mageTemplate, keyboardHandler, $t, priceUtils) { 'use strict'; /** @@ -254,7 +257,13 @@ define([ gallerySwitchStrategy: 'replace', // whether swatches are rendered in product list or on product page - inProductList: false + inProductList: false, + + // tier prise selectors start + tierPriceTemplateSelector: '#tier-prices-template', + tierPriceBlockSelector: '[data-role="tier-price-block"]', + tierPriceTemplate: '' + // tier prise selectors end }, /** @@ -279,6 +288,7 @@ define([ } else { console.log('SwatchRenderer: No input data received'); } + this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html(); }, /** @@ -809,7 +819,8 @@ define([ $product = $widget.element.parents($widget.options.selectorProduct), $productPrice = $product.find(this.options.selectorProductPrice), options = _.object(_.keys($widget.optionsMap), {}), - result; + result, + tierPriceHtml; $widget.element.find('.' + $widget.options.classes.attributeClass + '[option-selected]').each(function () { var attributeId = $(this).attr('attribute-id'); @@ -825,6 +836,23 @@ define([ 'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices) } ); + + if (result.tierPrices.length) { + if (this.options.tierPriceTemplate) { + tierPriceHtml = mageTemplate( + this.options.tierPriceTemplate, + { + 'tierPrices': result.tierPrices, + '$t': $t, + 'currencyFormat': this.options.jsonConfig.currencyFormat, + 'priceUtils': priceUtils + } + ); + $(this.options.tierPriceBlockSelector).html(tierPriceHtml).show(); + } + } else { + $(this.options.tierPriceBlockSelector).hide(); + } }, /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php index e99b63d5b8ce7727b93cc3ef2898ef6ba95caf01..fd6f99d13f40fb8bce3f99142d6004f8652087d1 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php @@ -31,6 +31,11 @@ class AssertProductPage extends AbstractAssertForm */ protected $product; + /** + * @var CatalogProductView + */ + protected $pageView; + /** * Assert that displayed product data on product page(front-end) equals passed from fixture: * 1. Product Name @@ -53,6 +58,7 @@ class AssertProductPage extends AbstractAssertForm $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $this->product = $product; + $this->pageView = $catalogProductView; $this->productView = $catalogProductView->getViewBlock(); $errors = $this->verify(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml index 180da27ca2a099ab36c00473ac35572c45a31ffd..a1f34f46b0a7cb89342a17a382a0ba1c86de9059 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml @@ -137,6 +137,14 @@ </field> </dataset> + <dataset name="simple_order_tier_price_5"> + <field name="qty" xsi:type="string">5</field> + <field name="cartItem" xsi:type="array"> + <item name="price" xsi:type="string">40</item> + <item name="subtotal" xsi:type="string">40</item> + </field> + </dataset> + <dataset name="simple_order_10_dollar_product"> <field name="qty" xsi:type="string">1</field> <field name="cartItem" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Product/View/ConfigurableOptions.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Product/View/ConfigurableOptions.php index d5279557ec5af84902fbc2a57548df2dcf0aadf6..4edee00a57dbefd8a15846731fa7e888b66186ad 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Product/View/ConfigurableOptions.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Product/View/ConfigurableOptions.php @@ -34,6 +34,13 @@ class ConfigurableOptions extends CustomOptions */ protected $priceBlock = '//*[@class="product-info-main"]//*[contains(@class,"price-box")]'; + /** + * Selector for tier prices. + * + * @var string + */ + private $tierPricesSelector = '.prices-tier li'; + /** * Get configurable product options * @@ -93,11 +100,16 @@ class ConfigurableOptions extends CustomOptions } $productVariations = array_keys($productVariations); - $result = []; foreach ($productVariations as $variation) { $variationOptions = explode(' ', $variation); - $result[$variation]['price'] = $this->getOptionPrice($variationOptions, $attributesData); + //Select all options specified in variation + $this->chooseOptions($variationOptions, $attributesData); + $result[$variation]['price'] = $this->getOptionPrice(); + $tierPrices = $this->getOptionTierPrices(); + if (count($tierPrices) > 0) { + $result[$variation]['tierPrices'] = $tierPrices; + } } return $result; @@ -106,25 +118,34 @@ class ConfigurableOptions extends CustomOptions /** * Get option price * - * @param array $variationOptions - * @param array $attributesData * @return null|string */ - protected function getOptionPrice($variationOptions, $attributesData) + protected function getOptionPrice() { - //Select all options specified in variation - foreach ($variationOptions as $variationSelection) { - list ($attribute, $option) = explode(':', $variationSelection); - $attributeTitle = $attributesData[$attribute]['label']; - $optionTitle = $attributesData[$attribute]['options'][$option]['label']; - $this->selectOption($attributeTitle, $optionTitle); - } - $priceBlock = $this->getPriceBlock(); $price = ($priceBlock->isOldPriceVisible()) ? $priceBlock->getOldPrice() : $priceBlock->getPrice(); return $price; } + /** + * Get tier prices of all variations + * + * @return array + */ + private function getOptionTierPrices() + { + $prices = []; + $tierPricesNodes = $this->_rootElement->getElements($this->tierPricesSelector); + foreach ($tierPricesNodes as $node) { + preg_match('#^[^\d]+(\d+)[^\d]+(\d+(?:(?:,\d+)*)+(?:.\d+)*).*#i', $node->getText(), $matches); + $prices[] = [ + 'qty' => isset($matches[1]) ? $matches[1] : null, + 'price_qty' => isset($matches[2]) ? $matches[2] : null, + ]; + } + return $prices; + } + /** * Get block price. * @@ -139,6 +160,8 @@ class ConfigurableOptions extends CustomOptions } /** + * Select option from the select element. + * * @param string $attributeTitle * @param string $optionTitle */ @@ -147,4 +170,22 @@ class ConfigurableOptions extends CustomOptions $this->_rootElement->find(sprintf($this->optionSelector, $attributeTitle), Locator::SELECTOR_XPATH, 'select') ->setValue($optionTitle); } + + /** + * Choose options of the configurable product + * + * @param $variationOptions + * @param $attributesData + * @return void + */ + protected function chooseOptions($variationOptions, $attributesData) + { + //Select all options specified in variation + foreach ($variationOptions as $variationSelection) { + list ($attribute, $option) = explode(':', $variationSelection); + $attributeTitle = $attributesData[$attribute]['label']; + $optionTitle = $attributesData[$attribute]['options'][$option]['label']; + $this->selectOption($attributeTitle, $optionTitle); + } + } } diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php new file mode 100644 index 0000000000000000000000000000000000000000..74c885a727880edffd79717f5f30689135a3704d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\ConfigurableProduct\Test\Constraint; + +use Magento\Catalog\Test\Constraint\AssertProductPage; +use Magento\ConfigurableProduct\Test\Block\Product\View\ConfigurableOptions; + +/** + * Open created configurble product on frontend and choose variation with tier price + */ +class AssertProductTierPriceOnProductPage extends AssertProductPage +{ + /** + * Verify that tier prices configured for all variations of configured product displayed as expected. + * + * @return array + */ + public function verify() + { + $errors = []; + /** @var ConfigurableOptions $optionsBlock */ + $optionsBlock = $this->pageView->getConfigurableAttributesBlock(); + $formTierPrices = $optionsBlock->getOptionsPrices($this->product); + $products = ($this->product->getDataFieldConfig('configurable_attributes_data')['source'])->getProducts(); + foreach ($products as $key => $product) { + $configuredTierPrice = []; + $actualTierPrices = isset($formTierPrices[$key]['tierPrices']) ? $formTierPrices[$key]['tierPrices'] : []; + $tierPrices = $product->getTierPrice() ?: []; + foreach ($tierPrices as $tierPrice) { + $configuredTierPrice[] = [ + 'qty' => $tierPrice['price_qty'], + 'price_qty' => $tierPrice['price'], + ]; + } + + if ($configuredTierPrice != $actualTierPrices) { + $errors[] = sprintf('Tier prices for variation %s doesn\'t equals to configured.', $key); + } + } + + return $errors; + } +} diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Product/CatalogProductView.xml index c2c5d8428b480dd5ccae46f67d2065bc203b8331..c825f733de1790ef5e8f0a81ad38c37a493df12f 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Product/CatalogProductView.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Product/CatalogProductView.xml @@ -10,6 +10,6 @@ <block name="viewBlock"> <render name="configurable" class="Magento\ConfigurableProduct\Test\Block\Product\View"/> </block> - <block name="configurableAttributesBlock" class="Magento\ConfigurableProduct\Test\Block\Product\View\ConfigurableOptions" locator="#product-options-wrapper" strategy="css selector"/> + <block name="configurableAttributesBlock" class="Magento\ConfigurableProduct\Test\Block\Product\View\ConfigurableOptions" locator=".product-info-main" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml index bb9f7a4ae03b19500b954e187a8765121579acf7..949c6dc065c494a18e2ae617ef859f6663dd05d4 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml @@ -154,6 +154,22 @@ </field> </dataset> + <dataset name="configurable_two_new_options_with_tier_price"> + <field name="options" xsi:type="array"> + <item name="configurable_options" xsi:type="array"> + <item name="0" xsi:type="array"> + <item name="title" xsi:type="string">attribute_key_0</item> + <item name="value" xsi:type="string">option_key_1</item> + </item> + </item> + </field> + <field name="cartItem" xsi:type="array"> + <item name="price" xsi:type="string">9</item> + <item name="qty" xsi:type="string">1</item> + <item name="subtotal" xsi:type="string">9</item> + </field> + </dataset> + <dataset name="configurable_two_options_with_assigned_product"> <field name="options" xsi:type="array"> <item name="configurable_options" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml index cf9d73d3dcd2e727dc7cdb290ecf74d17a453c31..44e2e14545db02103bfe2fa2613f196937cfc558 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml @@ -440,6 +440,42 @@ </field> </dataset> + <dataset name="two_options_with_assigned_product_tier_price"> + <field name="attributes_data" xsi:type="array"> + <item name="attribute_key_0" xsi:type="array"> + <item name="options" xsi:type="array"> + <item name="option_key_0" xsi:type="array"> + <item name="label" xsi:type="string">option_key_1_%isolation%</item> + <item name="pricing_value" xsi:type="string">560</item> + <item name="include" xsi:type="string">Yes</item> + </item> + <item name="option_key_1" xsi:type="array"> + <item name="label" xsi:type="string">option_key_2_%isolation%</item> + <item name="pricing_value" xsi:type="string">10</item> + <item name="include" xsi:type="string">Yes</item> + </item> + </item> + </item> + </field> + <field name="attributes" xsi:type="array"> + <item name="attribute_key_0" xsi:type="string">catalogProductAttribute::attribute_type_dropdown_two_options</item> + </field> + <field name="products" xsi:type="array"> + <item name="attribute_key_0:option_key_0" xsi:type="string">catalogProductSimple::default</item> + <item name="attribute_key_0:option_key_1" xsi:type="string">catalogProductSimple::simple_with_tier_price</item> + </field> + <field name="matrix" xsi:type="array"> + <item name="attribute_key_0:option_key_0" xsi:type="array"> + <item name="qty" xsi:type="string">10</item> + <item name="weight" xsi:type="string">1</item> + </item> + <item name="attribute_key_0:option_key_1" xsi:type="array"> + <item name="qty" xsi:type="string">20</item> + <item name="weight" xsi:type="string">1</item> + </item> + </field> + </dataset> + <dataset name="color_and_size"> <field name="attributes_data" xsi:type="array"> <item name="attribute_key_0" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml index 14ff24f18908da187a0631662cf74bfdaad5db6f..42277101cfbdaf5622efb6b4347dafb75bb113aa 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml @@ -159,5 +159,19 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductOnCustomWebsite" /> </variation> + <variation name="CreateConfigurableProductEntityTestVariation10" summary="Create configurable product with tier price for one item"> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/dataset" xsi:type="string">two_options_with_assigned_product_tier_price</data> + <data name="product/data/checkout_data/dataset" xsi:type="string">configurable_two_new_options_with_special_price</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">1</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/category_ids/dataset" xsi:type="string">default_subcategory</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertProductTierPriceOnProductPage" /> + </variation> </testCase> </config>