Skip to content

Commit

Permalink
Merge pull request #3475 from magento-engcom/2.3-develop-prs
Browse files Browse the repository at this point in the history
[EngCom] Public Pull Requests - 2.3-develop
  • Loading branch information
VladimirZaets authored Nov 22, 2018
2 parents 1a805d0 + 07510d8 commit 365e400
Show file tree
Hide file tree
Showing 18 changed files with 319 additions and 223 deletions.
14 changes: 13 additions & 1 deletion app/code/Magento/Catalog/Controller/Product/Compare.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Catalog\Controller\Product;

use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Data\Form\FormKey\Validator;
use Magento\Framework\View\Result\PageFactory;

Expand All @@ -15,7 +16,7 @@
* @SuppressWarnings(PHPMD.LongVariable)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
abstract class Compare extends \Magento\Framework\App\Action\Action
abstract class Compare extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface
{
/**
* Customer id
Expand Down Expand Up @@ -139,4 +140,15 @@ public function setCustomerId($customerId)
$this->_customerId = $customerId;
return $this;
}

/**
* @inheritdoc
*/
public function execute()
{
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('catalog/product_compare');

return $resultRedirect;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Type as ProductType;
use Magento\Catalog\Model\ResourceModel\Eav\Attribute as EavAttribute;
use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory as EavAttributeFactory;
use Magento\Catalog\Ui\DataProvider\CatalogEavValidationRules;
Expand Down Expand Up @@ -419,7 +420,7 @@ public function modifyData(array $data)

foreach ($attributes as $attribute) {
if (null !== ($attributeValue = $this->setupAttributeData($attribute))) {
if ($attribute->getFrontendInput() === 'price' && is_scalar($attributeValue)) {
if ($this->isPriceAttribute($attribute, $attributeValue)) {
$attributeValue = $this->formatPrice($attributeValue);
}
$data[$productId][self::DATA_SOURCE_DEFAULT][$attribute->getAttributeCode()] = $attributeValue;
Expand All @@ -430,6 +431,32 @@ public function modifyData(array $data)
return $data;
}

/**
* Obtain if given attribute is a price
*
* @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute
* @param string|integer $attributeValue
* @return bool
*/
private function isPriceAttribute(ProductAttributeInterface $attribute, $attributeValue)
{
return $attribute->getFrontendInput() === 'price'
&& is_scalar($attributeValue)
&& !$this->isBundleSpecialPrice($attribute);
}

/**
* Obtain if current product is bundle and given attribute is special_price
*
* @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute
* @return bool
*/
private function isBundleSpecialPrice(ProductAttributeInterface $attribute)
{
return $this->locator->getProduct()->getTypeId() === ProductType::TYPE_BUNDLE
&& $attribute->getAttributeCode() === ProductAttributeInterface::CODE_SPECIAL_PRICE;
}

/**
* Resolve data persistence
*
Expand Down
32 changes: 28 additions & 4 deletions app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
define([
'jquery',
'domReady',
'consoleLogger',
'jquery/ui',
'mage/cookies'
], function ($, domReady) {
], function ($, domReady, consoleLogger) {
'use strict';

/**
Expand All @@ -35,7 +36,9 @@ define([
* @returns {Array}
*/
$.fn.comments = function () {
var elements = [];
var elements = [],
contents,
elementContents;

/**
* @param {jQuery} element - Comment holder
Expand All @@ -46,14 +49,35 @@ define([
// prevent cross origin iframe content reading
if ($(element).prop('tagName') === 'IFRAME') {
iframeHostName = $('<a>').prop('href', $(element).prop('src'))
.prop('hostname');
.prop('hostname');

if (window.location.hostname !== iframeHostName) {
return [];
}
}

$(element).contents().each(function (index, el) {
/**
* Rewrite jQuery contents().
*
* @param {jQuery} elem
*/
contents = function (elem) {
return $.map(elem, function (el) {
try {
return $.nodeName(el, 'iframe') ?
el.contentDocument || (el.contentWindow ? el.contentWindow.document : []) :
$.merge([], el.childNodes);
} catch (e) {
consoleLogger.error(e);

return [];
}
});
};

elementContents = contents($(element));

$.each(elementContents, function (index, el) {
switch (el.nodeType) {
case 1: // ELEMENT_NODE
lookup(el);
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Review/Model/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
namespace Magento\Review\Model;

use Magento\Framework\DataObject;
use Magento\Catalog\Model\Product;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Review\Model\ResourceModel\Review\Product\Collection as ProductCollection;
Expand Down Expand Up @@ -327,6 +328,9 @@ public function appendSummary($collection)
$item->setRatingSummary($summary);
}
}
if (!$item->getRatingSummary()) {
$item->setRatingSummary(new DataObject());
}
}

return $this;
Expand Down
18 changes: 10 additions & 8 deletions app/code/Magento/Sales/Block/Order/Items.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
*/

/**
* Sales order view items block
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Sales\Block\Order;

/**
* Sales order view items block.
*
* @api
* @since 100.0.2
*/
Expand Down Expand Up @@ -71,7 +71,6 @@ protected function _prepareLayout()

$this->itemCollection = $this->itemCollectionFactory->create();
$this->itemCollection->setOrderFilter($this->getOrder());
$this->itemCollection->filterByParent(null);

/** @var \Magento\Theme\Block\Html\Pager $pagerBlock */
$pagerBlock = $this->getChildBlock('sales_order_item_pager');
Expand All @@ -87,8 +86,9 @@ protected function _prepareLayout()
}

/**
* Determine if the pager should be displayed for order items list
* To be called from templates(after _prepareLayout())
* Determine if the pager should be displayed for order items list.
*
* To be called from templates(after _prepareLayout()).
*
* @return bool
* @since 100.1.7
Expand All @@ -101,7 +101,8 @@ public function isPagerDisplayed()

/**
* Get visible items for current page.
* To be called from templates(after _prepareLayout())
*
* To be called from templates(after _prepareLayout()).
*
* @return \Magento\Framework\DataObject[]
* @since 100.1.7
Expand All @@ -112,8 +113,9 @@ public function getItems()
}

/**
* Get pager HTML according to our requirements
* To be called from templates(after _prepareLayout())
* Get pager HTML according to our requirements.
*
* To be called from templates(after _prepareLayout()).
*
* @return string HTML output
* @since 100.1.7
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/Ui/view/base/web/js/grid/massactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ define([
var itemsType = data.excludeMode ? 'excluded' : 'selected',
selections = {};

if (itemsType === 'excluded' && data.selected && data.selected.length) {
itemsType = 'selected';
data[itemsType] = _.difference(data.selected, data.excluded);
}

selections[itemsType] = data[itemsType];

if (!selections[itemsType].length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// _____________________________________________

& when (@media-common = true) {

.block-banners,
.block-banners-inline {
&:extend(.abs-margin-for-blocks-and-widgets);
Expand All @@ -22,7 +21,7 @@
}

.banner-item-content {
.lib-css(margin-bottom, @indent__base);
margin-bottom: @indent__base;

img {
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
// */

//
// Common
// _____________________________________________
// Variables
// ---------------------------------------------

@toolbar-mode-icon-font-size: 24px;
@toolbar-element-background: @panel__background-color;

& when (@media-common = true) {
//
// Common
// _____________________________________________

& when (@media-common = true) {
.page-products {
.columns {
position: relative;
Expand Down Expand Up @@ -72,12 +75,12 @@
.sorter-action {
vertical-align: top;
.lib-icon-font(
@icon-arrow-up,
@_icon-font-size: 28px,
@_icon-font-line-height: 32px,
@_icon-font-color: @header-icons-color,
@_icon-font-color-hover: @header-icons-color-hover,
@_icon-font-text-hide: true
@icon-arrow-up,
@_icon-font-size: 28px,
@_icon-font-line-height: 32px,
@_icon-font-color: @header-icons-color,
@_icon-font-color-hover: @header-icons-color-hover,
@_icon-font-text-hide: true
);
}

Expand All @@ -99,7 +102,7 @@
}

.limiter-label {
font-weight: 400;
font-weight: @font-weight__regular;
}

.limiter {
Expand Down Expand Up @@ -176,11 +179,11 @@
}

.lib-icon-font(
@icon-grid,
@_icon-font-size: @toolbar-mode-icon-font-size,
@_icon-font-text-hide: true,
@_icon-font-color: @text__color__muted,
@_icon-font-color-hover: @text__color__muted
@icon-grid,
@_icon-font-size: @toolbar-mode-icon-font-size,
@_icon-font-text-hide: true,
@_icon-font-color: @text__color__muted,
@_icon-font-color-hover: @text__color__muted
);
}

Expand Down
Loading

0 comments on commit 365e400

Please sign in to comment.