Skip to content

Commit

Permalink
Merge pull request magento#3605 from magento-tsg-csl3/2.2-develop-pr18
Browse files Browse the repository at this point in the history
TSG-CSL3] For 2.2 (pr18)
  • Loading branch information
Lysenko Olexandr authored Jan 18, 2019
2 parents 0369e3a + 8c4aa0e commit 530e0d1
Show file tree
Hide file tree
Showing 20 changed files with 618 additions and 409 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,129 +7,150 @@
// @codingStandardsIgnoreFile

/** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */
$parentItem = $block->getItem();
$items = array_merge([$parentItem], $parentItem->getChildrenItems());
$index = 0;
$prevOptionId = '';
?>
<?php $parentItem = $block->getItem() ?>
<?php $items = array_merge([$parentItem], $parentItem->getChildrenItems()); ?>
<?php $_index = 0 ?>

<?php $_prevOptionId = '' ?>
<?php foreach ($items as $item): ?>

<?php foreach ($items as $_item): ?>

<?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
<?php $_showlastRow = true ?>
<?php if ($block->getItemOptions()
|| $parentItem->getDescription()
|| $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem)
&& $parentItem->getGiftMessageId()): ?>
<?php $showLastRow = true; ?>
<?php else: ?>
<?php $_showlastRow = false ?>
<?php $showLastRow = false; ?>
<?php endif; ?>

