Skip to content

Commit 30b1de5

Browse files
author
Oleksii Korshenko
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #13450: Removed each function usage (by @ihor-sviziev) - #13449: Fix default discount tax calculation in double (by @VincentMarmiesse) - magento-engcom/magento2ce#1192: #12860: Sort by Product Name doesn't work with Ancor and available filters. (by @p-bystritsky) - magento-engcom/magento2ce#1147: #7849: M2.x.x Translation Missing in Checkout for Tax (by @RomaKis) - #13436: Product Link Save Handler - Remove not used constructor dependency (by @ihor-sviziev) Fixed GitHub Issues: - #12860: Sort by Product Name doesn't work with Ancor and available filters (reported by @ihor-sviziev) has been fixed in magento-engcom/magento2ce#1192 by @p-bystritsky in 2.2-develop branch Related commits: 1. e5b030a 2. d80c790 - #7849: M2.x.x Translation Missing in Checkout for Tax (reported by @quienti) has been fixed in magento-engcom/magento2ce#1147 by @RomaKis in 2.2-develop branch Related commits: 1. 4d02b99
2 parents 325b430 + 06f6def commit 30b1de5

File tree

13 files changed

+101
-22
lines changed

13 files changed

+101
-22
lines changed

app/code/Magento/Catalog/Model/Product/Link/SaveHandler.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,20 @@ class SaveHandler
3030
*/
3131
private $linkResource;
3232

33-
/**
34-
* @var linkTypeProvider
35-
*/
36-
private $linkTypeProvider;
37-
3833
/**
3934
* SaveHandler constructor.
4035
* @param MetadataPool $metadataPool
4136
* @param Link $linkResource
4237
* @param ProductLinkRepositoryInterface $productLinkRepository
43-
* @param \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
4438
*/
4539
public function __construct(
4640
MetadataPool $metadataPool,
4741
Link $linkResource,
48-
ProductLinkRepositoryInterface $productLinkRepository,
49-
\Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
42+
ProductLinkRepositoryInterface $productLinkRepository
5043
) {
5144
$this->metadataPool = $metadataPool;
5245
$this->linkResource = $linkResource;
5346
$this->productLinkRepository = $productLinkRepository;
54-
$this->linkTypeProvider = $linkTypeProvider;
5547
}
5648

5749
/**

app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,7 @@ public function getAttributeRawValue($entityId, $attribute, $store)
568568
}
569569

570570
if (is_array($attributesData) && sizeof($attributesData) == 1) {
571-
$_data = each($attributesData);
572-
$attributesData = $_data[1];
571+
$attributesData = array_shift($attributesData);
573572
}
574573

575574
return $attributesData === false ? false : $attributesData;

app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,21 @@ protected function _renderFiltersBefore()
366366
'search_result.'. TemporaryStorage::FIELD_SCORE . ' ' . $this->relevanceOrderDirection
367367
);
368368
}
369+
return parent::_renderFiltersBefore();
370+
}
369371

372+
/**
373+
* @inheritdoc
374+
*/
375+
protected function _beforeLoad()
376+
{
370377
/*
371378
* This order is required to force search results be the same
372379
* for the same requests and products with the same relevance
373380
* NOTE: this does not replace existing orders but ADDs one more
374381
*/
375382
$this->setOrder('entity_id');
376-
377-
return parent::_renderFiltersBefore();
383+
return parent::_beforeLoad();
378384
}
379385

