Skip to content

Commit cd1eab7

Browse files
author
Karpenko, Oleksandr
committed
Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-53630-2
Conflicts: dev/tests/functional/composer.json
2 parents 7686960 + ab36d41 commit cd1eab7

File tree

87 files changed

+1604
-415
lines changed

Some content is hidden

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

87 files changed

+1604
-415
lines changed

.php_cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ return Symfony\CS\Config\Config::create()
3333
'extra_empty_lines',
3434
'include',
3535
'join_function',
36-
'multiline_array_trailing_comma',
3736
'namespace_no_leading_whitespace',
3837
'new_with_braces',
3938
'object_operator',

app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@
5353
<script type="text/x-magento-init">
5454
{
5555
"#product_addtocart_form": {
56-
"catalogAddToCart": {
57-
"bindSubmit": false
58-
}
56+
"catalogAddToCart": {}
5957
}
6058
}
6159
</script>

app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ define([], function () {
1111
*/
1212
return function (addressData) {
1313
var identifier = Date.now();
14+
var regionId = null;
15+
16+
if (addressData.region && addressData.region.region_id) {
17+
regionId = addressData.region.region_id;
18+
} else if (addressData.country_id && addressData.country_id == window.checkoutConfig.defaultCountryId) {
19+
regionId = window.checkoutConfig.defaultRegionId;
20+
}
1421

1522
return {
1623
email: addressData.email,
1724
countryId: (addressData.country_id) ? addressData.country_id : window.checkoutConfig.defaultCountryId,
18-
regionId: (addressData.region && addressData.region.region_id) ?
19-
addressData.region.region_id
20-
: window.checkoutConfig.defaultRegionId,
25+
regionId: regionId,
2126
regionCode: (addressData.region) ? addressData.region.region_code : null,
2227
region: (addressData.region) ? addressData.region.region : null,
2328
customerId: addressData.customer_id,

app/code/Magento/Cms/Setup/UpgradeData.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,11 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
235235
</div>
236236
EOD;
237237
$privacyAndCookiePolicyPage = $this->createPage()->load(self::PRIVACY_COOKIE_PAGE_ID);
238-
$privacyAndCookiePolicyPage->setContent($newPageContent);
239-
$privacyAndCookiePolicyPage->save();
238+
$privacyAndCookiePolicyPageId = $privacyAndCookiePolicyPage->getId();
239+
if ($privacyAndCookiePolicyPageId) {
240+
$privacyAndCookiePolicyPage->setContent($newPageContent);
241+
$privacyAndCookiePolicyPage->save();
242+
}
240243
}
241244
$setup->endSetup();
242245
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Quote\Model\Product\Plugin;
7+
8+
class RemoveQuoteItems
9+
{
10+
/**
11+
* @var \Magento\Quote\Model\Product\QuoteItemsCleanerInterface
12+
*/
13+
private $quoteItemsCleaner;
14+
15+
/**
16+
* @param \Magento\Quote\Model\Product\QuoteItemsCleanerInterface $quoteItemsCleaner
17+
*/
18+
public function __construct(\Magento\Quote\Model\Product\QuoteItemsCleanerInterface $quoteItemsCleaner)
19+
{
20+
$this->quoteItemsCleaner = $quoteItemsCleaner;
21+
}
22+
23+
/**
24+
* @param \Magento\Catalog\Model\ResourceModel\Product $subject
25+
* @param \Closure $proceed
26+
* @param \Magento\Catalog\Api\Data\ProductInterface $product
27+
* @return mixed
28+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
29+
* TODO: reimplement with after plugin
30+
*/
31+
public function aroundDelete(
32+
\Magento\Catalog\Model\ResourceModel\Product $subject,
33+
\Closure $proceed,
34+
\Magento\Catalog\Api\Data\ProductInterface $product
35+
) {
36+
$result = $proceed($product);
37+
$this->quoteItemsCleaner->execute($product);
38+
return $result;
39+
}
40+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Quote\Model\Product;
7+
8+
class QuoteItemsCleaner implements \Magento\Quote\Model\Product\QuoteItemsCleanerInterface
9+
{
10+
/**
11+
* @var \Magento\Quote\Model\ResourceModel\Quote\Item
12+
*/
13+
private $itemResource;
14+
15+
/**
16+
* @param \Magento\Quote\Model\ResourceModel\Quote\Item $itemResource
17+
*/
18+
public function __construct(\Magento\Quote\Model\ResourceModel\Quote\Item $itemResource)
19+
{
20+
$this->itemResource = $itemResource;
21+
}
22+
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
public function execute(\Magento\Catalog\Api\Data\ProductInterface $product)
27+
{
28+
$this->itemResource->getConnection()->delete(
29+
$this->itemResource->getMainTable(),
30+
'product_id = ' . $product->getId()
31+
);
32+
}
33+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Quote\Model\Product;
7+
8+
use Magento\Catalog\Api\Data\ProductInterface;
9+
10+
interface QuoteItemsCleanerInterface
11+
{
12+
/**
13+
* @param ProductInterface $product
14+
* @return void
15+
*/
16+
public function execute(ProductInterface $product);
17+
}

app/code/Magento/Quote/Setup/InstallSchema.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -964,12 +964,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
964964
$installer->getTable('quote_item'),
965965
'item_id',
966966
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
967-
)->addForeignKey(
968-
$installer->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'),
969-
'product_id',
970-
$installer->getTable('catalog_product_entity'),
971-
'entity_id',
972-
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
973967
)->addForeignKey(
974968
$installer->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'),
975969
'quote_id',

app/code/Magento/Quote/Setup/Recurring.php

Lines changed: 0 additions & 73 deletions
This file was deleted.

app/code/Magento/Quote/Setup/UpgradeSchema.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
4141
]
4242
);
4343
}
44-
44+
//drop foreign key for single DB case
45+
if (version_compare($context->getVersion(), '2.0.3', '<')
46+
&& $setup->tableExists($setup->getTable('quote_item'))
47+
) {
48+
$setup->getConnection()->dropForeignKey(
49+
$setup->getTable('quote_item'),
50+
$setup->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id')
51+
);
52+
}
4553
$setup->endSetup();
4654
}
4755
}

0 commit comments

Comments
 (0)