Skip to content

Commit e10da53

Browse files
committed
Merge branch 'develop' into MAGETWO-34949
2 parents 3bdd2ef + 2015f5c commit e10da53

File tree

108 files changed

+1039
-346
lines changed

Some content is hidden

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

108 files changed

+1039
-346
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Setup;
7+
8+
use Magento\Framework\Setup\UpgradeDataInterface;
9+
use Magento\Framework\Setup\ModuleContextInterface;
10+
use Magento\Framework\Setup\ModuleDataSetupInterface;
11+
use Magento\Catalog\Model\Category;
12+
13+
/**
14+
* @codeCoverageIgnore
15+
*/
16+
class UpgradeData implements UpgradeDataInterface
17+
{
18+
/**
19+
* @var Category
20+
*/
21+
protected $category;
22+
23+
/**
24+
* @param Category $category
25+
*/
26+
public function __construct(Category $category)
27+
{
28+
$this->category = $category;
29+
}
30+
31+
/**
32+
* {@inheritdoc}
33+
*/
34+
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
35+
{
36+
if (version_compare($context->getVersion(), '2.0.0.2') < 0) {
37+
$newBackendModel = 'Magento\Catalog\Model\Attribute\Backend\Startdate';
38+
$connection = $setup->getConnection();
39+
$connection->startSetup();
40+
$connection->update(
41+
$setup->getTable('eav_attribute'),
42+
['backend_model' => $newBackendModel],
43+
['backend_model = ?' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate']
44+
);
45+
/** @var \Magento\Catalog\Model\Resource\Eav\Attribute $attribute */
46+
foreach ($this->category->getAttributes() as $attribute) {
47+
if ($attribute->getAttributeCode() == 'custom_design_from') {
48+
$attribute->setBackendModel($newBackendModel);
49+
$attribute->save();
50+
break;
51+
}
52+
}
53+
$connection->endSetup();
54+
}
55+
}
56+
}

app/code/Magento/Catalog/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
9-
<module name="Magento_Catalog" setup_version="2.0.0.1">
9+
<module name="Magento_Catalog" setup_version="2.0.0.2">
1010
<sequence>
1111
<module name="Magento_Eav"/>
1212
<module name="Magento_Cms"/>

app/code/Magento/CatalogImportExport/Model/Export/Product.php

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
123123
*/
124124
protected $_attributeTypes = [];
125125

126+
/**
127+
* Product collection
128+
*
129+
* @var \Magento\Catalog\Model\Resource\Product\CollectionFactory
130+
*/
131+
protected $_entityCollectionFactory;
132+
126133
/**
127134
* Product collection
128135
*
@@ -231,7 +238,7 @@ public function __construct(
231238
\Magento\Framework\App\Resource $resource,
232239
\Magento\Store\Model\StoreManagerInterface $storeManager,
233240
\Psr\Log\LoggerInterface $logger,
234-
\Magento\Catalog\Model\Resource\Product\Collection $collection,
241+
\Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory,
235242
\Magento\ImportExport\Model\Export\ConfigInterface $exportConfig,
236243
\Magento\Catalog\Model\Resource\ProductFactory $productFactory,
237244
\Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFactory,
@@ -243,7 +250,7 @@ public function __construct(
243250
\Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider,
244251
\Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer
245252
) {
246-
$this->_entityCollection = $collection;
253+
$this->_entityCollectionFactory = $collectionFactory;
247254
$this->_exportConfig = $exportConfig;
248255
$this->_logger = $logger;
249256
$this->_productFactory = $productFactory;
@@ -669,12 +676,13 @@ protected function setHeaderColumns($customOptionsData, $stockItemRows)
669676
}
670677

671678
/**
672-
* Get product collection
673-
*
674-
* @return \Magento\Catalog\Model\Resource\Product\Collection
679+
* {@inheritdoc}
675680
*/
676-
protected function _getEntityCollection()
681+
protected function _getEntityCollection($resetCollection = false)
677682
{
683+
if ($resetCollection || empty($this->_entityCollection)) {
684+
$this->_entityCollection = $this->_entityCollectionFactory->create();
685+
}
678686
return $this->_entityCollection;
679687
}
680688

@@ -735,23 +743,23 @@ protected function paginateCollection($page, $pageSize)
735743
/**
736744
* Export process
737745
*
738-
* @see https://jira.corp.x.com/browse/MAGETWO-7894
739746
* @return string
740747
*/
741748
public function export()
742749
{
743750
//Execution time may be very long
744751
set_time_limit(0);
745752

746-
$this->_prepareEntityCollection($this->_getEntityCollection());
747-
$this->_getEntityCollection()->setOrder('has_options', 'asc');
748-
$this->_getEntityCollection()->setStoreId(Store::DEFAULT_STORE_ID);
749753
$writer = $this->getWriter();
750754
$page = 0;
751755
while (true) {
752756
++$page;
757+
$entityCollection = $this->_getEntityCollection(true);
758+
$entityCollection->setOrder('has_options', 'asc');
759+
$entityCollection->setStoreId(Store::DEFAULT_STORE_ID);
760+
$this->_prepareEntityCollection($entityCollection);
753761
$this->paginateCollection($page, $this->getItemsPerPage());
754-
if ($this->_getEntityCollection()->count() == 0) {
762+
if ($entityCollection->count() == 0) {
755763
break;
756764
}
757765
$exportData = $this->getExportData();
@@ -761,7 +769,7 @@ public function export()
761769
foreach ($exportData as $dataRow) {
762770
$writer->writeRow($dataRow);
763771
}
764-
if ($this->_getEntityCollection()->getCurPage() >= $this->_getEntityCollection()->getLastPageNumber()) {
772+
if ($entityCollection->getCurPage() >= $entityCollection->getLastPageNumber()) {
765773
break;
766774
}
767775
}

app/code/Magento/Checkout/view/frontend/web/js/action/select-payment-method.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ define(
2121
"paymentMethod": methodData
2222
};
2323

24-
var shippingMethodCode = quote.getSelectedShippingMethod()().split("_"),
24+
var shippingMethodCode = quote.getSelectedShippingMethod()().slice(0).split("_"),
2525
shippingMethodData = {
26-
"shippingCarrierCode" : shippingMethodCode[0],
27-
"shippingMethodCode" : shippingMethodCode[1]
26+
"shippingCarrierCode" : shippingMethodCode.shift(),
27+
"shippingMethodCode" : shippingMethodCode.join('_')
2828
},
2929
serviceUrl;
3030
if (quote.getCheckoutMethod()() === 'guest') {

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-service.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
* Copyright © 2015 Magento. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5-
/*jshint browser:true jquery:true*/
6-
/*global alert*/
5+
/*global define*/
76
define(
87
['ko', 'jquery'],
98
function (ko, $) {
9+
"use strict";
1010
var rates = ko.observable([]);
1111
return {
1212
shippingRates: ko.observableArray([]),
@@ -30,29 +30,34 @@ define(
3030
return this.shippingRates;
3131
},
3232
getTitleByCode: function(methodCodeParts) {
33-
var shippingMethodTitle = '';
34-
if (methodCodeParts) {
35-
$.each(rates(), function (key, entity) {
36-
if (entity['carrier_code'] == methodCodeParts[0]
37-
&& entity['method_code'] == methodCodeParts[1]) {
38-
shippingMethodTitle = entity['carrier_title'] + " - " + entity['method_title'];
39-
}
40-
});
33+
var shippingMethodTitle = '', shippingMethodCode, carrierCode, methodCode;
34+
if (!methodCodeParts) {
35+
return shippingMethodTitle;
4136
}
37+
shippingMethodCode = methodCodeParts.slice(0);
38+
carrierCode = shippingMethodCode.shift();
39+
methodCode = shippingMethodCode.join('_');
40+
$.each(rates(), function (key, entity) {
41+
if (entity['carrier_code'] === carrierCode && entity['method_code'] === methodCode) {
42+
shippingMethodTitle = entity['carrier_title'] + " - " + entity['method_title'];
43+
}
44+
});
4245
return shippingMethodTitle;
4346
},
4447
getRateByCode : function(methodCodeParts) {
45-
var shippingRates = [];
48+
var shippingRates = [],
49+
shippingMethodCode = methodCodeParts.slice(0),
50+
carrierCode = shippingMethodCode.shift(),
51+
methodCode = shippingMethodCode.join('_');
4652
if (methodCodeParts) {
4753
$.each(rates(), function (key, entity) {
48-
if (entity['carrier_code'] == methodCodeParts[0]
49-
&& entity['method_code'] == methodCodeParts[1]) {
54+
if (entity['carrier_code'] === carrierCode && entity['method_code'] === methodCode) {
5055
shippingRates.push(entity);
5156
}
5257
});
5358
}
5459
return shippingRates;
5560
}
56-
}
61+
};
5762
}
5863
);

app/code/Magento/CheckoutAgreements/Api/CheckoutAgreementsRepositoryInterface.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,55 @@
55
*/
66
namespace Magento\CheckoutAgreements\Api;
77

8+
/**
9+
* Interface CheckoutAgreementsRepositoryInterface
10+
* @api
11+
*/
812
interface CheckoutAgreementsRepositoryInterface
913
{
14+
/**
15+
* Return data object for specified checkout agreement ID and store.
16+
*
17+
* @param int $id
18+
* @param int $storeId
19+
* @return \Magento\CheckoutAgreements\Api\Data\AgreementInterface
20+
*/
21+
public function get($id, $storeId = null);
22+
1023
/**
1124
* Lists active checkout agreements.
1225
*
1326
* @return \Magento\CheckoutAgreements\Api\Data\AgreementInterface[]
1427
*/
1528
public function getList();
29+
30+
/**
31+
* Create/Update new checkout agreements with data object values
32+
*
33+
* @param \Magento\CheckoutAgreements\Api\Data\AgreementInterface $data
34+
* @param int $storeId
35+
* @return \Magento\CheckoutAgreements\Api\Data\AgreementInterface
36+
* @throws \Magento\Framework\Exception\CouldNotSaveException If there is a problem with the input
37+
* @throws \Magento\Framework\Exception\NoSuchEntityException If a ID is sent but the entity does not exist
38+
*/
39+
public function save(\Magento\CheckoutAgreements\Api\Data\AgreementInterface $data, $storeId = null);
40+
41+
/**
42+
* Delete checkout agreement
43+
*
44+
* @param \Magento\CheckoutAgreements\Api\Data\AgreementInterface $data
45+
* @return bool
46+
* @throws \Magento\Framework\Exception\CouldNotDeleteException If there is a problem with the input
47+
*/
48+
public function delete(\Magento\CheckoutAgreements\Api\Data\AgreementInterface $data);
49+
50+
/**
51+
* Delete checkout agreement by id
52+
*
53+
* @param int $id
54+
* @return bool
55+
* @throws \Magento\Framework\Exception\NoSuchEntityException If a ID is sent but the entity does not exist
56+
* @throws \Magento\Framework\Exception\CouldNotDeleteException If there is a problem with the input
57+
*/
58+
public function deleteById($id);
1659
}

0 commit comments

Comments
 (0)