<?php if ($_item->getParentItem()): ?>
<?php $attributes = $block->getSelectionAttributes($_item) ?>
<?php if ($_prevOptionId != $attributes['option_id']): ?>
<?php if ($item->getParentItem()): ?>
<?php $attributes = $block->getSelectionAttributes($item) ?>
<?php if ($prevOptionId != $attributes['option_id']): ?>
<tr class="options-label">
<td class="col label" colspan="5"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></td>
<td class="col label" colspan="5"><?= $block->escapeHtml($attributes['option_label']); ?></td>
</tr>
<?php $_prevOptionId = $attributes['option_id'] ?>
<?php $prevOptionId = $attributes['option_id'] ?>
<?php endif; ?>
<?php endif; ?>
<tr id="order-item-row-<?= /* @escapeNotVerified */ $_item->getId() ?>" class="<?php if ($_item->getParentItem()): ?>item-options-container<?php else: ?>item-parent<?php endif; ?>"<?php if ($_item->getParentItem()): ?> data-th="<?= /* @escapeNotVerified */ $attributes['option_label'] ?>"<?php endif; ?>>
<?php if (!$_item->getParentItem()): ?>
<td class="col name" data-th="<?= $block->escapeHtml(__('Product Name')) ?>">
<strong class="product name product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
<tr id="order-item-row-<?= /* @noEscape */ $item->getId() ?>"
class="<?php if ($item->getParentItem()): ?>
item-options-container
<?php else: ?>
item-parent
<?php endif; ?>"
<?php if ($item->getParentItem()): ?>
data-th="<?= $block->escapeHtml($attributes['option_label']); ?>"
<?php endif; ?>>
<?php if (!$item->getParentItem()): ?>
<td class="col name" data-th="<?= $block->escapeHtml(__('Product Name')); ?>">
<strong class="product name product-item-name"><?= $block->escapeHtml($item->getName()); ?></strong>
</td>
<?php else: ?>
<td class="col value" data-th="<?= $block->escapeHtml(__('Product Name')) ?>"><?= $block->getValueHtml($_item) ?></td>
<td class="col value" data-th="<?= $block->escapeHtml(__('Product Name')); ?>">
<?= $block->getValueHtml($item); ?>
</td>
<?php endif; ?>
<td class="col sku" data-th="<?= $block->escapeHtml(__('SKU')) ?>"><?= /* @escapeNotVerified */ $block->prepareSku($_item->getSku()) ?></td>
<td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>">
<?php if (!$_item->getParentItem()): ?>
<?= $block->getItemPriceHtml() ?>
<td class="col sku" data-th="<?= $block->escapeHtml(__('SKU')); ?>">
<?= /* @noEscape */ $block->prepareSku($item->getSku()); ?>
</td>
<td class="col price" data-th="<?= $block->escapeHtml(__('Price')); ?>">
<?php if (!$item->getParentItem()): ?>
<?= /* @noEscape */ $block->getItemPriceHtml(); ?>
<?php else: ?>
&nbsp;
<?php endif; ?>
</td>
<td class="col qty" data-th="<?= $block->escapeHtml(__('Quantity')) ?>">
<td class="col qty" data-th="<?= $block->escapeHtml(__('Quantity')); ?>">
<?php if (
($_item->getParentItem() && $block->isChildCalculated()) ||
(!$_item->getParentItem() && !$block->isChildCalculated()) || ($_item->getQtyShipped() > 0 && $_item->getParentItem() && $block->isShipmentSeparately())):?>
($item->getParentItem() && $block->isChildCalculated()) ||
(!$item->getParentItem() && !$block->isChildCalculated()) ||
($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately())): ?>
<ul class="items-qty">
<?php endif; ?>
<?php if (($_item->getParentItem() && $block->isChildCalculated()) ||
(!$_item->getParentItem() && !$block->isChildCalculated())): ?>
<?php if ($_item->getQtyOrdered() > 0): ?>
<?php if (($item->getParentItem() && $block->isChildCalculated()) ||
(!$item->getParentItem() && !$block->isChildCalculated())): ?>
<?php if ($item->getQtyOrdered() > 0): ?>
<li class="item">
<span class="title"><?= /* @escapeNotVerified */ __('Ordered') ?></span>
<span class="content"><?= /* @escapeNotVerified */ $_item->getQtyOrdered()*1 ?></span>
<span class="title"><?= $block->escapeHtml(__('Ordered')); ?></span>
<span class="content"><?= /* @noEscape */ $item->getQtyOrdered() * 1; ?></span>
</li>
<?php endif; ?>
<?php if ($_item->getQtyShipped() > 0 && !$block->isShipmentSeparately()): ?>
<?php if ($item->getQtyShipped() > 0 && !$block->isShipmentSeparately()): ?>
<li class="item">
<span class="title"><?= /* @escapeNotVerified */ __('Shipped') ?></span>
<span class="content"><?= /* @escapeNotVerified */ $_item->getQtyShipped()*1 ?></span>
<span class="title"><?= $block->escapeHtml(__('Shipped')); ?></span>
<span class="content"><?= /* @noEscape */ $item->getQtyShipped() * 1; ?></span>
</li>
<?php endif; ?>
<?php if ($_item->getQtyCanceled() > 0): ?>
<?php if ($item->getQtyCanceled() > 0): ?>
<li class="item">
<span class="title"><?= /* @escapeNotVerified */ __('Canceled') ?></span>
<span class="content"><?= /* @escapeNotVerified */ $_item->getQtyCanceled()*1 ?></span>
<span class="title"><?= $block->escapeHtml(__('Canceled')); ?></span>
<span class="content"><?= /* @noEscape */ $item->getQtyCanceled() * 1; ?></span>
</li>
<?php endif; ?>
<?php if ($_item->getQtyRefunded() > 0): ?>
<?php if ($item->getQtyRefunded() > 0): ?>
<li class="item">
<span class="title"><?= /* @escapeNotVerified */ __('Refunded') ?></span>
<span class="content"><?= /* @escapeNotVerified */ $_item->getQtyRefunded()*1 ?></span>
<span class="title"><?= $block->escapeHtml(__('Refunded')); ?></span>
<span class="content"><?= /* @noEscape */ $item->getQtyRefunded() * 1; ?></span>
</li>
<?php endif; ?>
<?php elseif ($_item->getQtyShipped() > 0 && $_item->getParentItem() && $block->isShipmentSeparately()): ?>
<?php elseif ($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately()): ?>
<li class="item">
<span class="title"><?= /* @escapeNotVerified */ __('Shipped') ?></span>
<span class="content"><?= /* @escapeNotVerified */ $_item->getQtyShipped()*1 ?></span>
<span class="title"><?= $block->escapeHtml(__('Shipped')); ?></span>
<span class="content"><?= /* @noEscape */ $item->getQtyShipped() * 1; ?></span>
</li>
<?php else: ?>
&nbsp;
<span class="content"><?= /* @noEscape */ $parentItem->getQtyOrdered() * 1; ?></span>
<?php endif; ?>
<?php if (
($_item->getParentItem() && $block->isChildCalculated()) ||
(!$_item->getParentItem() && !$block->isChildCalculated()) || ($_item->getQtyShipped() > 0 && $_item->getParentItem() && $block->isShipmentSeparately())):?>
($item->getParentItem() && $block->isChildCalculated()) ||
(!$item->getParentItem() && !$block->isChildCalculated()) ||
($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately())):?>
</ul>
<?php endif; ?>
</td>
<td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>">
<?php if (!$_item->getParentItem()): ?>
<?= $block->getItemRowTotalHtml() ?>
<?php if (!$item->getParentItem()): ?>
<?= /* @noEscape */ $block->getItemRowTotalHtml(); ?>
<?php else: ?>
&nbsp;
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>

