Skip to content

Commit d591463

Browse files
Merge branch 'develop' of https://github.com/magento/magento2ce into MAGETWO-64223
2 parents 71c0d96 + c993777 commit d591463

File tree

51 files changed

+2274
-142
lines changed

Some content is hidden

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

51 files changed

+2274
-142
lines changed

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

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Api\Data\ProductAttributeInterface;
99
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
10+
use Magento\Eav\Model\Entity\AttributeCache;
1011
use Magento\Framework\Setup\UpgradeDataInterface;
1112
use Magento\Framework\Setup\ModuleContextInterface;
1213
use Magento\Framework\Setup\ModuleDataSetupInterface;
@@ -34,16 +35,26 @@ class UpgradeData implements UpgradeDataInterface
3435
*/
3536
private $eavSetupFactory;
3637

38+
/**
39+
* @var AttributeCache
40+
*/
41+
private $attributeCache;
42+
3743
/**
3844
* Init
3945
*
4046
* @param CategorySetupFactory $categorySetupFactory
4147
* @param EavSetupFactory $eavSetupFactory
48+
* @param AttributeCache $attributeCache
4249
*/
43-
public function __construct(CategorySetupFactory $categorySetupFactory, EavSetupFactory $eavSetupFactory)
44-
{
50+
public function __construct(
51+
CategorySetupFactory $categorySetupFactory,
52+
EavSetupFactory $eavSetupFactory,
53+
AttributeCache $attributeCache
54+
) {
4555
$this->categorySetupFactory = $categorySetupFactory;
4656
$this->eavSetupFactory = $eavSetupFactory;
57+
$this->attributeCache = $attributeCache;
4758
}
4859

4960
/**
@@ -135,19 +146,24 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
135146
}
136147

137148
if (version_compare($context->getVersion(), '2.0.4') < 0) {
149+
$mediaBackendType = 'static';
150+
$mediaBackendModel = null;
138151
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
139152
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
140153
$categorySetup->updateAttribute(
141154
'catalog_product',
142155
'media_gallery',
143156
'backend_type',
144-
'static'
157+
$mediaBackendType
145158
);
146159
$categorySetup->updateAttribute(
147160
'catalog_product',
148161
'media_gallery',
149-
'backend_model'
162+
'backend_model',
163+
$mediaBackendModel
150164
);
165+
166+
$this->changeMediaGalleryAttributeInCache($mediaBackendType, $mediaBackendModel);
151167
}
152168

153169
if (version_compare($context->getVersion(), '2.0.5', '<')) {
@@ -340,10 +356,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
340356
]
341357
);
342358
}
343-
359+
344360
if (version_compare($context->getVersion(), '2.0.7') < 0) {
345361
/** @var EavSetup $eavSetup */
346-
$eavSetup= $this->eavSetupFactory->create(['setup' => $setup]);
362+
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
347363

348364
$eavSetup->updateAttribute(
349365
ProductAttributeInterface::ENTITY_TYPE_CODE,
@@ -381,4 +397,25 @@ private function changePriceAttributeDefaultScope($categorySetup)
381397

382398
}
383399
}
400+
401+
/**
402+
* @param string $mediaBackendType
403+
* @param string $mediaBackendModel
404+
* @return void
405+
*/
406+
private function changeMediaGalleryAttributeInCache($mediaBackendType, $mediaBackendModel)
407+
{
408+
// need to do, because media_gallery has backend model in cache.
409+
$catalogProductAttributes = $this->attributeCache->getAttributes('catalog_product', '0-0');
410+
411+
if (is_array($catalogProductAttributes)) {
412+
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $catalogProductAttribute */
413+
foreach ($catalogProductAttributes as $catalogProductAttribute) {
414+
if ($catalogProductAttribute->getAttributeCode() == 'media_gallery') {
415+
$catalogProductAttribute->setBackendModel($mediaBackendModel);
416+
$catalogProductAttribute->setBackendType($mediaBackendType);
417+
}
418+
}
419+
}
420+
}
384421
}

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ window.setRowVisibility = setRowVisibility;
337337
window.showDefaultRows = showDefaultRows;
338338
window.switchDefaultValueField = switchDefaultValueField;
339339
window.switchIsFilterable = switchIsFilterable;
340-
window.switchIsFilterable = switchIsFilterable;
341340
window.bindAttributeInputType = bindAttributeInputType;
342341
window.checkOptionsPanelVisibility = checkOptionsPanelVisibility;
343342
window.getFrontTab = getFrontTab;

