Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #20233: Fix issue 20232 : Backend order credit card detail check box misaligned (by @speedy008)
 - #20236: Correct spelling (by @ravi-chandra3197)
 - #20160: issus fixed #20158 Store switcher not aligned proper in tab view (by @cedarvinda)
 - #19817: Fixed 19816 Catalog category merchandiser product list missing move cursor in til� (by @abrarpathan19)
 - #20168: Changes for Product-per-row-not-proper-on-listing-page (by @amol2jcommerce)
 - #20132: Review-Details-Detailed-Rating-misaligned (by @yashwant2jcommerce)
 - #20127:  Product image failure when importing through CSV #20098 (by @irajneeshgupta)
 - #20039: 2.3 develop ddevesh typos fixed (by @ddevesh)
 - #20096: [Forwardport] Using Media Image custom attribute type could not display on frontend. #19054 (by @davidverholen)
 - #20058: Typo corrected Acstract -> Abstract (by @Eayshwary)
 - #19992: 2.3 develop resolved Wrong variable in parameter for phpDoc IN DataBuilder (by @kunj1988)
 - #19390: [Forwardport] Fix for Issue #4136, MAGETWO-53440 (by @vasilii-b)
 - #19313: Add child identities to products instead of parent identities (by @jasperzeinstra)


Fixed GitHub Issues:
 - #20232: Backend order credit card detail check box misaligned (reported by @speedy008) has been fixed in #20233 by @speedy008 in 2.3-develop branch
   Related commits:
     1. 5598b97

 - #20158: Store switcher not aligned proper in tab view (reported by @cedarvinda) has been fixed in #20160 by @cedarvinda in 2.3-develop branch
   Related commits:
     1. c060b57
     2. 1e7bae1

 - #19816: Catalog category merchandiser product list missing move cursor in tile view (reported by @abrarpathan19) has been fixed in #19817 by @abrarpathan19 in 2.3-develop branch
   Related commits:
     1. 373fa09
     2. ff786af

 - #20140: Product per row not proper on listing page  (reported by @dipti2jcommerce) has been fixed in #20168 by @amol2jcommerce in 2.3-develop branch
   Related commits:
     1. e1abd4a

 - #20120: Review Details Detailed Rating misaligned (reported by @priti2jcommerce) has been fixed in #20132 by @yashwant2jcommerce in 2.3-develop branch
   Related commits:
     1. 9c2c4e6

 - #20098: Product image failure when importing through CSV (reported by @flytomek) has been fixed in #20127 by @irajneeshgupta in 2.3-develop branch
   Related commits:
     1. 7f4dffd

 - #19054: Using Media Image custom attribute type  could not display on frontend.  (reported by @nimitaemipro) has been fixed in #20096 by @davidverholen in 2.3-develop branch
   Related commits:
     1. 0edcd20
     2. 9aa1aeb

 - #19974: Wrong variable in parameter for phpDoc IN DataBuilder (reported by @kunj1988) has been fixed in #19992 by @kunj1988 in 2.3-develop branch
   Related commits:
     1. 4ed79dc
     2. 82e51ca
     3. ee9a2be

 - #4136: Widget condition with unexpected character not preventing from saving (reported by @devhn) has been fixed in #19390 by @vasilii-b in 2.3-develop branch
   Related commits:
     1. 00f4f7d
     2. 4008630
     3. e6323fb
     4. 80fed1b
     5. 747f33d
     6. 740fbd0
  • Loading branch information
magento-engcom-team authored Jan 16, 2019
2 parents ec25977 + 458fceb commit 9c36f6f
Show file tree
Hide file tree
Showing 31 changed files with 581 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ $ccType = $block->getInfoData('cc_type');
id="<?= /* @noEscape */ $code ?>_vault"
name="payment[is_active_payment_token_enabler]"
class="admin__control-checkbox"/>
<label class="label" for="<?= /* @noEscape */ $code ?>_vault">
<label class="label admin__field-label" for="<?= /* @noEscape */ $code ?>_vault">
<span><?= $block->escapeHtml(__('Save for later use.')) ?></span>
</label>
</div>
Expand Down
48 changes: 48 additions & 0 deletions app/code/Magento/Bundle/Model/Plugin/Frontend/Product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Bundle\Model\Plugin\Frontend;

use Magento\Bundle\Model\Product\Type;
use Magento\Catalog\Model\Product as CatalogProduct;

