Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.3-develop' into product-url-re…
Browse files Browse the repository at this point in the history
…writes
  • Loading branch information
Valeriy Nayda committed Oct 1, 2018
2 parents 16b72a8 + 8460e4e commit df3360b
Show file tree
Hide file tree
Showing 60 changed files with 855 additions and 295 deletions.
33 changes: 25 additions & 8 deletions app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

/**
* Responsible for Select object creation, works as a builder. Returns Select as result;
*
* Used in SQL assemblers.
*/
class SelectBuilder
Expand Down Expand Up @@ -85,11 +86,13 @@ public function getJoins()
* Set joins conditions
*
* @param array $joins
* @return void
* @return $this
*/
public function setJoins($joins)
{
$this->joins = $joins;

return $this;
}

/**
Expand All @@ -106,11 +109,13 @@ public function getConnectionName()
* Set connection name
*
* @param string $connectionName
* @return void
* @return $this
*/
public function setConnectionName($connectionName)
{
$this->connectionName = $connectionName;

return $this;
}

/**
Expand All @@ -127,11 +132,13 @@ public function getColumns()
* Set columns
*
* @param array $columns
* @return void
* @return $this
*/
public function setColumns($columns)
{
$this->columns = $columns;

return $this;
}

/**
Expand All @@ -148,11 +155,13 @@ public function getFilters()
* Set filters
*
* @param array $filters
* @return void
* @return $this
*/
public function setFilters($filters)
{
$this->filters = $filters;

return $this;
}

/**
Expand All @@ -169,11 +178,13 @@ public function getFrom()
* Set from condition
*
* @param array $from
* @return void
* @return $this
*/
public function setFrom($from)
{
$this->from = $from;

return $this;
}

/**
Expand Down Expand Up @@ -236,11 +247,13 @@ public function getGroup()
* Set group
*
* @param array $group
* @return void
* @return $this
*/
public function setGroup($group)
{
$this->group = $group;

return $this;
}

/**
Expand All @@ -257,11 +270,13 @@ public function getParams()
* Set parameters
*
* @param array $params
* @return void
* @return $this
*/
public function setParams($params)
{
$this->params = $params;

return $this;
}

