Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

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 Sep 18, 2018
2 parents 2311431 + 5f643ef commit a633590
Show file tree
Hide file tree
Showing 39 changed files with 641 additions and 246 deletions.
33 changes: 26 additions & 7 deletions app/code/Magento/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

namespace Magento\Bundle\Model\Product;

use Magento\Framework\App\ObjectManager;
use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections;
use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier;
use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections;

/**
* Bundle Type Model
Expand Down Expand Up @@ -537,7 +537,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,
foreach ($options as $quoteItemOption) {
if ($quoteItemOption->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
if ($optionUpdateFlag) {
$quoteItemOption->setValue(intval($quoteItemOption->getValue()));
$quoteItemOption->setValue((int) $quoteItemOption->getValue());
} else {
$quoteItemOption->setValue($value);
}
Expand Down Expand Up @@ -625,6 +625,7 @@ public function isSalable($product)

/**
* Prepare product and its configuration to be added to some products list.
*
* Perform standard preparation process and then prepare of bundle selections options.
*
* @param \Magento\Framework\DataObject $buyRequest
Expand Down Expand Up @@ -790,6 +791,8 @@ protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $p
}

/**
* Cast array values to int
*
* @param array $array
* @return int[]|int[][]
*/
Expand All @@ -809,6 +812,8 @@ private function recursiveIntval(array $array)
}

/**
* Convert multi dimensional array to flat
*
* @param array $array
* @return int[]
*/
Expand Down Expand Up @@ -920,8 +925,7 @@ public function getOptionsByIds($optionIds, $product)
}

/**
* Prepare additional options/information for order item which will be
* created from this product
* Prepare additional options/information for order item which will be created from this product
*
* @param \Magento\Catalog\Model\Product $product
* @return array
Expand Down Expand Up @@ -987,6 +991,7 @@ public function getOrderOptions($product)

/**
* Sort selections method for usort function
*
* Sort selections by option position, selection position and selection id
*
* @param \Magento\Catalog\Model\Product $firstItem
Expand Down Expand Up @@ -1050,6 +1055,7 @@ public function getForceChildItemQtyChanges($product)

/**
* Retrieve additional searchable data from type instance
*
* Using based on product id and store_id data
*
* @param \Magento\Catalog\Model\Product $product
Expand Down Expand Up @@ -1118,6 +1124,7 @@ public function checkProductBuyState($product)

/**
* Retrieve products divided into groups required to purchase
*
* At least one product in each group has to be purchased
*
* @param \Magento\Catalog\Model\Product $product
Expand Down Expand Up @@ -1214,6 +1221,8 @@ public function getIdentities(\Magento\Catalog\Model\Product $product)
}

/**
* Returns selection qty
*
* @param \Magento\Framework\DataObject $selection
* @param int[] $qtys
* @param int $selectionOptionId
Expand All @@ -1232,6 +1241,8 @@ protected function getQty($selection, $qtys, $selectionOptionId)
}

/**
* Returns qty
*
* @param \Magento\Catalog\Model\Product $product
* @param \Magento\Framework\DataObject $selection
* @return float|int
Expand All @@ -1249,6 +1260,8 @@ protected function getBeforeQty($product, $selection)
}

/**
* Validate required options
*
* @param \Magento\Catalog\Model\Product $product
* @param bool $isStrictProcessMode
* @param \Magento\Bundle\Model\ResourceModel\Option\Collection $optionsCollection
Expand All @@ -1270,6 +1283,8 @@ protected function checkIsAllRequiredOptions($product, $isStrictProcessMode, $op
}

/**
* Check if selection is salable
*
* @param \Magento\Bundle\Model\ResourceModel\Selection\Collection $selections
* @param bool $skipSaleableCheck
* @param \Magento\Bundle\Model\ResourceModel\Option\Collection $optionsCollection
Expand Down Expand Up @@ -1300,6 +1315,8 @@ protected function checkSelectionsIsSale($selections, $skipSaleableCheck, $optio
}

/**
* Validate result
*
* @param array $_result
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
Expand All @@ -1318,6 +1335,8 @@ protected function checkIsResult($_result)
}

/**
* Merge selections with options
*
* @param \Magento\Catalog\Model\Product\Option[] $options
* @param \Magento\Framework\DataObject[] $selections
* @return \Magento\Framework\DataObject[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function getCacheKeyInfo()
[
$this->getDisplayType(),
$this->getProductsPerPage(),
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
(int) $this->getRequest()->getParam($this->getData('page_var_name'), 1),
$this->serializer->serialize($this->getRequest()->getParams())
]
);
Expand Down
51 changes: 46 additions & 5 deletions app/code/Magento/Catalog/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected function _construct()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function getCustomAttributesCodes()
{
Expand All @@ -312,6 +312,8 @@ protected function getCustomAttributesCodes()
}

/**
* Returns model resource
*
* @throws \Magento\Framework\Exception\LocalizedException
* @return \Magento\Catalog\Model\ResourceModel\Category
* @deprecated because resource models should be used directly
Expand Down Expand Up @@ -648,6 +650,8 @@ public function formatUrlKey($str)
}

/**
* Returns image url
*
* @param string $attributeCode
* @return bool|string
* @throws \Magento\Framework\Exception\LocalizedException
Expand Down Expand Up @@ -708,7 +712,7 @@ public function getParentId()
return $parentId;
}
$parentIds = $this->getParentIds();
return intval(array_pop($parentIds));
return (int) array_pop($parentIds);
}

/**
Expand Down Expand Up @@ -796,6 +800,7 @@ public function getChildren($recursive = false, $isActive = true, $sortByPositio

/**
* Retrieve Stores where isset category Path
*
* Return comma separated string
*
* @return string
Expand Down Expand Up @@ -826,6 +831,7 @@ public function checkId($id)

/**
* Get array categories ids which are part of category path
*
* Result array contain id of current category because it is part of the path
*
* @return array
Expand Down Expand Up @@ -1029,7 +1035,8 @@ public function getAvailableSortBy()

/**
* Retrieve Available Product Listing Sort By
* code as key, value - name
*
* Code as key, value - name
*
* @return array
*/
Expand Down Expand Up @@ -1150,6 +1157,8 @@ public function getIdentities()
}

