Skip to content

Commit 448f749

Browse files
author
Serhiy Shkolyarenko
committed
Merge remote-tracking branch 'mainline/develop' into bugs
2 parents cb2f3e9 + 5c2ce64 commit 448f749

File tree

43 files changed

+3398
-932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3398
-932
lines changed

app/code/Magento/Bundle/Model/Product/Price.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price
4747
* @param \Magento\Framework\Event\ManagerInterface $eventManager
4848
* @param PriceCurrencyInterface $priceCurrency
4949
* @param GroupManagementInterface $groupManagement
50+
* @param \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory
51+
* @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory
52+
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
5053
* @param \Magento\Catalog\Helper\Data $catalogData
54+
*
55+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
5156
*/
5257
public function __construct(
5358
\Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory,
@@ -57,6 +62,9 @@ public function __construct(
5762
\Magento\Framework\Event\ManagerInterface $eventManager,
5863
PriceCurrencyInterface $priceCurrency,
5964
GroupManagementInterface $groupManagement,
65+
\Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory,
66+
\Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory,
67+
\Magento\Framework\App\Config\ScopeConfigInterface $config,
6068
\Magento\Catalog\Helper\Data $catalogData
6169
) {
6270
$this->_catalogData = $catalogData;
@@ -67,7 +75,10 @@ public function __construct(
6775
$customerSession,
6876
$eventManager,
6977
$priceCurrency,
70-
$groupManagement
78+
$groupManagement,
79+
$groupPriceFactory,
80+
$tierPriceFactory,
81+
$config
7182
);
7283
}
7384

app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Bundle\Test\Unit\Model\Product;
77

8+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
9+
810
class PriceTest extends \PHPUnit_Framework_TestCase
911
{
1012
/**
@@ -75,16 +77,26 @@ protected function setUp()
7577
$this->priceCurrency = $this->getMockBuilder('Magento\Framework\Pricing\PriceCurrencyInterface')->getMock();
7678
$this->groupManagement = $this->getMockBuilder('Magento\Customer\Api\GroupManagementInterface')
7779
->getMockForAbstractClass();
78-
79-
$this->model = new \Magento\Bundle\Model\Product\Price(
80-
$this->ruleFactoryMock,
81-
$this->storeManagerMock,
82-
$this->localeDateMock,
83-
$this->customerSessionMock,
84-
$this->eventManagerMock,
85-
$this->priceCurrency,
86-
$this->groupManagement,
87-
$this->catalogHelperMock
80+
$gpFactory = $this->getMock('Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory', [], [], '', false);
81+
$tpFactory = $this->getMock('Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory', [], [], '', false);
82+
$scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface');
83+
84+
$objectManagerHelper = new ObjectManagerHelper($this);
85+
$this->model = $objectManagerHelper->getObject(
86+
'Magento\Bundle\Model\Product\Price',
87+
[
88+
'ruleFactory' => $this->ruleFactoryMock,
89+
'storeManager' => $this->storeManagerMock,
90+
'localeDate' => $this->localeDateMock,
91+
'customerSession' => $this->customerSessionMock,
92+
'eventManager' => $this->eventManagerMock,
93+
'priceCurrency' => $this->priceCurrency,
94+
'groupManagement' => $this->groupManagement,
95+
'groupPriceFactory' => $gpFactory,
96+
'tierPriceFactory' => $tpFactory,
97+
'config' => $scopeConfig,
98+
'catalogData' => $this->catalogHelperMock
99+
]
88100
);
89101
}
90102

app/code/Magento/Catalog/Api/Data/CategoryInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ public function getChildren();
106106
*/
107107
public function getCreatedAt();
108108

109+
/**
110+
* @param string $createdAt
111+
* @return $this
112+
*/
113+
public function setCreatedAt($createdAt);
114+
109115
/**
110116
* @return string|null
111117
*/

app/code/Magento/Catalog/Api/Data/ProductInterface.php

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,79 @@ public function getExtensionAttributes();
229229
* @return $this
230230
*/
231231
public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes);
232+
233+
/**
234+
* Get product links info
235+
*
236+
* @return \Magento\Catalog\Api\Data\ProductLinkInterface[]|null
237+
*/
238+
public function getProductLinks();
239+
240+
/**
241+
* Set product links info
242+
*
243+
* @param \Magento\Catalog\Api\Data\ProductLinkInterface[] $links
244+
* @return $this
245+
*/
246+
public function setProductLinks(array $links = null);
247+
248+
/**
249+
* Get list of product options
250+
*
251+
* @return \Magento\Catalog\Api\Data\ProductCustomOptionInterface[]|null
252+
*/
253+
public function getOptions();
254+
255+
/**
256+
* Set list of product options
257+
*
258+
* @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] $options
259+
* @return $this
260+
*/
261+
public function setOptions(array $options = null);
262+
263+
/**
264+
* Get media gallery entries
265+
*
266+
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null
267+
*/
268+
public function getMediaGalleryEntries();
269+
270+
/**
271+
* Set media gallery entries
272+
*
273+
* @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries
274+
* @return $this
275+
*/
276+
public function setMediaGalleryEntries(array $mediaGalleryEntries = null);
277+
278+
/**
279+
* Gets list of product group prices
280+
*
281+
* @return \Magento\Catalog\Api\Data\ProductGroupPriceInterface[]|null
282+
*/
283+
public function getGroupPrices();
284+
285+
/**
286+
* Sets list of product group prices
287+
*
288+
* @param \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] $groupPrices
289+
* @return $this
290+
*/
291+
public function setGroupPrices(array $groupPrices = null);
292+
293+
/**
294+
* Gets list of product tier prices
295+
*
296+
* @return \Magento\Catalog\Api\Data\ProductTierPriceInterface[]|null
297+
*/
298+
public function getTierPrices();
299+
300+
/**
301+
* Sets list of product tier prices
302+
*
303+
* @param \Magento\Catalog\Api\Data\ProductTierPriceInterface[] $tierPrices
304+
* @return $this
305+
*/
306+
public function setTierPrices(array $tierPrices = null);
232307
}

