Skip to content

Commit 177940d

Browse files
committed
MAGETWO-61554: UX improvements
1 parent 3af1d10 commit 177940d

File tree

11 files changed

+73
-7
lines changed

11 files changed

+73
-7
lines changed

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Magento\Ui\Component\DynamicRows;
1515
use Magento\Ui\Component\Form;
1616
use Magento\Ui\Component\Modal;
17+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
18+
use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface;
1719

1820
/**
1921
* Create Ship Bundle Items and Affect Bundle Product Selections fields
@@ -73,6 +75,7 @@ public function __construct(
7375
*/
7476
public function modifyMeta(array $meta)
7577
{
78+
$meta = $this->removeFixedTierPrice($meta);
7679
$path = $this->arrayManager->findPath(static::CODE_BUNDLE_DATA, $meta, null, 'children');
7780

7881
$meta = $this->arrayManager->merge(
@@ -178,6 +181,43 @@ public function modifyMeta(array $meta)
178181
return $meta;
179182
}
180183

184+
/**
185+
* Remove option with fixed tier price from config.
186+
*
187+
* @param array $meta
188+
* @return array
189+
*/
190+
private function removeFixedTierPrice(array $meta)
191+
{
192+
$tierPricePath = $this->arrayManager->findPath(
193+
ProductAttributeInterface::CODE_TIER_PRICE,
194+
$meta,
195+
null,
196+
'children'
197+
);
198+
$pricePath = $this->arrayManager->findPath(
199+
ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE,
200+
$meta,
201+
$tierPricePath
202+
);
203+
$pricePath = $this->arrayManager->slicePath($pricePath, 0, -1) . '/value_type/arguments/data/options';
204+
205+
$price = $this->arrayManager->get($pricePath, $meta);
206+
$meta = $this->arrayManager->remove($pricePath, $meta);
207+
foreach ($price as $key => $item) {
208+
if ($item['value'] == ProductPriceOptionsInterface::VALUE_FIXED) {
209+
unset($price[$key]);
210+
}
211+
}
212+
$meta = $this->arrayManager->merge(
213+
$this->arrayManager->slicePath($pricePath, 0, -1),
214+
$meta,
215+
['options' => $price]
216+
);
217+
218+
return $meta;
219+
}
220+
181221
/**
182222
* {@inheritdoc}
183223
*/

app/code/Magento/Bundle/etc/adminhtml/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
<argument name="modifiers" xsi:type="array">
2828
<item name="bundle" xsi:type="array">
2929
<item name="class" xsi:type="string">Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\Composite</item>
30-
<item name="sortOrder" xsi:type="number">125</item>
30+
<item name="sortOrder" xsi:type="number">180</item>
3131
</item>
3232
<item name="bundle_stock_data" xsi:type="array">
3333
<item name="class" xsi:type="string">Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\StockData</item>
34-
<item name="sortOrder" xsi:type="number">126</item>
34+
<item name="sortOrder" xsi:type="number">190</item>
3535
</item>
3636
</argument>
3737
</arguments>

app/code/Magento/Bundle/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,5 @@
130130
</argument>
131131
</arguments>
132132
</type>
133+
133134
</config>

app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $tierPrices = $tierPriceModel->getTierPriceList();
2222
<?php /* @escapeNotVerified */ echo __(
2323
'Buy %1 with %2 discount each',
2424
$price['price_qty'],
25-
'<strong class="benefit">' . $tierPriceModel->getSavePercent($price['price']) . '%</strong>'
25+
'<strong class="benefit">' . round($price['percentage_value']) . '%</strong>'
2626
); ?>
2727
</li>
2828
<?php endforeach; ?>

app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function toOptionArray()
2323
{
2424
return [
2525
['value' => self::VALUE_FIXED, 'label' => __('Fixed')],
26-
['value' => self::VALUE_PERCENT, 'label' => __('Percent')],
26+
['value' => self::VALUE_PERCENT, 'label' => __('Discount')],
2727
];
2828
}
2929
}

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ protected function modifyPriceData($object, $data)
157157
$data = parent::modifyPriceData($object, $data);
158158
foreach ($data as $key => $tierPrice) {
159159
if ($this->getPercentage($tierPrice)) {
160+
$data[$key]['price'] = $object->getPrice() * (1 - $this->getPercentage($tierPrice) / 100);
160161
$data[$key]['website_price'] = $object->getPrice() * (1 - $this->getPercentage($tierPrice) / 100);
161162
}
162163
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/TierPrice.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ private function getUpdatedTierPriceStructure(array $priceMeta)
109109
'label' => __('Price'),
110110
'enableLabel' => true,
111111
'dataScope' => '',
112+
'additionalClasses' => 'control-grouped',
112113
'sortOrder' => isset($priceMeta['arguments']['data']['config']['sortOrder'])
113114
? $priceMeta['arguments']['data']['config']['sortOrder'] : 40,
114115
],

app/code/Magento/Persistent/Model/Observer.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ protected function _applyAccountLinksPersistentData()
121121
public function emulateTopLinks($block)
122122
{
123123
$this->_applyAccountLinksPersistentData();
124-
$block->removeLinkByUrl($this->_url->getUrl('customer/account/login'));
124+
/** @var \Magento\Framework\View\Element\Html\Link[] $links */
125+
$links = $block->getLinks();
126+
$removeLink = $this->_url->getUrl('customer/account/login');
127+
foreach ($links as $link) {
128+
if ($link->getHref() == $removeLink) {
129+
$this->_layout->unsetChild($block->getNameInLayout(), $link->getNameInLayout());
130+
}
131+
}
125132
}
126133
}

app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,19 @@
7878
margin-top: -@indent__base;
7979
}
8080
}
81+
82+
//
83+
// Advanced Price panel
84+
// ---------------------------------------------
85+
86+
.admin__control-fields {
87+
.control-grouped {
88+
.lib-vendor-prefix-display(inline-flex);
89+
.lib-vendor-prefix-flex-direction(row);
90+
91+
.admin__field + .admin__field {
92+
margin-left: @indent__s;
93+
margin-top: 0;
94+
}
95+
}
96+
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceInCart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private function countCheckoutCartItemPrice(FixtureInterface $product)
110110
{
111111
$tierPrice = $product->getDataFieldConfig('tier_price')['source']->getData()[0];
112112

113-
if ($tierPrice['value_type'] === "Percent") {
113+
if ($tierPrice['value_type'] === "Discount") {
114114
$this->fixtureActualPrice = $this->fixturePrice * (1 - $tierPrice['percentage_value'] / 100);
115115
} else {
116116
$this->fixtureActualPrice = $tierPrice['price'];

0 commit comments

Comments
 (0)