/**
* Add child identities to product identities on storefront.
*/
class Product
{
/**
* @var Type
*/
private $type;

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

/**
* Add child identities to product identities
*
* @param CatalogProduct $product
* @param array $identities
* @return array
*/
public function afterGetIdentities(CatalogProduct $product, array $identities): array
{
foreach ($this->type->getChildrenIds($product->getEntityId()) as $childIds) {
foreach ($childIds as $childId) {
$identities[] = CatalogProduct::CACHE_TAG . '_' . $childId;
}
}

return array_unique($identities);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Bundle\Test\Unit\Model\Plugin\Frontend;

use Magento\Bundle\Model\Plugin\Frontend\Product as ProductPlugin;
use Magento\Bundle\Model\Product\Type;
use Magento\Catalog\Model\Product;
use PHPUnit_Framework_MockObject_MockObject as MockObject;

class ProductTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Bundle\Model\Plugin\Product */
private $plugin;

/** @var MockObject|Type */
private $type;

/** @var MockObject|\Magento\Catalog\Model\Product */
private $product;

protected function setUp()
{
$this->product = $this->getMockBuilder(Product::class)
->disableOriginalConstructor()
->setMethods(['getEntityId'])
->getMock();

$this->type = $this->getMockBuilder(Type::class)
->disableOriginalConstructor()
->setMethods(['getChildrenIds'])
->getMock();

$this->plugin = new ProductPlugin($this->type);
}

public function testAfterGetIdentities()
{
$baseIdentities = [
'SomeCacheId',
'AnotherCacheId',
];
$id = 12345;
$childIds = [
1 => [1, 2, 5, 100500],
12 => [7, 22, 45, 24612]
];
$expectedIdentities = [
'SomeCacheId',
'AnotherCacheId',
Product::CACHE_TAG . '_' . 1,
Product::CACHE_TAG . '_' . 2,
Product::CACHE_TAG . '_' . 5,
Product::CACHE_TAG . '_' . 100500,
Product::CACHE_TAG . '_' . 7,
Product::CACHE_TAG . '_' . 22,
Product::CACHE_TAG . '_' . 45,
Product::CACHE_TAG . '_' . 24612,
];
$this->product->expects($this->once())
->method('getEntityId')
->will($this->returnValue($id));
$this->type->expects($this->once())
->method('getChildrenIds')
->with($id)
->will($this->returnValue($childIds));
$identities = $this->plugin->afterGetIdentities($this->product, $baseIdentities);
$this->assertEquals($expectedIdentities, $identities);
}
}
3 changes: 3 additions & 0 deletions app/code/Magento/Bundle/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@
</argument>
</arguments>
</type>
<type name="Magento\Catalog\Model\Product">
<plugin name="bundle" type="Magento\Bundle\Model\Plugin\Frontend\Product" sortOrder="100" />
</type>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ protected function _prepareColumns()
}

/**
* Rerieve grid URL
* Retrieve grid URL
*
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* See COPYING.txt for license details.
*/

namespace Magento\Catalog\Model\Layer\Filter\Item;

/**
* Item Data Builder
*/
namespace Magento\Catalog\Model\Layer\Filter\Item;