/**
* Returns path
*
* @codeCoverageIgnoreStart
* @return string|null
*/
Expand All @@ -1159,6 +1168,8 @@ public function getPath()
}

/**
* Returns position
*
* @return int|null
*/
public function getPosition()
Expand All @@ -1167,6 +1178,8 @@ public function getPosition()
}

/**
* Returns children count
*
* @return int
*/
public function getChildrenCount()
Expand All @@ -1175,6 +1188,8 @@ public function getChildrenCount()
}

/**
* Returns created at
*
* @return string|null
*/
public function getCreatedAt()
Expand All @@ -1183,6 +1198,8 @@ public function getCreatedAt()
}

/**
* Returns updated at
*
* @return string|null
*/
public function getUpdatedAt()
Expand All @@ -1191,6 +1208,8 @@ public function getUpdatedAt()
}

/**
* Returns is active
*
* @return bool
* @SuppressWarnings(PHPMD.BooleanGetMethodName)
*/
Expand All @@ -1200,6 +1219,8 @@ public function getIsActive()
}

/**
* Returns category id
*
* @return int|null
*/
public function getCategoryId()
Expand All @@ -1208,6 +1229,8 @@ public function getCategoryId()
}

/**
* Returns display mode
*
* @return string|null
*/
public function getDisplayMode()
Expand All @@ -1216,6 +1239,8 @@ public function getDisplayMode()
}

/**
* Returns is include in menu
*
* @return bool|null
*/
public function getIncludeInMenu()
Expand All @@ -1224,6 +1249,8 @@ public function getIncludeInMenu()
}

/**
* Returns url key
*
* @return string|null
*/
public function getUrlKey()
Expand All @@ -1232,6 +1259,8 @@ public function getUrlKey()
}

/**
* Returns children data
*
* @return \Magento\Catalog\Api\Data\CategoryTreeInterface[]|null
*/
public function getChildrenData()
Expand Down Expand Up @@ -1347,6 +1376,8 @@ public function setLevel($level)
}

/**
* Set updated at
*
* @param string $updatedAt
* @return $this
*/
Expand All @@ -1356,6 +1387,8 @@ public function setUpdatedAt($updatedAt)
}

/**
* Set created at
*
* @param string $createdAt
* @return $this
*/
Expand All @@ -1365,6 +1398,8 @@ public function setCreatedAt($createdAt)
}

/**
* Set path
*
* @param string $path
* @return $this
*/
Expand All @@ -1374,6 +1409,8 @@ public function setPath($path)
}

/**
* Set available sort by
*
* @param string[]|string $availableSortBy
* @return $this
*/
Expand All @@ -1383,6 +1420,8 @@ public function setAvailableSortBy($availableSortBy)
}

/**
* Set include in menu
*
* @param bool $includeInMenu
* @return $this
*/
Expand All @@ -1403,6 +1442,8 @@ public function setProductCount($productCount)
}

/**
* Set children data
*
* @param \Magento\Catalog\Api\Data\CategoryTreeInterface[] $childrenData
* @return $this
*/
Expand All @@ -1412,7 +1453,7 @@ public function setChildrenData(array $childrenData = null)
}

/**
* {@inheritdoc}
* @inheritdoc
*
* @return \Magento\Catalog\Api\Data\CategoryExtensionInterface|null
*/
Expand All @@ -1422,7 +1463,7 @@ public function getExtensionAttributes()
}

/**
* {@inheritdoc}
* @inheritdoc
*
* @param \Magento\Catalog\Api\Data\CategoryExtensionInterface $extensionAttributes
* @return $this
Expand Down
Loading

0 comments on commit a633590

Please sign in to comment.