diff --git a/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php b/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php index 538c80d9b1cf27af4ba14c911b0d0a6913c403c7..4012af357e2c50e31c1052adae15ee1b1a4931bf 100644 --- a/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php +++ b/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php @@ -14,6 +14,8 @@ use Magento\Ui\Component\Container; use Magento\Ui\Component\DynamicRows; use Magento\Ui\Component\Form; use Magento\Ui\Component\Modal; +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface; /** * Create Ship Bundle Items and Affect Bundle Product Selections fields @@ -73,6 +75,7 @@ class BundlePanel extends AbstractModifier */ public function modifyMeta(array $meta) { + $meta = $this->removeFixedTierPrice($meta); $path = $this->arrayManager->findPath(static::CODE_BUNDLE_DATA, $meta, null, 'children'); $meta = $this->arrayManager->merge( @@ -178,6 +181,43 @@ class BundlePanel extends AbstractModifier return $meta; } + /** + * Remove option with fixed tier price from config. + * + * @param array $meta + * @return array + */ + private function removeFixedTierPrice(array $meta) + { + $tierPricePath = $this->arrayManager->findPath( + ProductAttributeInterface::CODE_TIER_PRICE, + $meta, + null, + 'children' + ); + $pricePath = $this->arrayManager->findPath( + ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE, + $meta, + $tierPricePath + ); + $pricePath = $this->arrayManager->slicePath($pricePath, 0, -1) . '/value_type/arguments/data/options'; + + $price = $this->arrayManager->get($pricePath, $meta); + $meta = $this->arrayManager->remove($pricePath, $meta); + foreach ($price as $key => $item) { + if ($item['value'] == ProductPriceOptionsInterface::VALUE_FIXED) { + unset($price[$key]); + } + } + $meta = $this->arrayManager->merge( + $this->arrayManager->slicePath($pricePath, 0, -1), + $meta, + ['options' => $price] + ); + + return $meta; + } + /** * {@inheritdoc} */ diff --git a/app/code/Magento/Bundle/etc/adminhtml/di.xml b/app/code/Magento/Bundle/etc/adminhtml/di.xml index ca93dd5365160fd84372425a11fd5aff32972851..19b683027dfa14062883d4d80430f68a7c6ce49e 100644 --- a/app/code/Magento/Bundle/etc/adminhtml/di.xml +++ b/app/code/Magento/Bundle/etc/adminhtml/di.xml @@ -27,11 +27,11 @@ <argument name="modifiers" xsi:type="array"> <item name="bundle" xsi:type="array"> <item name="class" xsi:type="string">Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\Composite</item> - <item name="sortOrder" xsi:type="number">125</item> + <item name="sortOrder" xsi:type="number">180</item> </item> <item name="bundle_stock_data" xsi:type="array"> <item name="class" xsi:type="string">Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\StockData</item> - <item name="sortOrder" xsi:type="number">126</item> + <item name="sortOrder" xsi:type="number">190</item> </item> </argument> </arguments> diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml index 2d3913d72e579302ac9cd1f0e23d6b235f9c6b23..3425b9323ed4d4e18fd8be5342a4139be87291f3 100644 --- a/app/code/Magento/Bundle/etc/di.xml +++ b/app/code/Magento/Bundle/etc/di.xml @@ -130,4 +130,5 @@ </argument> </arguments> </type> + </config> diff --git a/app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml b/app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml index 3285603c431a219f76698b9e5e8d41571b285c11..63f090acf34dfb477521f992b2ee0f8d1eb6ff17 100644 --- a/app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml +++ b/app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml @@ -22,7 +22,7 @@ $tierPrices = $tierPriceModel->getTierPriceList(); <?php /* @escapeNotVerified */ echo __( 'Buy %1 with %2 discount each', $price['price_qty'], - '<strong class="benefit">' . $tierPriceModel->getSavePercent($price['price']) . '%</strong>' + '<strong class="benefit">' . round($price['percentage_value']) . '%</strong>' ); ?> </li> <?php endforeach; ?> diff --git a/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php b/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php index b994c787bee7aa76f8a4baa3648bcbb2c0e4ee27..5e518df37db1a574f25fe008510e75742cdffa9c 100644 --- a/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php +++ b/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php @@ -23,7 +23,7 @@ class Price implements ProductPriceOptionsInterface { return [ ['value' => self::VALUE_FIXED, 'label' => __('Fixed')], - ['value' => self::VALUE_PERCENT, 'label' => __('Percent')], + ['value' => self::VALUE_PERCENT, 'label' => __('Discount')], ]; } } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php index 480f8e8942e87f200ce3829641ea026d351b1967..460204a478d9d75ac86dbaa4e8d3684ea26b8812 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php @@ -157,6 +157,7 @@ class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\GroupPr $data = parent::modifyPriceData($object, $data); foreach ($data as $key => $tierPrice) { if ($this->getPercentage($tierPrice)) { + $data[$key]['price'] = $object->getPrice() * (1 - $this->getPercentage($tierPrice) / 100); $data[$key]['website_price'] = $object->getPrice() * (1 - $this->getPercentage($tierPrice) / 100); } } diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/TierPrice.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/TierPrice.php index ac511edcf2e5338eba6b83c60cf38a749406cf89..9b382464e8e2392fb07d81c070bae66cce7c203f 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/TierPrice.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/TierPrice.php @@ -109,6 +109,7 @@ class TierPrice extends AbstractModifier 'label' => __('Price'), 'enableLabel' => true, 'dataScope' => '', + 'additionalClasses' => 'control-grouped', 'sortOrder' => isset($priceMeta['arguments']['data']['config']['sortOrder']) ? $priceMeta['arguments']['data']['config']['sortOrder'] : 40, ], diff --git a/app/code/Magento/Persistent/Model/Observer.php b/app/code/Magento/Persistent/Model/Observer.php index 283d7bb45a5e832b0f4450a7633f6d27056d85ca..392d88a29a58137c04209a91107a4a4cc2f7001d 100644 --- a/app/code/Magento/Persistent/Model/Observer.php +++ b/app/code/Magento/Persistent/Model/Observer.php @@ -121,6 +121,13 @@ class Observer public function emulateTopLinks($block) { $this->_applyAccountLinksPersistentData(); - $block->removeLinkByUrl($this->_url->getUrl('customer/account/login')); + /** @var \Magento\Framework\View\Element\Html\Link[] $links */ + $links = $block->getLinks(); + $removeLink = $this->_url->getUrl('customer/account/login'); + foreach ($links as $link) { + if ($link->getHref() == $removeLink) { + $this->_layout->unsetChild($block->getNameInLayout(), $link->getNameInLayout()); + } + } } } diff --git a/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less index 304f895a85b969dfe95acd4e3dddb0607940432f..77a769d8f5a36cc4788031b5efa4d57c85481106 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less +++ b/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less @@ -78,3 +78,19 @@ margin-top: -@indent__base; } } + +// +// Advanced Price panel +// --------------------------------------------- + +.admin__control-fields { + .control-grouped { + .lib-vendor-prefix-display(inline-flex); + .lib-vendor-prefix-flex-direction(row); + + .admin__field + .admin__field { + margin-left: @indent__s; + margin-top: 0; + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceInCart.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceInCart.php index 1bc689d8e1b1e3009bbf2f3fc563b3aa51ccc3c7..f8266026b3927798fa2a04128deb65a70254188e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceInCart.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceInCart.php @@ -110,7 +110,7 @@ class AssertProductTierPriceInCart extends AbstractConstraint { $tierPrice = $product->getDataFieldConfig('tier_price')['source']->getData()[0]; - if ($tierPrice['value_type'] === "Percent") { + if ($tierPrice['value_type'] === "Discount") { $this->fixtureActualPrice = $this->fixturePrice * (1 - $tierPrice['percentage_value'] / 100); } else { $this->fixtureActualPrice = $tierPrice['price']; diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/TierPrice.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/TierPrice.xml index 2f517f4d6cf3cc03020abc575d4e91cd7f7188da..9581427d16ec6f9e597e420dcee0329c2dddee32 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/TierPrice.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/TierPrice.xml @@ -92,7 +92,7 @@ <dataset name="custom_with_percentage_discount"> <field name="0" xsi:type="array"> - <item name="value_type" xsi:type="string">Percent</item> + <item name="value_type" xsi:type="string">Discount</item> <item name="percentage_value" xsi:type="string">3</item> <item name="website" xsi:type="string">All Websites [USD]</item> <item name="price_qty" xsi:type="string">10</item>