Skip to content

Commit

Permalink
[EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
 - merged latest code from mainline branch
  • Loading branch information
magento-engcom-team authored Feb 12, 2019
2 parents 922ea7b + 49a25f2 commit 27c46aa
Show file tree
Hide file tree
Showing 164 changed files with 4,819 additions and 564 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 @@ -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
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
22 changes: 13 additions & 9 deletions app/code/Magento/Catalog/Model/Product/Option/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use Magento\Framework\App\ObjectManager;

/**
* Product custom options repository
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Repository implements \Magento\Catalog\Api\ProductCustomOptionRepositoryInterface
Expand Down Expand Up @@ -83,7 +85,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getList($sku)
{
Expand All @@ -92,7 +94,7 @@ public function getList($sku)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getProductOptions(ProductInterface $product, $requiredOnly = false)
{
Expand All @@ -104,7 +106,7 @@ public function getProductOptions(ProductInterface $product, $requiredOnly = fal
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function get($sku, $optionId)
{
Expand All @@ -117,7 +119,7 @@ public function get($sku, $optionId)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function delete(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $entity)
{
Expand All @@ -126,7 +128,7 @@ public function delete(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $e
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function duplicate(
\Magento\Catalog\Api\Data\ProductInterface $product,
Expand All @@ -142,7 +144,7 @@ public function duplicate(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $option)
{
Expand Down Expand Up @@ -184,7 +186,7 @@ public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $opt
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function deleteByIdentifier($sku, $optionId)
{
Expand All @@ -209,8 +211,8 @@ public function deleteByIdentifier($sku, $optionId)
/**
* Mark original values for removal if they are absent among new values
*
* @param $newValues array
* @param $originalValues \Magento\Catalog\Model\Product\Option\Value[]
* @param array $newValues
* @param \Magento\Catalog\Model\Product\Option\Value[] $originalValues
* @return array
*/
protected function markRemovedValues($newValues, $originalValues)
Expand All @@ -234,6 +236,8 @@ protected function markRemovedValues($newValues, $originalValues)
}

/**
* Get hydrator pool
*
* @return \Magento\Framework\EntityManager\HydratorPool
* @deprecated 101.0.0
*/
Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/Catalog/Model/Product/Option/SaveHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ public function __construct(
}

/**
* Perform action on relation/extension attribute
*
* @param object $entity
* @param array $arguments
* @return \Magento\Catalog\Api\Data\ProductInterface|object
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function execute($entity, $arguments = [])
{
if ($entity->getOptionsSaved()) {
return $entity;
}

$options = $entity->getOptions();
$optionIds = [];

Expand Down
Loading

0 comments on commit 27c46aa

Please sign in to comment.