<?php if ($_showlastRow && (($_options = $block->getItemOptions()) || $block->escapeHtml($_item->getDescription()))): ?>
<?php if ($showLastRow && (($options = $block->getItemOptions()) || $block->escapeHtml($item->getDescription()))): ?>
<tr>
<td class="col options" colspan="5">
<?php if ($_options = $block->getItemOptions()): ?>
<?php if ($options = $block->getItemOptions()): ?>
<dl class="item-options">
<?php foreach ($_options as $_option) : ?>
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
<?php foreach ($options as $option) : ?>
<dt><?= $block->escapeHtml($option['label']) ?></dt>
<?php if (!$block->getPrintStatus()): ?>
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="tooltip wrapper"<?php endif; ?>>
<?= /* @escapeNotVerified */ $_formatedOptionValue['value'] ?>
<?php if (isset($_formatedOptionValue['full_view'])): ?>
<?php $formattedOptionValue = $block->getFormatedOptionValue($option) ?>
<dd<?php if (isset($formattedOptionValue['full_view'])): ?>
class="tooltip wrapper"
<?php endif; ?>>
<?= /* @noEscape */ $formattedOptionValue['value'] ?>
<?php if (isset($formattedOptionValue['full_view'])): ?>
<div class="tooltip content">
<dl class="item options">
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
<dd><?= /* @escapeNotVerified */ $_formatedOptionValue['full_view'] ?></dd>
<dt><?= $block->escapeHtml($option['label']); ?></dt>
<dd><?= /* @noEscape */ $formattedOptionValue['full_view']; ?></dd>
</dl>
</div>
<?php endif; ?>
</dd>
<?php else: ?>
<dd><?= $block->escapeHtml((isset($_option['print_value']) ? $_option['print_value'] : $_option['value'])) ?></dd>
<dd><?= $block->escapeHtml((isset($option['print_value']) ?
$option['print_value'] :
$option['value'])); ?>
</dd>
<?php endif; ?>
<?php endforeach; ?>
</dl>
<?php endif; ?>
<?= $block->escapeHtml($_item->getDescription()) ?>
<?= $block->escapeHtml($item->getDescription()); ?>
</td>
</tr>
<?php endif; ?>
6 changes: 1 addition & 5 deletions app/code/Magento/Catalog/view/base/web/js/price-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ define([
pricesCode = [],
priceValue, origin, finalPrice;

if (typeof newPrices !== 'undefined' && newPrices.hasOwnProperty('prices')) {
this.cache.additionalPriceObject = {};
} else {
this.cache.additionalPriceObject = this.cache.additionalPriceObject || {};
}
this.cache.additionalPriceObject = this.cache.additionalPriceObject || {};

if (newPrices) {
$.extend(this.cache.additionalPriceObject, newPrices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ protected function _getItemsData()
return $this->itemDataBuilder->build();
}

$productSize = $productCollection->getSize();

$options = $attribute->getFrontend()
->getSelectOptions();
foreach ($options as $option) {
$this->buildOptionData($option, $isAttributeFilterable, $optionsFacetedData, $productSize);
$this->buildOptionData($option, $isAttributeFilterable, $optionsFacetedData);
}

return $this->itemDataBuilder->build();
Expand All @@ -108,17 +106,16 @@ protected function _getItemsData()
* @param array $option
* @param boolean $isAttributeFilterable
* @param array $optionsFacetedData
* @param int $productSize
* @return void
*/
private function buildOptionData($option, $isAttributeFilterable, $optionsFacetedData, $productSize)
private function buildOptionData($option, $isAttributeFilterable, $optionsFacetedData)
{
$value = $this->getOptionValue($option);
if ($value === false) {
return;
}
$count = $this->getOptionCount($value, $optionsFacetedData);
if ($isAttributeFilterable && (!$this->isOptionReducesResults($count, $productSize) || $count === 0)) {
if ($isAttributeFilterable && $count === 0) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,6 @@ public function testGetItemsWithoutApply()
->method('build')
->will($this->returnValue($builtData));

$this->fulltextCollection->expects($this->once())
->method('getSize')
->will($this->returnValue(50));

$expectedFilterItems = [
$this->createFilterItem(0, $builtData[0]['label'], $builtData[0]['value'], $builtData[0]['count']),
$this->createFilterItem(1, $builtData[1]['label'], $builtData[1]['value'], $builtData[1]['count']),
Expand Down Expand Up @@ -383,9 +379,6 @@ public function testGetItemsOnlyWithResults()
$this->fulltextCollection->expects($this->once())
->method('getFacetedData')
->willReturn($facetedData);
$this->fulltextCollection->expects($this->once())
->method('getSize')
->will($this->returnValue(50));

$this->itemDataBuilder->expects($this->once())
->method('addItemData')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@

use Magento\Config\App\Config\Type\System;
use Magento\Config\Console\Command\ConfigSetCommand;
use Magento\Config\Model\Config\Factory as ConfigFactory;
use Magento\Framework\App\Config\ConfigPathResolver;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Config\Model\PreparedValueFactory;
use Magento\Framework\App\Config\Value;

/**
* Processes default flow of config:set command.
*
* This processor saves the value of configuration into database.
*
* {@inheritdoc}
* @inheritdoc
* @api
* @since 100.2.0
*/
Expand All @@ -44,26 +46,36 @@ class DefaultProcessor implements ConfigSetProcessorInterface
*/
private $preparedValueFactory;

/**
* @var ConfigFactory
*/
private $configFactory;

/**
* @param PreparedValueFactory $preparedValueFactory The factory for prepared value
* @param DeploymentConfig $deploymentConfig The deployment configuration reader
* @param ConfigPathResolver $configPathResolver The resolver for configuration paths according to source type
* @param ConfigFactory|null $configFactory
*/
public function __construct(
PreparedValueFactory $preparedValueFactory,
DeploymentConfig $deploymentConfig,
ConfigPathResolver $configPathResolver
ConfigPathResolver $configPathResolver,
ConfigFactory $configFactory = null
) {
$this->preparedValueFactory = $preparedValueFactory;
$this->deploymentConfig = $deploymentConfig;
$this->configPathResolver = $configPathResolver;

$this->configFactory = $configFactory ?? ObjectManager::getInstance()->get(ConfigFactory::class);
}

/**
* Processes database flow of config:set command.
*
* Requires installed application.
*
* {@inheritdoc}
* @inheritdoc
* @since 100.2.0
*/
public function process($path, $value, $scope, $scopeCode)
Expand All @@ -78,12 +90,12 @@ public function process($path, $value, $scope, $scopeCode)
}

try {
/** @var Value $backendModel */
$backendModel = $this->preparedValueFactory->create($path, $value, $scope, $scopeCode);
if ($backendModel instanceof Value) {
$resourceModel = $backendModel->getResource();
$resourceModel->save($backendModel);
}
$config = $this->configFactory->create([
'scope' => $scope,
'scope_code' => $scopeCode,
]);
$config->setDataByPath($path, $value);
$config->save();
} catch (\Exception $exception) {
throw new CouldNotSaveException(__('%1', $exception->getMessage()), $exception);
}
Expand Down
Loading

0 comments on commit 530e0d1

Please sign in to comment.