Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.4-develop' into menu-spacing-c…
Browse files Browse the repository at this point in the history
…orrect-hitesh
  • Loading branch information
hitesh-wagento committed Jan 10, 2020
2 parents 636f03a + 18c339e commit d3987e5
Show file tree
Hide file tree
Showing 147 changed files with 4,010 additions and 978 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminLogoutActionGroup">
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<argument name="type" xsi:type="string">options</argument>
<argument name="width" xsi:type="string">120</argument>
<argument name="align" xsi:type="string">left</argument>
<argument name="sortable" xsi:type="string">0</argument>
<argument name="options" xsi:type="array">
<item name="disabled" xsi:type="array">
<item name="value" xsi:type="string">0</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<waitForPageLoad stepKey="waitForElementAdded"/>

<!-- Go to the shopping cart page and grab the value of the option title -->
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/>
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/>
<waitForPageLoad stepKey="waitForCartPageLoad"/>
<grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalBefore"/>

Expand All @@ -100,7 +100,7 @@
<see stepKey="assertSuccess2" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."/>

<!-- Go to the shopping cart page and make sure the title has changed -->
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart1"/>
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart1"/>
<waitForPageLoad stepKey="waitForCartPageLoad1"/>
<grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalAfter"/>
<assertNotEquals expected="{$grabTotalBefore}" expectedType="string" actual="{$grabTotalAfter}" actualType="string" stepKey="assertNotEquals"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<waitForPageLoad stepKey="waitForElementAdded2"/>

<!-- Go to the shopping cart page and edit the first product -->
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/>
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/>
<waitForPageLoad stepKey="waitForCartPageLoad"/>
<waitForElementVisible stepKey="waitForInfoDropdown" selector="{{CheckoutCartSummarySection.total}}"/>
<waitForPageLoad stepKey="waitForCartPageLoad3"/>
Expand All @@ -104,7 +104,7 @@
<waitForPageLoad stepKey="waitForElementAdded3"/>

<!-- Go to the shopping cart page -->
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart2"/>
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart2"/>
<waitForPageLoad stepKey="waitForCartPageLoad2"/>

<!-- Assert that the options are both there and the proce no longer matches -->
Expand Down
42 changes: 30 additions & 12 deletions app/code/Magento/Bundle/view/base/web/js/price-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ define([
controlContainer: 'dd', // should be eliminated
priceFormat: {},
isFixedPrice: false,
optionTierPricesBlocksSelector: '#option-tier-prices-{1} [data-role="selection-tier-prices"]'
optionTierPricesBlocksSelector: '#option-tier-prices-{1} [data-role="selection-tier-prices"]',
isOptionsInitialized: false
};

$.widget('mage.priceBundle', {
Expand All @@ -53,20 +54,37 @@ define([
priceBox = $(this.options.priceBoxSelector, form),
qty = $(this.options.qtyFieldSelector, form);

if (priceBox.data('magePriceBox') &&
priceBox.priceBox('option') &&
priceBox.priceBox('option').priceConfig
) {
if (priceBox.priceBox('option').priceConfig.optionTemplate) {
this._setOption('optionTemplate', priceBox.priceBox('option').priceConfig.optionTemplate);
this._updatePriceBox();
priceBox.on('price-box-initialized', this._updatePriceBox.bind(this));
options.on('change', this._onBundleOptionChanged.bind(this));
qty.on('change', this._onQtyFieldChanged.bind(this));
},

/**
* Update price box config with bundle option prices
* @private
*/
_updatePriceBox: function () {
var form = this.element,
options = $(this.options.productBundleSelector, form),
priceBox = $(this.options.priceBoxSelector, form);

if (!this.options.isOptionsInitialized) {
if (priceBox.data('magePriceBox') &&
priceBox.priceBox('option') &&
priceBox.priceBox('option').priceConfig
) {
if (priceBox.priceBox('option').priceConfig.optionTemplate) { //eslint-disable-line max-depth
this._setOption('optionTemplate', priceBox.priceBox('option').priceConfig.optionTemplate);
}
this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat);
priceBox.priceBox('setDefault', this.options.optionConfig.prices);
this.options.isOptionsInitialized = true;
}
this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat);
priceBox.priceBox('setDefault', this.options.optionConfig.prices);
this._applyOptionNodeFix(options);
}
this._applyOptionNodeFix(options);

options.on('change', this._onBundleOptionChanged.bind(this));
qty.on('change', this._onQtyFieldChanged.bind(this));
return this;
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="CaptchaFormsDisplayingSection">
<element name="store" type="button" selector="#menu-magento-backend-stores"/>
<element name="config" type="button" selector="//li[@data-ui-id='menu-magento-config-system-config']//span"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function getFinalPrice();

/**
* Set the final price: usually it calculated as minimal price of the product
*
* Can be different depends on type of product
*
* @param string $finalPrice
Expand All @@ -39,6 +40,7 @@ public function setFinalPrice($finalPrice);

/**
* Retrieve max price of a product
*
* E.g. for product with custom options is price with the most expensive custom option
*
* @return string
Expand All @@ -57,6 +59,7 @@ public function setMaxPrice($maxPrice);

/**
* Retrieve the minimal price of the product or variation
*
* The minimal price is for example, the lowest price of all variations for complex product
*
* @return string
Expand All @@ -66,7 +69,7 @@ public function getMinimalPrice();

/**
* Set max regular price
* Max regular price is the same, as maximum price, except of excluding calculating special price and catalogules
* Max regular price is the same, as maximum price, except of excluding calculating special price and catalog rules
* in it
*
* @param string $maxRegularPrice
Expand Down Expand Up @@ -130,6 +133,7 @@ public function setMinimalPrice($minimalPrice);

/**
* Regular price - is price of product without discounts and special price with taxes and fixed product tax
*
* Usually this price is corresponding to price in admin panel of product
*
* @return string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Product options abstract type block
*
* @author Magento Core Team <core@magentocommerce.com>
*/
declare(strict_types=1);

namespace Magento\Catalog\Block\Product\View\Options;

use Magento\Catalog\Pricing\Price\BasePrice;
use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule;
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;
use Magento\Framework\App\ObjectManager;

/**
* Product options section abstract block.
Expand Down Expand Up @@ -47,20 +45,29 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template
*/
protected $_catalogHelper;

/**
* @var CalculateCustomOptionCatalogRule
*/
private $calculateCustomOptionCatalogRule;

/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Pricing\Helper\Data $pricingHelper
* @param \Magento\Catalog\Helper\Data $catalogData
* @param array $data
* @param CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Pricing\Helper\Data $pricingHelper,
\Magento\Catalog\Helper\Data $catalogData,
array $data = []
array $data = [],
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null
) {
$this->pricingHelper = $pricingHelper;
$this->_catalogHelper = $catalogData;
$this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule
?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class);
parent::__construct($context, $data);
}

Expand Down Expand Up @@ -161,6 +168,15 @@ protected function _formatPrice($value, $flag = true)
$priceStr = $sign;

$customOptionPrice = $this->getProduct()->getPriceInfo()->getPrice('custom_option_price');

if (!$value['is_percent']) {
$value['pricing_value'] = $this->calculateCustomOptionCatalogRule->execute(
$this->getProduct(),
(float)$value['pricing_value'],
(bool)$value['is_percent']
);
}

$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
$optionAmount = $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
$priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount(
Expand Down
Loading

0 comments on commit d3987e5

Please sign in to comment.