/**
Expand All @@ -278,10 +293,12 @@ public function getHaving()
* Set having condition
*
* @param array $having
* @return void
* @return $this
*/
public function setHaving($having)
{
$this->having = $having;

return $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public function testCreate()
['link-type' => 'right', 'table' => 'attribute', 'condition' => 'neq'],
];
$groups = ['id', 'name'];
$this->selectBuilder->setConnectionName($connectionName);
$this->selectBuilder->setFrom($from);
$this->selectBuilder->setColumns($columns);
$this->selectBuilder->setFilters([$filter]);
$this->selectBuilder->setJoins($joins);
$this->selectBuilder->setGroup($groups);
$this->selectBuilder->setConnectionName($connectionName)
->setFrom($from)
->setColumns($columns)
->setFilters([$filter])
->setJoins($joins)
->setGroup($groups);
$this->resourceConnectionMock->expects($this->once())
->method('getConnection')
->with($connectionName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
data-validate="{required:true}"
value=""
placeholder="<?= /* @escapeNotVerified */ __('password') ?>"
autocomplete="new-password"
autocomplete="off"
/>
</div>
</div>
Expand Down
38 changes: 19 additions & 19 deletions app/code/Magento/Bundle/etc/db_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@
<table name="catalog_product_bundle_price_index" resource="default" engine="innodb"
comment="Catalog Product Bundle Price Index">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Entity Id"/>
comment="Entity ID"/>
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Website Id"/>
<column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Customer Group Id"/>
comment="Customer Group ID"/>
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="false"
comment="Min Price"/>
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="false"
Expand Down Expand Up @@ -153,11 +153,11 @@
<table name="catalog_product_bundle_stock_index" resource="default" engine="innodb"
comment="Catalog Product Bundle Stock Index">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Entity Id"/>
comment="Entity ID"/>
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Website Id"/>
comment="Website ID"/>
<column xsi:type="smallint" name="stock_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Stock Id"/>
comment="Stock ID"/>
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
default="0" comment="Option Id"/>
<column xsi:type="smallint" name="stock_status" padding="6" unsigned="false" nullable="true" identity="false"
Expand All @@ -172,13 +172,13 @@
<table name="catalog_product_index_price_bundle_idx" resource="default" engine="innodb"
comment="Catalog Product Index Price Bundle Idx">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Entity Id"/>
comment="Entity ID"/>
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
identity="false"/>
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Website Id"/>
comment="Website ID"/>
<column xsi:type="smallint" name="tax_class_id" padding="5" unsigned="true" nullable="true" identity="false"
default="0" comment="Tax Class Id"/>
default="0" comment="Tax Class ID"/>
<column xsi:type="smallint" name="price_type" padding="5" unsigned="true" nullable="false" identity="false"
comment="Price Type"/>
<column xsi:type="decimal" name="special_price" scale="4" precision="12" unsigned="false" nullable="true"
Expand Down Expand Up @@ -206,13 +206,13 @@
<table name="catalog_product_index_price_bundle_tmp" resource="default" engine="memory"
comment="Catalog Product Index Price Bundle Tmp">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Entity Id"/>
comment="Entity ID"/>
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
identity="false"/>
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Website Id"/>
comment="Website ID"/>
<column xsi:type="smallint" name="tax_class_id" padding="5" unsigned="true" nullable="true" identity="false"
default="0" comment="Tax Class Id"/>
default="0" comment="Tax Class ID"/>
<column xsi:type="smallint" name="price_type" padding="5" unsigned="true" nullable="false" identity="false"
comment="Price Type"/>
<column xsi:type="decimal" name="special_price" scale="4" precision="12" unsigned="false" nullable="true"
Expand Down Expand Up @@ -240,11 +240,11 @@
<table name="catalog_product_index_price_bundle_sel_idx" resource="default" engine="innodb"
comment="Catalog Product Index Price Bundle Sel Idx">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Entity Id"/>
comment="Entity ID"/>
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
identity="false"/>
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Website Id"/>
comment="Website ID"/>
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
default="0" comment="Option Id"/>
<column xsi:type="int" name="selection_id" padding="10" unsigned="true" nullable="false" identity="false"
Expand All @@ -268,11 +268,11 @@
<table name="catalog_product_index_price_bundle_sel_tmp" resource="default" engine="memory"
comment="Catalog Product Index Price Bundle Sel Tmp">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Entity Id"/>
comment="Entity ID"/>
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
identity="false"/>
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Website Id"/>
comment="Website ID"/>
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
default="0" comment="Option Id"/>
<column xsi:type="int" name="selection_id" padding="10" unsigned="true" nullable="false" identity="false"
Expand All @@ -296,11 +296,11 @@
<table name="catalog_product_index_price_bundle_opt_idx" resource="default" engine="innodb"
comment="Catalog Product Index Price Bundle Opt Idx">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Entity Id"/>
comment="Entity ID"/>
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
identity="false"/>
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Website Id"/>
comment="Website ID"/>
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
default="0" comment="Option Id"/>
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
Expand All @@ -323,11 +323,11 @@
<table name="catalog_product_index_price_bundle_opt_tmp" resource="default" engine="memory"
comment="Catalog Product Index Price Bundle Opt Tmp">
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Entity Id"/>
comment="Entity ID"/>
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
identity="false"/>
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
comment="Website Id"/>
comment="Website ID"/>
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
default="0" comment="Option Id"/>
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
Expand Down
12 changes: 9 additions & 3 deletions app/code/Magento/Catalog/Model/Product/Gallery/UpdateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
class UpdateHandler extends \Magento\Catalog\Model\Product\Gallery\CreateHandler
{
/**
* {@inheritdoc}
* @inheritdoc
*
* @since 101.0.0
*/
protected function processDeletedImages($product, array &$images)
Expand All @@ -31,7 +32,7 @@ protected function processDeletedImages($product, array &$images)

foreach ($images as &$image) {
if (!empty($image['removed'])) {
if (!empty($image['value_id']) && !isset($picturesInOtherStores[$image['file']])) {
if (!empty($image['value_id'])) {
if (preg_match('/\.\.(\\\|\/)/', $image['file'])) {
continue;
}
Expand All @@ -52,7 +53,8 @@ protected function processDeletedImages($product, array &$images)
}

/**
* {@inheritdoc}
* @inheritdoc
*
* @since 101.0.0
*/
protected function processNewImage($product, array &$image)
Expand All @@ -79,6 +81,8 @@ protected function processNewImage($product, array &$image)
}

/**
* Retrieve store ids from product.
*
* @param \Magento\Catalog\Model\Product $product
* @return array
* @since 101.0.0
Expand All @@ -97,6 +101,8 @@ protected function extractStoreIds($product)
}

/**
* Remove deleted images.
*
* @param array $files
* @return null
* @since 101.0.0
Expand Down
25 changes: 13 additions & 12 deletions app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Magento\Catalog\Model\ProductLink\Converter\ConverterPool;
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Provides a collection of linked product items (crosssells, related, upsells, ...)
*/
class CollectionProvider
{
/**
Expand Down Expand Up @@ -47,22 +50,20 @@ public function getCollection(\Magento\Catalog\Model\Product $product, $type)

$products = $this->providers[$type]->getLinkedProducts($product);
$converter = $this->converterPool->getConverter($type);
$output = [];
$sorterItems = [];
foreach ($products as $item) {
$output[$item->getId()] = $converter->convert($item);
$itemId = $item->getId();
$sorterItems[$itemId] = $converter->convert($item);
$sorterItems[$itemId]['position'] = $sorterItems[$itemId]['position'] ?? 0;
}

foreach ($output as $item) {
$itemPosition = $item['position'];
if (!isset($sorterItems[$itemPosition])) {
$sorterItems[$itemPosition] = $item;
} else {
$newPosition = $itemPosition + 1;
$sorterItems[$newPosition] = $item;
}
}
ksort($sorterItems);
usort($sorterItems, function ($itemA, $itemB) {
$posA = intval($itemA['position']);
$posB = intval($itemB['position']);

return $posA <=> $posB;
});

return $sorterItems;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
<element name="descriptionTextArea" type="textarea" selector="#product_form_description"/>
<element name="shortDescriptionTextArea" type="textarea" selector="#product_form_short_description"/>
<element name="sectionHeaderIfNotShowing" type="button" selector="//div[@data-index='content']//div[contains(@class, '_hide')]"/>
<element name="pageHeader" type="textarea" selector="//*[@class='page-header row']"/>
</section>
</sections>
Loading

0 comments on commit df3360b

Please sign in to comment.