Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
08792e3
MAGETWO-91848: Hint on product option with Maximum Characters should …
danielrenaud May 18, 2018
e7327e9
MAGETWO-91848: Hint on product option with Maximum Characters should …
danielrenaud May 22, 2018
9000d93
MAGETWO-91848: Hint on product option with Maximum Characters should …
danielrenaud May 23, 2018
3f20783
MAGETWO-91848: Hint on product option with Maximum Characters should …
danielrenaud May 24, 2018
deb14f9
test for validation hint on textfield custom product option
RyanZolper May 29, 2018
f89061d
fixed dev group value
RyanZolper May 29, 2018
87a2f1b
MAGETWO-91848: Hint on product option with Maximum Characters should …
danielrenaud May 30, 2018
2cba103
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-9184…
danielrenaud May 30, 2018
b639333
Merge remote-tracking branch 'origin/MAGETWO-91848-max-characters' in…
danielrenaud May 30, 2018
2eb0598
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-9184…
danielrenaud May 30, 2018
38180f2
removed category_ids and tax_class_id from filterable fields list
Jun 2, 2018
788c1aa
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-9184…
danielrenaud Jun 4, 2018
619db2d
ENGCOM-1833: removed category_ids and tax_class_id from filterable fi…
magento-engcom-team Jun 4, 2018
c5ca935
ENGCOM-1833: Limit list of filterable product fields #26
Jun 4, 2018
16dd29a
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-9184…
danielrenaud Jun 5, 2018
2c9cc60
MAGETWO-91437: Invalidate indexer after category is deleted
eric-bohanon Jun 5, 2018
eeef0be
MAGETWO-91437: Fix tests
eric-bohanon Jun 5, 2018
d93fc4f
merge magento/2.3-develop into magento-borg/MAGETWO-91848-max-characters
Jun 6, 2018
a556767
merge magento/2.3-develop into magento-honey-badgers/MAGETWO-91437-Ca…
Jun 6, 2018
ffa75c9
MAGETWO-91437: Fix unit and static failures
eric-bohanon Jun 6, 2018
d8f617f
MAGETWO-91848: Hint on product option with Maximum Characters should …
danielrenaud Jun 6, 2018
3bcd0d0
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-9184…
danielrenaud Jun 7, 2018
f64e7fa
MAGETWO-91437: Formatting change
eric-bohanon Jun 7, 2018
941f26f
ENGCOM-1833: Limit list of filterable product fields #26
Jun 7, 2018
90e95ff
merge magento/2.3-develop into magento-honey-badgers/MAGETWO-91437-Ca…
Jun 7, 2018
7d370f4
MAGETWO-91848: Hint on product option with Maximum Characters should …
danielrenaud Jun 7, 2018
2b7beca
Merge pull request #2660 from magento-honey-badgers/MAGETWO-91437-Cat…
cpartica Jun 8, 2018
7c08f0d
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-9184…
danielrenaud Jun 8, 2018
e279d2c
Merge pull request #2651 from magento-borg/MAGETWO-91848-max-characters
cpartica Jun 8, 2018
f7c3630
MAGETWO-92468: Make PR tests namespace-agnostic to support testing ex…
pdohogne-magento Jun 5, 2018
5fe735b
MAGETWO-92468: Blacklisting non-Magento code directories from copyrig…
pdohogne-magento Jun 7, 2018
9efebd7
Merge branch 'mainline-2.3-develop' into ENGCOM-1833-magento-graphql-…
Jun 8, 2018
ce8a93e
Merge remote-tracking branch 'remotes/mainline/2.3-develop' into ENGC…
Jun 9, 2018
3ab560d
Merge pull request #2672 from magento-engcom/ENGCOM-1833-magento-grap…
paliarush Jun 9, 2018
ca5df87
merge magento/2.3-develop into magento-borg/MAGETWO-92468-make-tests-…
Jun 9, 2018
33393e2
Merge pull request #2676 from magento-borg/MAGETWO-92468-make-tests-n…
pdohogne-magento Jun 9, 2018
2897541
Add missing table aliases to fields mapping for Customer Group filter…
Jun 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions app/code/Magento/Catalog/Model/ResourceModel/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/
namespace Magento\Catalog\Model\ResourceModel;