app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
<?php echo($block->getPriceDisplayLabel()) ? 'data-label="' . $block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes() . '"' : '' ?>
2020
data-price-amount="<?php /* @escapeNotVerified */ echo $block->getDisplayValue(); ?>"
2121
data-price-type="<?php /* @escapeNotVerified */ echo $block->getPriceType(); ?>"
22-
class="price-wrapper <?php /* @escapeNotVerified */ echo $block->getPriceWrapperCss(); ?>"
23-
<?php echo $block->getSchema() ? ' itemprop="price"' : '' ?>>
22+
class="price-wrapper <?php /* @escapeNotVerified */ echo $block->getPriceWrapperCss(); ?>">
2423
<?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>
2524
</span>
2625
<?php if ($block->hasAdjustmentsHtml()): ?>
2726
<?php echo $block->getAdjustmentsHtml() ?>
2827
<?php endif; ?>
2928
<?php if ($block->getSchema()): ?>
29+
<meta itemprop="price" content="<?php /* @escapeNotVerified */ echo $block->getDisplayValue(); ?>" />
3030
<meta itemprop="priceCurrency" content="<?php /* @escapeNotVerified */ echo $block->getDisplayCurrencyCode()?>" />
3131
<?php endif; ?>
3232
</span>

app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ define([
5757

5858
return Component.extend({
5959
defaults: {
60-
template: 'Magento_Checkout/shipping'
60+
template: 'Magento_Checkout/shipping',
61+
shippingFormTemplate: 'Magento_Checkout/shipping-address/form',
62+
shippingMethodListTemplate: 'Magento_Checkout/shipping-address/shipping-method-list',
63+
shippingMethodItemTemplate: 'Magento_Checkout/shipping-address/shipping-method-item'
6164
},
6265
visible: ko.observable(!quote.isVirtual()),
6366
errorValidationMessage: ko.observable(false),
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!--
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<tr class="row"
8+
click="element.selectShippingMethod">
9+
<td class="col col-method">
10+
<input type="radio"
11+
class="radio"
12+
ifnot="method.error_message"
13+
ko-checked="element.isSelected"
14+
ko-value="method.carrier_code + '_' + method.method_code"
15+
attr="'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code,
16+
'checked': element.rates().length == 1 || element.isSelected" />
17+
</td>
18+
<td class="col col-price">
19+
<each args="element.getRegion('price')" render="" />
20+
</td>
21+
<td class="col col-method"
22+
attr="'id': 'label_method_' + method.method_code + '_' + method.carrier_code"
23+
text="method.method_title" />
24+
<td class="col col-carrier"
25+
attr="'id': 'label_carrier_' + method.method_code + '_' + method.carrier_code"
26+
text="method.carrier_title" />
27+
</tr>
28+
<tr class="row row-error"
29+
if="method.error_message">
30+
<td class="col col-error" colspan="4">
31+
<div role="alert" class="message error">
32+
<div text="method.error_message"></div>
33+
</div>
34+
<span class="no-display">
35+
<input type="radio"
36+
attr="'value' : method.method_code, 'id': 's_method_' + method.method_code" />
37+
</span>
38+
</td>
39+
</tr>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<div id="checkout-shipping-method-load">
8+
<table class="table-checkout-shipping-method">
9+
<thead>
10+
<tr class="row">
11+
<th class="col col-method" translate="'Select Method'"></th>
12+
<th class="col col-price" translate="'Price'"></th>
13+
<th class="col col-method" translate="'Method Title'"></th>
14+
<th class="col col-carrier" translate="'Carrier Title'"></th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
<!-- ko foreach: { data: rates(), as: 'method'} -->
19+
<!--ko template: { name: element.shippingMethodItemTemplate} --><!-- /ko -->
20+
<!-- /ko -->
21+
</tbody>
22+
</table>
23+
</div>

app/code/Magento/Checkout/view/frontend/web/template/shipping.html

Lines changed: 38 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -5,155 +5,79 @@
55
*/
66
-->
77
<li id="shipping" class="checkout-shipping-address" data-bind="fadeVisible: visible()">
8-
<div class="step-title" data-bind="i18n: 'Shipping Address'" data-role="title"></div>
8+
<div class="step-title" translate="'Shipping Address'" data-role="title" />
99
<div id="checkout-step-shipping"
1010
class="step-content"
1111
data-role="content">
1212

13-
<!-- ko if: (!quoteIsVirtual) -->
14-
<!-- ko foreach: getRegion('customer-email') -->
15-
<!-- ko template: getTemplate() --><!-- /ko -->
16-
<!--/ko-->
17-
<!--/ko-->
18-
19-
<!-- ko foreach: getRegion('address-list') -->
20-
<!-- ko template: getTemplate() --><!-- /ko -->
21-
<!--/ko-->
22-
23-
<!-- ko foreach: getRegion('address-list-additional-addresses') -->
24-
<!-- ko template: getTemplate() --><!-- /ko -->
25-
<!--/ko-->
13+
<each if="!quoteIsVirtual" args="getRegion('customer-email')" render="" />
14+
<each args="getRegion('address-list')" render="" />
15+
<each args="getRegion('address-list-additional-addresses')" render="" />
2616

2717
<!-- Address form pop up -->
28-
<!-- ko if: (!isFormInline) -->
29-
<button type="button"
30-
data-bind="click: showFormPopUp, visible: !isNewAddressAdded()"
31-
class="action action-show-popup">
32-
<span data-bind="i18n: 'New Address'"></span></button>
33-
<div id="opc-new-shipping-address" data-bind="visible: isFormPopUpVisible()">
34-
<!-- ko template: 'Magento_Checkout/shipping-address/form' --><!-- /ko -->
35-
</div>
36-
<!-- /ko -->
18+
<if args="!isFormInline">
19+
<button type="button"
20+
class="action action-show-popup"
21+
click="showFormPopUp"
22+
visible="!isNewAddressAdded()">
23+
<span translate="'New Address'" />
24+
</button>
25+
<div id="opc-new-shipping-address"
26+
visible="isFormPopUpVisible()"
27+
render="shippingFormTemplate" />
28+
</if>
3729

38-
<!-- ko foreach: getRegion('before-form') -->
39-
<!-- ko template: getTemplate() --><!-- /ko -->
40-
<!--/ko-->
30+
<each args="getRegion('before-form')" render="" />
4131

4232
<!-- Inline address form -->
43-
<!-- ko if: (isFormInline) -->
44-
<!-- ko template: 'Magento_Checkout/shipping-address/form' --><!-- /ko -->
45-
<!-- /ko -->
33+
<render if="isFormInline" args="shippingFormTemplate" />
4634
</div>
4735
</li>
4836

49-
5037
<!--Shipping method template-->
5138
<li id="opc-shipping_method"
5239
class="checkout-shipping-method"
5340
data-bind="fadeVisible: visible(), blockLoader: isLoading"
5441
role="presentation">
5542
<div class="checkout-shipping-method">
56-
<div class="step-title" data-bind="i18n: 'Shipping Methods'" data-role="title"></div>
57-
<!-- ko foreach: getRegion('before-shipping-method-form') -->
58-
<!-- ko template: getTemplate() --><!-- /ko -->
59-
<!-- /ko -->
43+
<div class="step-title"
44+
translate="'Shipping Methods'"
45+
data-role="title" />
46+
47+
<each args="getRegion('before-shipping-method-form')" render="" />
48+
6049
<div id="checkout-step-shipping_method"
6150
class="step-content"
6251
data-role="content"
6352
role="tabpanel"
6453
aria-hidden="false">
65-
<!-- ko if: rates().length -->
66-
<form class="form methods-shipping" id="co-shipping-method-form" data-bind="submit: setShippingInformation" novalidate="novalidate">
67-
<div id="checkout-shipping-method-load">
68-
<table class="table-checkout-shipping-method">
69-
<thead>
70-
<tr class="row">
71-
<th class="col col-method" data-bind="i18n: 'Select Method'"></th>
72-
<th class="col col-price" data-bind="i18n: 'Price'"></th>
73-
<th class="col col-method" data-bind="i18n: 'Method Title'"></th>
74-
<th class="col col-carrier" data-bind="i18n: 'Carrier Title'"></th>
75-
</tr>
76-
</thead>
77-
<tbody>
54+
<form id="co-shipping-method-form"
55+
class="form methods-shipping"
56+
if="rates().length"
57+
submit="setShippingInformation"
58+
novalidate="novalidate">
7859

79-
<!--ko foreach: { data: rates(), as: 'method'}-->
80-
<tr class="row" data-bind="click: $parent.selectShippingMethod">
81-
<td class="col col-method">
82-
<!-- ko ifnot: method.error_message -->
83-
<!-- ko if: $parent.rates().length == 1 -->
84-
<input class="radio"
85-
type="radio"
86-
data-bind="attr: {
87-
checked: $parent.rates().length == 1,
88-
'value' : method.carrier_code + '_' + method.method_code,
89-
'id': 's_method_' + method.method_code,
90-
'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code
91-
}" />
92-
<!-- /ko -->
93-
<!--ko ifnot: ($parent.rates().length == 1)-->
94-
<input type="radio"
95-
data-bind="
96-
value: method.carrier_code + '_' + method.method_code,
97-
checked: $parent.isSelected,
98-
attr: {
99-
'id': 's_method_' + method.carrier_code + '_' + method.method_code,
100-
'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code
101-
}"
102-
class="radio"/>
103-
<!--/ko-->
104-
<!-- /ko -->
105-
</td>
106-
<td class="col col-price">
107-
<!-- ko foreach: $parent.getRegion('price') -->
108-
<!-- ko template: getTemplate() --><!-- /ko -->
109-
<!-- /ko -->
110-
</td>
111-
112-
<td class="col col-method"
113-
data-bind="text: method.method_title, attr: {'id': 'label_method_' + method.method_code + '_' + method.carrier_code}"></td>
114-
115-
<td class="col col-carrier"
116-
data-bind="text: method.carrier_title, attr: {'id': 'label_carrier_' + method.method_code + '_' + method.carrier_code}"></td>
117-
</tr>
118-
119-
<!-- ko if: method.error_message -->
120-
<tr class="row row-error">
121-
<td class="col col-error" colspan="4">
122-
<div role="alert" class="message error">
123-
<div data-bind="text: method.error_message"></div>
124-
</div>
125-
<span class="no-display">
126-
<input type="radio" data-bind="attr: {'value' : method.method_code, 'id': 's_method_' + method.method_code}"/>
127-
</span>
128-
</td>
129-
</tr>
130-
<!-- /ko -->
131-
132-
<!-- /ko -->
133-
</tbody>
134-
</table>
135-
</div>
60+
<render args="shippingMethodListTemplate"/>
13661

13762
<div id="onepage-checkout-shipping-method-additional-load">
138-
<!-- ko foreach: getRegion('shippingAdditional') -->
139-
<!-- ko template: getTemplate() --><!-- /ko -->
140-
<!-- /ko -->
63+
<each args="getRegion('shippingAdditional')" render="" />
14164
</div>
142-
<!-- ko if: errorValidationMessage().length > 0 -->
143-
<div role="alert" class="message notice">
144-
<span><!-- ko text: errorValidationMessage()--><!-- /ko --></span>
65+
<div role="alert"
66+
if="errorValidationMessage().length"
67+
class="message notice">
68+
<span text="errorValidationMessage()" />
14569
</div>
146-
<!-- /ko -->
14770
<div class="actions-toolbar" id="shipping-method-buttons-container">
14871
<div class="primary">
14972
<button data-role="opc-continue" type="submit" class="button action continue primary">
150-
<span><!-- ko i18n: 'Next'--><!-- /ko --></span>
73+
<span translate="'Next'" />
15174
</button>
15275
</div>
15376
</div>
15477
</form>
155-
<!-- /ko -->
156-
<!-- ko ifnot: rates().length > 0 --><div class="no-quotes-block"><!-- ko i18n: 'Sorry, no quotes are available for this order at this time'--><!-- /ko --></div><!-- /ko -->
78+
<div class="no-quotes-block"
79+
ifnot="rates().length > 0"
80+
translate="'Sorry, no quotes are available for this order at this time'" />
15781
</div>
15882
</div>
15983
</li>

0 commit comments

Comments
 (0)