Skip to content

Commit

Permalink
Merge branch 2.3-develop into ENGCOM-4215-magento-magento2-20895
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-engcom-team committed Feb 12, 2019
2 parents 043c38b + 4e11084 commit 97c853b
Show file tree
Hide file tree
Showing 183 changed files with 4,887 additions and 618 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public function getChildren($item)
}

/**
* Check if item can be shipped separately
*
* @param mixed $item
* @return bool
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
Expand Down Expand Up @@ -136,6 +138,8 @@ public function isShipmentSeparately($item = null)
}

/**
* Check if child items calculated
*
* @param mixed $item
* @return bool
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
Expand Down Expand Up @@ -174,6 +178,8 @@ public function isChildCalculated($item = null)
}

/**
* Retrieve selection attributes values
*
* @param mixed $item
* @return mixed|null
*/
Expand All @@ -191,6 +197,8 @@ public function getSelectionAttributes($item)
}

/**
* Retrieve order item options array
*
* @return array
*/
public function getOrderOptions()
Expand All @@ -212,6 +220,8 @@ public function getOrderOptions()
}

/**
* Retrieve order item
*
* @return mixed
*/
public function getOrderItem()
Expand All @@ -223,6 +233,8 @@ public function getOrderItem()
}

/**
* Get html info for item
*
* @param mixed $item
* @return string
*/
Expand All @@ -245,6 +257,8 @@ public function getValueHtml($item)
}

/**
* Check if we can show price info for this item
*
* @param object $item
* @return bool
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@
<?php endif; ?>

<?php foreach ($items as $_item): ?>
<?php
$shipTogether = ($_item->getOrderItem()->getProductType() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) ?
!$_item->getOrderItem()->isShipSeparately() : !$_item->getOrderItem()->getParentItem()->isShipSeparately()
?>
<?php $block->setPriceDataObject($_item) ?>
<?php if ($_item->getOrderItem()->getParentItem()): ?>
<?php
if ($shipTogether) {
continue;
}
?>
<?php $attributes = $block->getSelectionAttributes($_item) ?>
<?php if ($_prevOptionId != $attributes['option_id']): ?>
<tr>
Expand Down Expand Up @@ -60,14 +69,14 @@
</td>
<?php endif; ?>
<td class="col-price">
<?php if ($block->canShowPriceInfo($_item)): ?>
<?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?>
<?= $block->getColumnHtml($_item, 'price') ?>
<?php else: ?>
&nbsp;
<?php endif; ?>
</td>
<td class="col-qty">
<?php if ($block->canShowPriceInfo($_item)): ?>
<?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?>
<table class="qty-table">
<tr>
<th><?= /* @escapeNotVerified */ __('Ordered') ?></th>
Expand Down Expand Up @@ -116,7 +125,7 @@
<?php endif; ?>
</td>
<td class="col-qty-invoice">
<?php if ($block->canShowPriceInfo($_item)): ?>
<?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?>
<?php if ($block->canEditQty()) : ?>
<input type="text"
class="input-text admin__control-text qty-input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public function getCategory()
}

/**
* Get category id
*
* @return int|string|null
*/
public function getCategoryId()
Expand All @@ -78,6 +80,8 @@ public function getCategoryId()
}

/**
* Get category name
*
* @return string
*/
public function getCategoryName()
Expand All @@ -86,6 +90,8 @@ public function getCategoryName()
}

/**
* Get category path
*
* @return mixed
*/
public function getCategoryPath()
Expand All @@ -97,6 +103,8 @@ public function getCategoryPath()
}

/**
* Check store root category
*
* @return bool
*/
public function hasStoreRootCategory()
Expand All @@ -109,6 +117,8 @@ public function hasStoreRootCategory()
}

/**
* Get store from request
*
* @return Store
*/
public function getStore()
Expand All @@ -118,6 +128,8 @@ public function getStore()
}

/**
* Get root category for tree
*
* @param mixed|null $parentNodeCategory
* @param int $recursionLevel
* @return Node|array|null
Expand Down Expand Up @@ -149,10 +161,11 @@ public function getRoot($parentNodeCategory = null, $recursionLevel = 3)

$root = $tree->getNodeById($rootId);

if ($root && $rootId != \Magento\Catalog\Model\Category::TREE_ROOT_ID) {
if ($root) {
$root->setIsVisible(true);
} elseif ($root && $root->getId() == \Magento\Catalog\Model\Category::TREE_ROOT_ID) {
$root->setName(__('Root'));
if ($root->getId() == \Magento\Catalog\Model\Category::TREE_ROOT_ID) {
$root->setName(__('Root'));
}
}

$this->_coreRegistry->register('root', $root);
Expand All @@ -162,6 +175,8 @@ public function getRoot($parentNodeCategory = null, $recursionLevel = 3)
}

/**
* Get Default Store Id
*
* @return int
*/
protected function _getDefaultStoreId()
Expand All @@ -170,6 +185,8 @@ protected function _getDefaultStoreId()
}

/**
* Get category collection
*
* @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
*/
public function getCategoryCollection()
Expand Down Expand Up @@ -227,6 +244,8 @@ public function getRootByIds($ids)
}