use Magento\Catalog\Model\Indexer\Category\Product\Processor;
use Magento\Framework\DataObject;
use Magento\Framework\EntityManager\EntityManager;

/**
Expand Down Expand Up @@ -82,6 +84,11 @@ class Category extends AbstractResource
*/
protected $aggregateCount;

/**
* @var Processor
*/
private $indexerProcessor;

/**
* Category constructor.
* @param \Magento\Eav\Model\Entity\Context $context
Expand All @@ -90,6 +97,7 @@ class Category extends AbstractResource
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param Category\TreeFactory $categoryTreeFactory
* @param Category\CollectionFactory $categoryCollectionFactory
* @param Processor $indexerProcessor
* @param array $data
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
*/
Expand All @@ -100,6 +108,7 @@ public function __construct(
\Magento\Framework\Event\ManagerInterface $eventManager,
\Magento\Catalog\Model\ResourceModel\Category\TreeFactory $categoryTreeFactory,
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory,
Processor $indexerProcessor,
$data = [],
\Magento\Framework\Serialize\Serializer\Json $serializer = null
) {
Expand All @@ -113,6 +122,7 @@ public function __construct(
$this->_categoryCollectionFactory = $categoryCollectionFactory;
$this->_eventManager = $eventManager;
$this->connectionName = 'catalog';
$this->indexerProcessor = $indexerProcessor;
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Serialize\Serializer\Json::class);
}
Expand Down Expand Up @@ -197,6 +207,18 @@ protected function _beforeDelete(\Magento\Framework\DataObject $object)
$this->deleteChildren($object);
}

/**
* Mark Category indexer as invalid to be picked up by cron.
*
* @param DataObject $object
* @return $this
*/
protected function _afterDelete(DataObject $object)
{
$this->indexerProcessor->markIndexerAsInvalid();
return parent::_afterDelete($object);
}

/**
* Delete children categories of specific category
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Magento\Catalog\Test\Unit\Model\ResourceModel;

use Magento\Catalog\Model\Factory;
use Magento\Catalog\Model\Indexer\Category\Product\Processor;
use Magento\Catalog\Model\ResourceModel\Category;
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
use Magento\Eav\Model\Config;
Expand Down Expand Up @@ -91,6 +92,11 @@ class CategoryTest extends \PHPUnit\Framework\TestCase
*/
private $serializerMock;

/**
* @var Processor|\PHPUnit_Framework_MockObject_MockObject
*/
private $indexerProcessorMock;

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -121,6 +127,9 @@ protected function setUp()
$this->collectionFactoryMock = $this->getMockBuilder(CollectionFactory::class)
->disableOriginalConstructor()
->getMock();
$this->indexerProcessorMock = $this->getMockBuilder(Processor::class)
->disableOriginalConstructor()
->getMock();

$this->serializerMock = $this->getMockBuilder(Json::class)->getMock();

Expand All @@ -131,6 +140,7 @@ protected function setUp()
$this->managerMock,
$this->treeFactoryMock,
$this->collectionFactoryMock,
$this->indexerProcessorMock,
[],
$this->serializerMock
);
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Catalog/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ Groups,Groups
"Maximum image width","Maximum image width"
"Maximum image height","Maximum image height"
"Maximum number of characters:","Maximum number of characters:"
"Maximum %1 characters", "Maximum %1 characters"
"too many", "too many"
"remaining", "remaining"
"start typing to search template","start typing to search template"
"Product online","Product online"
"Product offline","Product offline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,23 @@ $class = ($_option->getIsRequire()) ? ' required' : '';
cols="25"><?= $block->escapeHtml($block->getDefaultValue()) ?></textarea>
<?php endif; ?>
<?php if ($_option->getMaxCharacters()): ?>
<p class="note"><?= /* @escapeNotVerified */ __('Maximum number of characters:') ?>
<strong><?= /* @escapeNotVerified */ $_option->getMaxCharacters() ?></strong></p>
<p class="note note_<?= /* @escapeNotVerified */ $_option->getId() ?>">
<?= /* @escapeNotVerified */ __('Maximum %1 characters', $_option->getMaxCharacters()) ?>
<span class="character-counter no-display"></span>
</p>
<?php endif; ?>
</div>
<?php if ($_option->getMaxCharacters()): ?>
<script type="text/x-magento-init">
{
"[data-selector='options[<?= /* @escapeNotVerified */ $_option->getId() ?>]']": {
"Magento_Catalog/js/product/remaining-characters": {
"maxLength": "<?= /* @escapeNotVerified */ $_option->getMaxCharacters() ?>",
"noteSelector": ".note_<?= /* @escapeNotVerified */ $_option->getId() ?>",
"counterSelector": ".note_<?= /* @escapeNotVerified */ $_option->getId() ?> .character-counter"
}
}
}
</script>
<?php endif; ?>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