380386
/**

app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ public function joinTable($table, $bind, $fields = null, $cond = null, $joinType
803803
{
804804
$tableAlias = null;
805805
if (is_array($table)) {
806-
list($tableAlias, $tableName) = each($table);
806+
list($tableAlias, $tableName) = [key($table), current($table)];
807807
} else {
808808
$tableName = $table;
809809
}

app/code/Magento/Tax/etc/config.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<based_on>shipping</based_on>
2121
<price_includes_tax>0</price_includes_tax>
2222
<shipping_includes_tax>0</shipping_includes_tax>
23-
<discount_tax>0</discount_tax>
2423
<apply_tax_on>0</apply_tax_on>
2524
</calculation>
2625
<defaults>

app/code/Magento/Tax/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,4 @@ Rate,Rate
178178
"Your credit card will be charged for","Your credit card will be charged for"
179179
"An error occurred while loading tax rates.","An error occurred while loading tax rates."
180180
"You will be charged for","You will be charged for"
181+
"Not yet calculated", "Not yet calculated"

app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ define([
1111
'ko',
1212
'Magento_Checkout/js/view/summary/abstract-total',
1313
'Magento_Checkout/js/model/quote',
14-
'Magento_Checkout/js/model/totals'
15-
], function (ko, Component, quote, totals) {
14+
'Magento_Checkout/js/model/totals',
15+
'jquery',
16+
'mage/translate'
17+
], function (ko, Component, quote, totals, $) {
1618
'use strict';
1719

1820
var isTaxDisplayedInGrandTotal = window.checkoutConfig.includeTaxInGrandTotal,
@@ -22,7 +24,7 @@ define([
2224
return Component.extend({
2325
defaults: {
2426
isTaxDisplayedInGrandTotal: isTaxDisplayedInGrandTotal,
25-
notCalculatedMessage: 'Not yet calculated',
27+
notCalculatedMessage: $.mage.__('Not yet calculated'),
2628
template: 'Magento_Tax/checkout/summary/tax'
2729
},
2830
totals: quote.getTotals(),

dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,29 @@ public function addAttributeToSortDataProvider()
160160
]
161161
];
162162
}
163+
164+
/**
165+
* Checks a case if table for join specified as an array.
166+
*
167+
* @throws \Magento\Framework\Exception\LocalizedException
168+
*/
169+
public function testJoinTable()
170+
{
171+
$this->collection->joinTable(
172+
['alias' => 'url_rewrite'],
173+
'entity_id = entity_id',
174+
['request_path'],
175+
'{{table}}.entity_type = \'product\'',
176+
'left'
177+
);
178+
$sql = (string) $this->collection->getSelect();
179+
$productTable = $this->collection->getTable('catalog_product_entity');
180+
$urlRewriteTable = $this->collection->getTable('url_rewrite');
181+
182+
$expected = 'SELECT `e`.*, `alias`.`request_path` FROM `' . $productTable . '` AS `e`'
183+
. ' LEFT JOIN `' . $urlRewriteTable . '` AS `alias` ON (alias.entity_id =e.entity_id)'
184+
. ' AND (alias.entity_type = \'product\')';
185+
186+
self::assertContains($expected, str_replace(PHP_EOL, '', $sql));
187+
}
163188
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Model\ResourceModel;
7+
8+
use Magento\Catalog\Api\ProductRepositoryInterface;
9+
use Magento\Framework\ObjectManagerInterface;
10+
use Magento\TestFramework\Helper\Bootstrap;
11+
use PHPUnit\Framework\TestCase;
12+
13+
class ProductTest extends TestCase
14+
{
15+
/**
16+
* @var Product
17+
*/
18+
private $model;
19+
20+
/**
21+
* @var ObjectManagerInterface
22+
*/
23+
private $objectManager;
24+
25+
/**
26+
* @inheritdoc
27+
*/
28+
protected function setUp()
29+
{
30+
$this->objectManager = Bootstrap::getObjectManager();
31+
32+
$this->model = $this->objectManager->get(Product::class);
33+
}
34+
35+
/**
36+
* Checks a possibility to retrieve product raw attribute value.
37+
*
38+
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
39+
*/
40+
public function testGetAttributeRawValue()
41+
{
42+
$sku = 'simple';
43+
$attribute = 'name';
44+
45+
/** @var ProductRepositoryInterface $productRepository */
46+
$productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
47+
$product = $productRepository->get($sku);
48+
49+
$actual = $this->model->getAttributeRawValue($product->getId(), $attribute, null);
50+
self::assertEquals($product->getName(), $actual);
51+
}
52+
}

dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ protected function buildModulesDependencies()
4444
$moduleName = str_replace('/', '_', $moduleName[1]);
4545
$config = simplexml_load_file($configFile);
4646
$result = $config->xpath("/config/module/depends/module") ?: [];
47-
while (list(, $node) = each($result)) {
47+
foreach ($result as $node) {
4848
/** @var \SimpleXMLElement $node */
49-
$this->moduleDependencies[$moduleName][] = (string)$node['name'];
49+
$this->moduleDependencies[$moduleName][] = (string) $node['name'];
5050
}
5151
}
5252
}

0 commit comments

Comments
 (0)