Skip to content

Commit

Permalink
Merge pull request #4037 from magento-tsg-csl3/2.3-develop-pr20
Browse files Browse the repository at this point in the history
[TSG-CSL3] For 2.3 (pr20)
  • Loading branch information
viktym authored Apr 15, 2019
2 parents 810780b + 75621a2 commit f5be490
Show file tree
Hide file tree
Showing 40 changed files with 1,221 additions and 222 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@
<waitForPageLoad stepKey="waitForPageLoad10"/>
<click selector="{{BraintreeConfigurationPaymentSection.paymentMethod}}" stepKey="SelectBraintreePaymentMethod1"/>
<waitForPageLoad stepKey="waitForPageLoad11"/>
<click selector="{{CheckoutPaymentSection.shippingAndBillingAddressSame}}" stepKey="UncheckCheckBox"/>

<click selector="{{CheckoutShippingSection.updateAddress}}" stepKey="clickToUpdate"/>
<waitForPageLoad stepKey="waitForPageLoad12"/>
<!--Place order-->
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="PlaceOrder1"/>
<waitForPageLoad stepKey="waitForPageLoad13"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

namespace Magento\Bundle\Block\Catalog\Product\View\Type\Bundle;

use Magento\Catalog\Model\Product;

/**
* Bundle option renderer
* @api
Expand Down Expand Up @@ -169,7 +171,7 @@ protected function assignSelection(\Magento\Bundle\Model\Option $option, $select
{
if (is_array($selectionId)) {
$this->_selectedOptions = $selectionId;
} else if ($selectionId && $option->getSelectionById($selectionId)) {
} elseif ($selectionId && $option->getSelectionById($selectionId)) {
$this->_selectedOptions = $selectionId;
} elseif (!$option->getRequired()) {
$this->_selectedOptions = 'None';
Expand All @@ -179,7 +181,7 @@ protected function assignSelection(\Magento\Bundle\Model\Option $option, $select
/**
* Define if selection is selected
*
* @param \Magento\Catalog\Model\Product $selection
* @param Product $selection
* @return bool
*/
public function isSelected($selection)
Expand Down Expand Up @@ -219,7 +221,7 @@ protected function _getSelectedQty()
/**
* Get product model
*
* @return \Magento\Catalog\Model\Product
* @return Product
*/
public function getProduct()
{
Expand All @@ -232,7 +234,7 @@ public function getProduct()
/**
* Get bundle option price title.
*
* @param \Magento\Catalog\Model\Product $selection
* @param Product $selection
* @param bool $includeContainer
* @return string
*/
Expand All @@ -254,7 +256,7 @@ public function getSelectionQtyTitlePrice($selection, $includeContainer = true)
/**
* Get price for selection product
*
* @param \Magento\Catalog\Model\Product $selection
* @param Product $selection
* @return int|float
*/
public function getSelectionPrice($selection)
Expand All @@ -277,7 +279,7 @@ public function getSelectionPrice($selection)
/**
* Get title price for selection product
*
* @param \Magento\Catalog\Model\Product $selection
* @param Product $selection
* @param bool $includeContainer
* @return string
*/
Expand All @@ -299,7 +301,7 @@ public function getSelectionTitlePrice($selection, $includeContainer = true)
*/
public function setValidationContainer($elementId, $containerId)
{
return;
return '';
}

/**
Expand All @@ -318,7 +320,7 @@ public function setOption(\Magento\Bundle\Model\Option $option)
/**
* Format price string
*
* @param \Magento\Catalog\Model\Product $selection
* @param Product $selection
* @param bool $includeContainer
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Bundle\Block\DataProviders;

use Magento\Catalog\Model\Product;
use Magento\Catalog\Pricing\Price\TierPrice;
use Magento\Framework\Pricing\Render;
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Magento\Framework\View\LayoutInterface;

/**
* Provides additional data for bundle options
*/
class OptionPriceRenderer implements ArgumentInterface
{
/**
* Parent layout of the block
*
* @var LayoutInterface
*/
private $layout;

/**
* @param LayoutInterface $layout
*/
public function __construct(LayoutInterface $layout)
{
$this->layout = $layout;
}

/**
* Format tier price string
*
* @param Product $selection
* @param array $arguments
* @return string
*/
public function renderTierPrice(Product $selection, array $arguments = []): string
{
if (!array_key_exists('zone', $arguments)) {
$arguments['zone'] = Render::ZONE_ITEM_OPTION;
}

$priceHtml = '';

/** @var Render $priceRender */
$priceRender = $this->layout->getBlock('product.price.render.default');
if ($priceRender !== false) {
$priceHtml = $priceRender->render(
TierPrice::PRICE_CODE,
$selection,
$arguments
);
}

return $priceHtml;
}
}
Loading

0 comments on commit f5be490

Please sign in to comment.