define([
'jquery',
'mage/translate',
'jquery/ui'
], function ($, $t) {
'use strict';

$.widget('mage.remainingCharacters', {
options: {
remainingText: $t('remaining'),
tooManyText: $t('too many'),
errorClass: 'mage-error',
noDisplayClass: 'no-display'
},

/**
* Initializes custom option component
*
* @private
*/
_create: function () {
this.note = $(this.options.noteSelector);
this.counter = $(this.options.counterSelector);

this.updateCharacterCount();
this.element.on('change keyup paste', this.updateCharacterCount.bind(this));
},

/**
* Updates counter message
*/
updateCharacterCount: function () {
var length = this.element.val().length,
diff = this.options.maxLength - length;

this.counter.text(this._formatMessage(diff));
this.counter.toggleClass(this.options.noDisplayClass, length === 0);
this.note.toggleClass(this.options.errorClass, diff < 0);
},

/**
* Format remaining characters message
*
* @param {int} diff
* @returns {String}
* @private
*/
_formatMessage: function (diff) {
var count = Math.abs(diff),
qualifier = diff < 0 ? this.options.tooManyText : this.options.remainingText;

return '(' + count + ' ' + qualifier + ')';
}
});

return $.mage.remainingCharacters;
});
1 change: 0 additions & 1 deletion app/code/Magento/CatalogGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ input ProductSortInput @doc(description: "ProductSortInput specifies the attrib
news_from_date: SortEnum @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product")
news_to_date: SortEnum @doc(description: "The end date for new product listings")
custom_layout_update: SortEnum @doc(description: "XML code that is applied as a layout update to the product page")
category_ids: SortEnum @doc(description: "An array of category IDs the product belongs to")
options_container: SortEnum @doc(description: "If the product has multiple options, determines where they appear on the product page")
required_options: SortEnum @doc(description: "Indicates whether the product has required options")
has_options: SortEnum @doc(description: "Indicates whether additional attributes have been created for the product")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Model\Plugin;

use Magento\Catalog\Model\ResourceModel\Category as Resource;
use Magento\CatalogSearch\Model\Indexer\Fulltext\Processor;

/**
* Perform indexer invalidation after a category delete.
*/
class Category
{
/**
* @var Processor
*/
private $fulltextIndexerProcessor;

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

/**
* Mark fulltext indexer as invalid post-deletion of category.
*
* @param Resource $subjectCategory
* @param Resource $resultCategory
* @return Resource
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterDelete(Resource $subjectCategory, Resource $resultCategory) : Resource
{
$this->fulltextIndexerProcessor->markIndexerAsInvalid();

return $resultCategory;
}
}
3 changes: 3 additions & 0 deletions app/code/Magento/CatalogSearch/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@
<argument name="filter" xsi:type="object">Magento\CatalogSearch\Ui\DataProvider\Product\AddFulltextFilterToCollection</argument>
</arguments>
</type>
<type name="Magento\Catalog\Model\ResourceModel\Category">
<plugin name="fulltext_search_indexer" type="Magento\CatalogSearch\Model\Indexer\Fulltext\Model\Plugin\Category"/>
</type>
</config>
12 changes: 12 additions & 0 deletions app/code/Magento/CatalogSearch/etc/webapi_rest/di.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Model\ResourceModel\Category">
<plugin name="fulltext_search_indexer" type="Magento\CatalogSearch\Model\Indexer\Fulltext\Model\Plugin\Category"/>
</type>
</config>
12 changes: 12 additions & 0 deletions app/code/Magento/CatalogSearch/etc/webapi_soap/di.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Model\ResourceModel\Category">
<plugin name="fulltext_search_indexer" type="Magento\CatalogSearch\Model\Indexer\Fulltext\Model\Plugin\Category"/>
</type>
</config>
12 changes: 6 additions & 6 deletions app/code/Magento/Customer/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -353,19 +353,19 @@
<virtualType name="Magento\Customer\Model\Api\SearchCriteria\CollectionProcessor\GroupFilterProcessor" type="Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor">
<arguments>
<argument name="fieldMapping" xsi:type="array">
<item name="code" xsi:type="string">customer_group_code</item>
<item name="id" xsi:type="string">customer_group_id</item>
<item name="tax_class_name" xsi:type="string">class_name</item>
<item name="code" xsi:type="string">main_table.customer_group_code</item>
<item name="id" xsi:type="string">main_table.customer_group_id</item>
<item name="tax_class_name" xsi:type="string">tax_class_table.class_name</item>
</argument>
</arguments>
</virtualType>
<!-- @api -->
<virtualType name="Magento\Customer\Model\Api\SearchCriteria\CollectionProcessor\GroupSortingProcessor" type="Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor">
<arguments>
<argument name="fieldMapping" xsi:type="array">
<item name="code" xsi:type="string">customer_group_code</item>
<item name="id" xsi:type="string">customer_group_id</item>
<item name="tax_class_name" xsi:type="string">class_name</item>
<item name="code" xsi:type="string">main_table.customer_group_code</item>
<item name="id" xsi:type="string">main_table.customer_group_id</item>
<item name="tax_class_name" xsi:type="string">tax_class_table.class_name</item>
</argument>
<argument name="defaultOrders" xsi:type="array">
<item name="id" xsi:type="string">ASC</item>
Expand Down
12 changes: 0 additions & 12 deletions app/code/Magento/TaxGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.

input ProductFilterInput {
tax_class_id: FilterTypeInput
}

interface ProductInterface {
tax_class_id: Int
}

input ProductSortInput {
tax_class_id: SortEnum
}

enum PriceAdjustmentCodesEnum {
TAX
}
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@
.lib-css(margin-top, @indent__xs);
}
}
.field {
.note.mage-error {
color: @error__color;
}
}
}

.product-options-bottom .price-box,
Expand Down Expand Up @@ -789,7 +794,7 @@
clear: both;
max-width: 100%;
overflow-x: auto;
position: relative; // Needed for Safari(iOS) to properly render "overflow-x" rule.
position: relative; // Needed for Safari(iOS) to properly render 'overflow-x' rule.

.table-comparison > tbody > tr {
> th,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,40 @@
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
</actionGroup>

<!--Fill fields for simple product in a category in Admin, including text option with char limit-->
<actionGroup name="AdminCreateSimpleProductWithTextOptionCharLimit">
<arguments>
<argument name="category"/>
<argument name="simpleProduct"/>
<argument name="charLimit"/>
</arguments>
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
<fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
<fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
<fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
<fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/>
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
<fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>

<click selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}" stepKey="openCustomOptionsSection"/>
<click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/>
<fillField userInput="option1" selector="{{AdminProductCustomizableOptionsSection.optionTitleInput}}" stepKey="fillOptionTitle"/>
<click selector="{{AdminProductCustomizableOptionsSection.optionTypeOpenDropDown}}" stepKey="openTypeDropDown"/>
<click selector="{{AdminProductCustomizableOptionsSection.optionTypeTextField}}" stepKey="selectTypeTextField"/>
<fillField userInput="20" selector="{{AdminProductCustomizableOptionsSection.maxCharactersInput}}" stepKey="fillMaxChars"/>

<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/>
<seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/>
<seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/>
<seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/>
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/>
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
</actionGroup>

<!--Assert text in Related, Up-Sell or Cross-Sell section in Admin Product page-->
<actionGroup name="AssertTextInAdminProductRelatedUpSellCrossSellSection">
<arguments>
Expand Down
Loading