/**
* Get category node for tree
*
* @param mixed $parentNodeCategory
* @param int $recursionLevel
* @return Node
Expand All @@ -249,6 +268,8 @@ public function getNode($parentNodeCategory, $recursionLevel = 2)
}

/**
* Get category save url
*
* @param array $args
* @return string
*/
Expand All @@ -260,6 +281,8 @@ public function getSaveUrl(array $args = [])
}

/**
* Get category edit url
*
* @return string
*/
public function getEditUrl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,38 @@ public function build(Filter $filter): string
$conditionValue = $this->mapConditionValue($conditionType, $filter->getValue());

// NOTE: store scope was ignored intentionally to perform search across all stores
$attributeSelect = $this->resourceConnection->getConnection()
->select()
->from(
[$tableAlias => $attribute->getBackendTable()],
$tableAlias . '.' . $attribute->getEntityIdField()
)->where(
$this->resourceConnection->getConnection()->prepareSqlCondition(
$tableAlias . '.' . $attribute->getIdFieldName(),
['eq' => $attribute->getAttributeId()]
)
)->where(
$this->resourceConnection->getConnection()->prepareSqlCondition(
$tableAlias . '.value',
[$conditionType => $conditionValue]
)
);
if ($conditionType == 'is_null') {
$entityResourceModel = $attribute->getEntity();
$attributeSelect = $this->resourceConnection->getConnection()
->select()
->from(
[Collection::MAIN_TABLE_ALIAS => $entityResourceModel->getEntityTable()],
Collection::MAIN_TABLE_ALIAS . '.' . $entityResourceModel->getEntityIdField()
)->joinLeft(
[$tableAlias => $attribute->getBackendTable()],
$tableAlias . '.' . $attribute->getEntityIdField() . '=' . Collection::MAIN_TABLE_ALIAS .
'.' . $entityResourceModel->getEntityIdField() . ' AND ' . $tableAlias . '.' .
$attribute->getIdFieldName() . '=' . $attribute->getAttributeId(),
''
)->where($tableAlias . '.value is null');
} else {
$attributeSelect = $this->resourceConnection->getConnection()
->select()
->from(
[$tableAlias => $attribute->getBackendTable()],
$tableAlias . '.' . $attribute->getEntityIdField()
)->where(
$this->resourceConnection->getConnection()->prepareSqlCondition(
$tableAlias . '.' . $attribute->getIdFieldName(),
['eq' => $attribute->getAttributeId()]
)
)->where(
$this->resourceConnection->getConnection()->prepareSqlCondition(
$tableAlias . '.value',
[$conditionType => $conditionValue]
)
);
}

return $this->resourceConnection
->getConnection()
Expand All @@ -86,6 +102,8 @@ public function build(Filter $filter): string
}

/**
* Get attribute entity by its code
*
* @param string $field
* @return Attribute
* @throws \Magento\Framework\Exception\LocalizedException
Expand Down
10 changes: 7 additions & 3 deletions app/code/Magento/Catalog/Model/CategoryList.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;

/**
* Class for getting category list.
*/
class CategoryList implements CategoryListInterface
{
/**
Expand Down Expand Up @@ -64,7 +67,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getList(SearchCriteriaInterface $searchCriteria)
{
Expand All @@ -73,10 +76,11 @@ public function getList(SearchCriteriaInterface $searchCriteria)
$this->extensionAttributesJoinProcessor->process($collection);

$this->collectionProcessor->process($searchCriteria, $collection);
$collection->load();

$items = [];
foreach ($collection->getAllIds() as $id) {
$items[] = $this->categoryRepository->get($id);
foreach ($collection->getItems() as $category) {
$items[] = $this->categoryRepository->get($category->getId());
}

/** @var CategorySearchResultsInterface $searchResult */
Expand Down
29 changes: 15 additions & 14 deletions app/code/Magento/Catalog/Model/Product/Attribute/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,28 @@ private function customizeAttributeCode($meta)
*/
private function customizeFrontendLabels($meta)
{
$labelConfigs = [];

foreach ($this->storeRepository->getList() as $store) {
$storeId = $store->getId();

if (!$storeId) {
continue;
}

$meta['manage-titles']['children'] = [
'frontend_label[' . $storeId . ']' => $this->arrayManager->set(
'arguments/data/config',
[],
[
'formElement' => Input::NAME,
'componentType' => Field::NAME,
'label' => $store->getName(),
'dataType' => Text::NAME,
'dataScope' => 'frontend_label[' . $storeId . ']'
]
),
];
$labelConfigs['frontend_label[' . $storeId . ']'] = $this->arrayManager->set(
'arguments/data/config',
[],
[
'formElement' => Input::NAME,
'componentType' => Field::NAME,
'label' => $store->getName(),
'dataType' => Text::NAME,
'dataScope' => 'frontend_label[' . $storeId . ']'
]
);
}
$meta['manage-titles']['children'] = $labelConfigs;

return $meta;
}

Expand Down
Loading

0 comments on commit 97c853b

Please sign in to comment.