Skip to content

Commit

Permalink
Merge branch 2.3-develop into ENGCOM-4192-magento-magento2-21090
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-engcom-team committed Feb 12, 2019
2 parents 0e43bb8 + 49a25f2 commit 94cf7fe
Show file tree
Hide file tree
Showing 259 changed files with 7,042 additions and 1,294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@

namespace Magento\Backend\Controller\Adminhtml\Dashboard;

class RefreshStatistics extends \Magento\Reports\Controller\Adminhtml\Report\Statistics
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Reports\Controller\Adminhtml\Report\Statistics;

/**
* Refresh Dashboard statistics action.
*/
class RefreshStatistics extends Statistics implements HttpPostActionInterface
{
/**
* @param \Magento\Backend\App\Action\Context $context
Expand All @@ -25,6 +31,8 @@ public function __construct(
}

/**
* Refresh statistics.
*
* @return \Magento\Backend\Model\View\Result\Redirect
*/
public function execute()
Expand Down
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 @@ -8,19 +8,22 @@
namespace Magento\BundleGraphQl\Model;

use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;
use Magento\Bundle\Model\Product\Type as Type;

/**
* {@inheritdoc}
* @inheritdoc
*/
class BundleProductTypeResolver implements TypeResolverInterface
{
const BUNDLE_PRODUCT = 'BundleProduct';

/**
* {@inheritdoc}
* @inheritdoc
*/
public function resolveType(array $data) : string
{
if (isset($data['type_id']) && $data['type_id'] == 'bundle') {
return 'BundleProduct';
if (isset($data['type_id']) && $data['type_id'] == Type::TYPE_CODE) {
return self::BUNDLE_PRODUCT;
}
return '';
}
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 @@ -4,13 +4,13 @@
* See COPYING.txt for license details.
*/

namespace Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset;

/**
* Catalog fieldset element renderer
*
* @author Magento Core Team <core@magentocommerce.com>
*/
namespace Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset;

class Element extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element
{
/**
Expand All @@ -29,7 +29,7 @@ public function getDataObject()
}

/**
* Retireve associated with element attribute object
* Retrieve associated with element attribute object
*
* @return \Magento\Catalog\Model\ResourceModel\Eav\Attribute
*/
Expand Down
21 changes: 17 additions & 4 deletions app/code/Magento/Catalog/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -1119,10 +1119,15 @@ public function reindex()
}
}
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);
if (!$productIndexer->isScheduled()
&& (!empty($this->getAffectedProductIds()) || $this->dataHasChangedFor('is_anchor'))
) {
$productIndexer->reindexList($this->getPathIds());

if (!empty($this->getAffectedProductIds())
|| $this->dataHasChangedFor('is_anchor')
|| $this->dataHasChangedFor('is_active')) {
if (!$productIndexer->isScheduled()) {
$productIndexer->reindexList($this->getPathIds());
} else {
$productIndexer->invalidate();
}
}
}

Expand All @@ -1147,9 +1152,17 @@ public function getIdentities()
$identities = [
self::CACHE_TAG . '_' . $this->getId(),
];

if ($this->hasDataChanges()) {
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $this->getId();
}

if ($this->dataHasChangedFor('is_anchor') || $this->dataHasChangedFor('is_active')) {
foreach ($this->getPathIds() as $id) {
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $id;
}
}

if (!$this->getId() || $this->isDeleted() || $this->dataHasChangedFor(self::KEY_INCLUDE_IN_MENU)) {
$identities[] = self::CACHE_TAG;
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $this->getId();
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
Loading

0 comments on commit 94cf7fe

Please sign in to comment.