app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,29 @@
99

1010
use Magento\Framework\Api\ExtensibleDataInterface;
1111

12-
/**
13-
* @todo remove this interface if framework support return array
14-
*/
1512
interface ProductTierPriceInterface extends ExtensibleDataInterface
1613
{
1714
const QTY = 'qty';
1815

1916
const VALUE = 'value';
2017

18+
const CUSTOMER_GROUP_ID = 'customer_group_id';
19+
20+
/**
21+
* Retrieve customer group id
22+
*
23+
* @return int
24+
*/
25+
public function getCustomerGroupId();
26+
27+
/**
28+
* Set customer group id
29+
*
30+
* @param int $customerGroupId
31+
* @return $this
32+
*/
33+
public function setCustomerGroupId($customerGroupId);
34+
2135
/**
2236
* Retrieve tier qty
2337
*

app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ interface ProductAttributeMediaGalleryManagementInterface
1616
/**
1717
* Create new gallery entry
1818
*
19-
* @param \Magento\Catalog\Api\Data\ProductInterface $product
19+
* @param string $sku
20+
* @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry
21+
* @param int $storeId
2022
* @return int gallery entry ID
2123
* @throws \Magento\Framework\Exception\InputException
2224
* @throws \Magento\Framework\Exception\NoSuchEntityException
2325
* @throws \Magento\Framework\Exception\StateException
2426
*/
25-
public function create($product);
27+
public function create(
28+
$sku,
29+
\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry,
30+
$storeId = 0
31+
);
2632

2733
/**
2834
* Update gallery entry

app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface ProductTierPriceManagementInterface
1212
* Create tier price for product
1313
*
1414
* @param string $sku
15-
* @param string $customerGroupId
15+
* @param string $customerGroupId 'all' can be used to specify 'ALL GROUPS'
1616
* @param float $price
1717
* @param float $qty
1818
* @return boolean
@@ -22,10 +22,10 @@ interface ProductTierPriceManagementInterface
2222
public function add($sku, $customerGroupId, $price, $qty);
2323

2424
/**
25-
* Remove tire price from product
25+
* Remove tier price from product
2626
*
2727
* @param string $sku
28-
* @param string $customerGroupId
28+
* @param string $customerGroupId 'all' can be used to specify 'ALL GROUPS'
2929
* @param float $qty
3030
* @return boolean
3131
* @throws \Magento\Framework\Exception\NoSuchEntityException
@@ -34,10 +34,10 @@ public function add($sku, $customerGroupId, $price, $qty);
3434
public function remove($sku, $customerGroupId, $qty);
3535

3636
/**
37-
* Get tire price of product
37+
* Get tier price of product
3838
*
3939
* @param string $sku
40-
* @param string $customerGroupId
40+
* @param string $customerGroupId 'all' can be used to specify 'ALL GROUPS'
4141
* @return \Magento\Catalog\Api\Data\ProductTierPriceInterface[]
4242
* @throws \Magento\Framework\Exception\NoSuchEntityException
4343
*/

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ public function getTemplatesHtml()
278278
public function getOptionValues()
279279
{
280280
$optionsArr = $this->getProduct()->getOptions();
281+
if ($optionsArr == null) {
282+
$optionsArr = [];
283+
}
281284

282285
if (!$this->_values || $this->getIgnoreCaching()) {
283286
$showPrice = $this->getCanReadPrice();

app/code/Magento/Catalog/Model/Category.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
6565
const KEY_POSITION = 'position';
6666
const KEY_LEVEL = 'level';
6767
const KEY_UPDATED_AT = 'updated_at';
68+
const KEY_CREATED_AT = 'created_at';
6869
const KEY_PATH = 'path';
6970
const KEY_AVAILABLE_SORT_BY = 'available_sort_by';
7071
const KEY_INCLUDE_IN_MENU = 'include_in_menu';
@@ -128,6 +129,25 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
128129
'custom_apply_to_products',
129130
];
130131

132+
/**
133+
* Attributes are that part of interface
134+
*
135+
* @var array
136+
*/
137+
protected $interfaceAttributes = [
138+
'id',
139+
self::KEY_PARENT_ID,
140+
self::KEY_NAME,
141+
self::KEY_IS_ACTIVE,
142+
self::KEY_POSITION,
143+
self::KEY_LEVEL,
144+
self::KEY_UPDATED_AT,
145+
self::KEY_CREATED_AT,
146+
self::KEY_AVAILABLE_SORT_BY,
147+
self::KEY_INCLUDE_IN_MENU,
148+
self::KEY_CHILDREN_DATA,
149+
];
150+
131151
/**
132152
* Category tree model
133153
*
@@ -289,6 +309,7 @@ protected function getCustomAttributesCodes()
289309
{
290310
if ($this->customAttributesCodes === null) {
291311
$this->customAttributesCodes = $this->getEavAttributesCodes($this->metadataService);
312+
$this->customAttributesCodes = array_diff($this->customAttributesCodes, $this->interfaceAttributes);
292313
}
293314
return $this->customAttributesCodes;
294315
}
@@ -1296,6 +1317,15 @@ public function setUpdatedAt($updatedAt)
12961317
return $this->setData(self::KEY_UPDATED_AT, $updatedAt);
12971318
}
12981319

1320+
/**
1321+
* @param string $createdAt
1322+
* @return $this
1323+
*/
1324+
public function setCreatedAt($createdAt)
1325+
{
1326+
return $this->setData(self::KEY_CREATED_AT, $createdAt);
1327+
}
1328+
12991329
/**
13001330
* @param string $path
13011331
* @return $this

0 commit comments

Comments
 (0)