class DataBuilder
{
/**
Expand All @@ -29,7 +29,7 @@ class DataBuilder
* Add Item Data
*
* @param string $label
* @param string $label
* @param string $value
* @param int $count
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ define([

/**
* Add product list types as scope and their urls
* expamle: addListType('product_to_add', {urlFetch: 'http://magento...'})
* expamle: addListType('wishlist', {urlSubmit: 'http://magento...'})
* example: addListType('product_to_add', {urlFetch: 'http://magento...'})
* example: addListType('wishlist', {urlSubmit: 'http://magento...'})
*
* @param type types as scope
* @param urls obj can be
Expand All @@ -112,7 +112,7 @@ define([
/**
* Adds complex list type - that is used to submit several list types at once
* Only urlSubmit is possible for this list type
* expamle: addComplexListType(['wishlist', 'product_list'], 'http://magento...')
* example: addComplexListType(['wishlist', 'product_list'], 'http://magento...')
*
* @param type types as scope
* @param urls obj can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
define([
'underscore',
'Magento_Ui/js/form/element/abstract'
], function (_, Acstract) {
], function (_, Abstract) {
'use strict';

return Acstract.extend({
return Abstract.extend({
defaults: {
prefixName: '',
prefixElementName: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
define([
'underscore',
'Magento_Ui/js/form/element/abstract'
], function (_, Acstract) {
], function (_, Abstract) {
'use strict';

return Acstract.extend({
return Abstract.extend({
defaults: {
prefixName: '',
prefixElementName: '',
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/view/base/web/js/price-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ define([
pattern = pattern.indexOf('{sign}') < 0 ? s + pattern : pattern.replace('{sign}', s);

// we're avoiding the usage of to fixed, and using round instead with the e representation to address
// numbers like 1.005 = 1.01. Using ToFixed to only provide trailig zeroes in case we have a whole number
// numbers like 1.005 = 1.01. Using ToFixed to only provide trailing zeroes in case we have a whole number
i = parseInt(
amount = Number(Math.round(Math.abs(+amount || 0) + 'e+' + precision) + ('e-' + precision)),
10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ public function move($fileName, $renameFileOff = false)
}

$fileName = preg_replace('/[^a-z0-9\._-]+/i', '', $fileName);
$filePath = $this->_directory->getRelativePath($filePath . $fileName);
$relativePath = $this->_directory->getRelativePath($filePath . $fileName);
$this->_directory->writeFile(
$filePath,
$relativePath,
$read->readAll()
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\ConfigurableProduct\Model\Plugin\Frontend;

use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Magento\Catalog\Model\Product;

/**
* Extender of product identities for child of configurable products
*/
class ProductIdentitiesExtender
{
/**
* @var Configurable
*/
private $configurableType;

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

/**
* Add child identities to product identities
*
* @param Product $subject
* @param array $identities
* @return array
*/
public function afterGetIdentities(Product $subject, array $identities): array
{
foreach ($this->configurableType->getChildrenIds($subject->getId()) as $childIds) {
foreach ($childIds as $childId) {
$identities[] = Product::CACHE_TAG . '_' . $childId;
}
}

return array_unique($identities);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\ConfigurableProduct\Test\Unit\Model\Plugin\Frontend;

use Magento\ConfigurableProduct\Model\Plugin\Frontend\ProductIdentitiesExtender;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Magento\Catalog\Model\Product;

/**
* Class ProductIdentitiesExtenderTest
*/
class ProductIdentitiesExtenderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|Configurable
*/
private $configurableTypeMock;

/**
* @var ProductIdentitiesExtender
*/
private $plugin;

/** @var MockObject|\Magento\Catalog\Model\Product */
private $product;

protected function setUp()
{
$this->product = $this->getMockBuilder(Product::class)
->disableOriginalConstructor()
->setMethods(['getId'])
->getMock();

$this->configurableTypeMock = $this->getMockBuilder(Configurable::class)
->disableOriginalConstructor()
->getMock();

$this->plugin = new ProductIdentitiesExtender($this->configurableTypeMock);
}

public function testAfterGetIdentities()
{
$identities = [
'SomeCacheId',
'AnotherCacheId',
];
$productId = 12345;
$childIdentities = [
0 => [1, 2, 5, 100500]
];
$expectedIdentities = [
'SomeCacheId',
'AnotherCacheId',
Product::CACHE_TAG . '_' . 1,
Product::CACHE_TAG . '_' . 2,
Product::CACHE_TAG . '_' . 5,
Product::CACHE_TAG . '_' . 100500,
];

$this->product->expects($this->once())
->method('getId')
->willReturn($productId);

$this->configurableTypeMock->expects($this->once())
->method('getChildrenIds')
->with($productId)
->willReturn($childIdentities);

$productIdentities = $this->plugin->afterGetIdentities($this->product, $identities);
$this->assertEquals($expectedIdentities, $productIdentities);
}
}
3 changes: 3 additions & 0 deletions app/code/Magento/ConfigurableProduct/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
<type name="Magento\ConfigurableProduct\Model\ResourceModel\Attribute\OptionSelectBuilderInterface">
<plugin name="Magento_ConfigurableProduct_Plugin_Model_ResourceModel_Attribute_InStockOptionSelectBuilder" type="Magento\ConfigurableProduct\Plugin\Model\ResourceModel\Attribute\InStockOptionSelectBuilder"/>
</type>
<type name="Magento\Catalog\Model\Product">
<plugin name="product_identities_extender" type="Magento\ConfigurableProduct\Model\Plugin\Frontend\ProductIdentitiesExtender" />
</type>
</config>
Loading

0 comments on commit 9c36f6f

Please sign in to comment.