Skip to content

Commit 45863d7

Browse files
author
Slabko,Michael(mslabko)
committed
Merge pull request #652 from magento-goinc/MAGETWO-36655
[GoIns] S47: Configurable Product, Downloadable Product
2 parents 02e1801 + 8a00e62 commit 45863d7

File tree

111 files changed

+2022
-1912
lines changed

Some content is hidden

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

111 files changed

+2022
-1912
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ $fieldClass .= ($note) ? ' with-note' : '';
2222
$fieldClass .= (!$element->getLabelHtml()) ? ' no-label' : '';
2323

2424
$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
25-
. $block->getUiId('form-field', $element->getId());
25+
. $block->getUiId('form-field', $element->getId())
26+
. ($element->getFieldExtraAttributes() ? ' ' . $element->getFieldExtraAttributes() : '');
2627
?>
2728

2829
<?php if (!$element->getNoDisplay()): ?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public function getTabClass()
6666
*/
6767
protected function _prepareLayout()
6868
{
69+
$this->setData('opened', true);
6970
$this->addChild(
7071
'add_button',
7172
'Magento\Backend\Block\Widget\Button',

app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/SuggestProductTemplates.php

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

app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,29 @@ if(typeof Bundle=='undefined') {
1616

1717
</script>
1818

19-
<div
20-
id="bundle_product_container"
21-
class="entry-edit form-inline">
22-
<div class="fieldset-wrapper admin__collapsible-block-wrapper collapsible-block-wrapper-last" id="bundle_product-wrapper">
23-
<div class="fieldset-wrapper-title">
24-
<strong class="admin__collapsible-title" data-toggle="collapse" data-target="#bundle_product-content">
25-
<span><?php /* @escapeNotVerified */ echo $block->getTabLabel() ?></span>
26-
</strong>
19+
<div id="bundle_product_container" class="entry-edit form-inline">
20+
<fieldset class="fieldset">
21+
<div class="field field-ship-bundle-items">
22+
<label for="shipment_type" class="label"><?php /* @escapeNotVerified */ echo __('Ship Bundle Items') ?></label>
23+
<div class="control">
24+
<select <?php if ($block->isReadonly()): ?>disabled="disabled" <?php endif;?>
25+
id="shipment_type"
26+
name="<?php /* @escapeNotVerified */ echo $block->getFieldSuffix() ?>[shipment_type]"
27+
class="select">
28+
<option value="1"><?php /* @escapeNotVerified */ echo __('Separately') ?></option>
29+
<option value="0"<?php if ($block->getProduct()->getShipmentType() == 0): ?> selected="selected"<?php endif; ?>><?php /* @escapeNotVerified */ echo __('Together') ?></option>
30+
</select>
31+
</div>
2732
</div>
28-
<div class="fieldset-wrapper-content collapse" id="bundle_product-content">
29-
<fieldset class="fieldset">
30-
<div class="field field-ship-bundle-items">
31-
<label for="shipment_type" class="label"><?php /* @escapeNotVerified */ echo __('Ship Bundle Items') ?></label>
32-
<div class="control">
33-
<select <?php if ($block->isReadonly()): ?>disabled="disabled" <?php endif;?>
34-
id="shipment_type"
35-
name="<?php /* @escapeNotVerified */ echo $block->getFieldSuffix() ?>[shipment_type]"
36-
class="select">
37-
<option value="1"><?php /* @escapeNotVerified */ echo __('Separately') ?></option>
38-
<option value="0"<?php if ($block->getProduct()->getShipmentType() == 0): ?> selected="selected"<?php endif; ?>><?php /* @escapeNotVerified */ echo __('Together') ?></option>
39-
</select>
40-
</div>
41-
</div>
4233

43-
<div
44-
id="product_bundle_container"
45-
class="entry-edit custom-options bundle sortable-wrapper">
46-
<?php echo $block->getOptionsBoxHtml() ?>
47-
</div>
48-
49-
<?php echo $block->getAddButtonHtml() ?>
50-
</fieldset>
34+
<div
35+
id="product_bundle_container"
36+
class="entry-edit custom-options bundle sortable-wrapper">
37+
<?php echo $block->getOptionsBoxHtml() ?>
5138
</div>
52-
</div>
39+
40+
<?php echo $block->getAddButtonHtml() ?>
41+
</fieldset>
5342
</div>
5443

5544
<input type="hidden" name="affect_bundle_product_selections" value="1" />

app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,27 @@
7878
}
7979

8080
.field-weight .weight {
81-
width: 140px;
81+
display: inline-block;
8282
margin-right: 15px;
83-
float: left;
83+
vertical-align: top;
84+
width: 140px;
85+
}
86+
87+
.field-weight .weight .admin__control-addon .input-text {
88+
min-width: 10rem;
89+
}
90+
91+
.field-weight .weight .admin__control-addon .input-text,
92+
.field-weight .weight .admin__control-addon .admin__addon-suffix {
93+
flex-basis: 10rem;
94+
}
95+
96+
.ie9 .field-weight .weight .admin__control-addon .input-text {
97+
width: 100px;
98+
}
99+
100+
.weight-switcher .admin__control-addon {
101+
width: 100%;
84102
}
85103

86104
.field-weight .weight .field:first-child {

app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
/*global $H*/
99
define([
1010
"jquery",
11+
"Magento_Catalog/js/product/weight-handler",
1112
"jquery/ui",
1213
"mage/translate",
1314
"Magento_Theme/js/sortable",
1415
"prototype"
15-
], function($){
16+
], function ($, weightHandler) {
1617
'use strict';
1718

1819
$.widget('mage.bundleProduct', {
@@ -188,7 +189,7 @@ define([
188189
return this;
189190
},
190191
_hideProductTypeSwitcher: function () {
191-
$('#weight_and_type_switcher, label[for=weight_and_type_switcher]').hide();
192+
weightHandler.hideWeightSwitcher();
192193
},
193194
_bindCheckboxHandlers: function () {
194195
this._on({

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Customer edit block
99
*
1010
* @author Magento Core Team <[email protected]>
11+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1112
*/
1213
namespace Magento\Catalog\Block\Adminhtml\Product;
1314

@@ -310,7 +311,8 @@ public function getTypeSwitcherData()
310311
return $this->jsonEncoder->encode(
311312
[
312313
'tab_id' => 'product_info_tabs_downloadable_items',
313-
'is_virtual_id' => \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Weight::VIRTUAL_FIELD_HTML_ID,
314+
'weight_switcher' => '[data-role=weight-switcher]',
315+
'product_has_weight_flag' => \Magento\Catalog\Model\Product\Edit\WeightResolver::HAS_WEIGHT,
314316
'weight_id' => 'weight',
315317
'current_type' => $this->getProduct()->getTypeId(),
316318
'attributes' => $this->_getAttributes(),

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ protected function _getAdditionalElementHtml($element)
145145
HTML;
146146
if ($elementId === 'weight') {
147147
$html .= <<<HTML
148-
<script>require(["jquery"],function($) {
149-
$('#weight_and_type_switcher, label[for=weight_and_type_switcher]').hide();
148+
<script>require(['Magento_Catalog/js/product/weight-handler'], function (weightHandle) {
149+
weightHandle.hideWeightSwitcher();
150150
});</script>
151151
HTML;
152152
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* Product Child tab
9+
*/
10+
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab;
11+
12+
class ChildTab extends \Magento\Backend\Block\Template
13+
{
14+
/**
15+
* @var \Magento\Backend\Block\Widget\Tab\TabInterface
16+
*/
17+
protected $tab;
18+
19+
/**
20+
* @param \Magento\Backend\Block\Widget\Tab\TabInterface $tab
21+
* @return $this
22+
*/
23+
public function setTab(\Magento\Backend\Block\Widget\Tab\TabInterface $tab)
24+
{
25+
$this->tab = $tab;
26+
return $this;
27+
}
28+
29+
/**
30+
* @return string
31+
*/
32+
public function getTitle()
33+
{
34+
return $this->tab->getTabTitle();
35+
}
36+
37+
/**
38+
* @return string
39+
*/
40+
public function getContent()
41+
{
42+
return $this->tab->toHtml();
43+
}
44+
45+
/**
46+
* @return string
47+
*/
48+
public function getTabId()
49+
{
50+
return $this->tab->getTabId();
51+
}
52+
53+
/**
54+
* @return bool
55+
*/
56+
public function isTabOpened()
57+
{
58+
return (bool)$this->tab->getData('opened');
59+
}
60+
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,25 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
namespace Magento\Catalog\Block\Adminhtml\Product\Edit;
8+
9+
use Magento\Backend\Block\Template\Context;
10+
use Magento\Backend\Block\Widget\Accordion;
11+
use Magento\Backend\Block\Widget\Tabs as WigetTabs;
12+
use Magento\Backend\Model\Auth\Session;
13+
use Magento\Catalog\Helper\Catalog;
14+
use Magento\Catalog\Helper\Data;
15+
use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory;
16+
use Magento\Framework\Json\EncoderInterface;
17+
use Magento\Framework\Module\Manager;
18+
use Magento\Framework\Registry;
19+
use Magento\Framework\Translate\InlineInterface;
20+
721
/**
822
* Admin product edit tabs
23+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
924
*/
10-
namespace Magento\Catalog\Block\Adminhtml\Product\Edit;
11-
12-
class Tabs extends \Magento\Backend\Block\Widget\Tabs
25+
class Tabs extends WigetTabs
1326
{
1427
const BASIC_TAB_GROUP_CODE = 'basic';
1528

@@ -28,62 +41,62 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
2841
/**
2942
* Core registry
3043
*
31-
* @var \Magento\Framework\Registry
44+
* @var Registry
3245
*/
3346
protected $_coreRegistry = null;
3447

3548
/**
3649
* Catalog data
3750
*
38-
* @var \Magento\Catalog\Helper\Data
51+
* @var Data
3952
*/
4053
protected $_catalogData = null;
4154

4255
/**
4356
* Adminhtml catalog
4457
*
45-
* @var \Magento\Catalog\Helper\Catalog
58+
* @var Catalog
4659
*/
4760
protected $_helperCatalog = null;
4861

4962
/**
50-
* @var \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory
63+
* @var CollectionFactory
5164
*/
5265
protected $_collectionFactory;
5366

5467
/**
55-
* @var \Magento\Framework\Module\Manager
68+
* @var Manager
5669
*/
5770
protected $_moduleManager;
5871

5972
/**
60-
* @var \Magento\Framework\Translate\InlineInterface
73+
* @var InlineInterface
6174
*/
6275
protected $_translateInline;
6376

6477
/**
65-
* @param \Magento\Backend\Block\Template\Context $context
66-
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
67-
* @param \Magento\Backend\Model\Auth\Session $authSession
68-
* @param \Magento\Framework\Module\Manager $moduleManager
69-
* @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory
70-
* @param \Magento\Catalog\Helper\Catalog $helperCatalog
71-
* @param \Magento\Catalog\Helper\Data $catalogData
72-
* @param \Magento\Framework\Registry $registry
73-
* @param \Magento\Framework\Translate\InlineInterface $translateInline
78+
* @param Context $context
79+
* @param EncoderInterface $jsonEncoder
80+
* @param Session $authSession
81+
* @param Manager $moduleManager
82+
* @param CollectionFactory $collectionFactory
83+
* @param Catalog $helperCatalog
84+
* @param Data $catalogData
85+
* @param Registry $registry
86+
* @param InlineInterface $translateInline
7487
* @param array $data
7588
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
7689
*/
7790
public function __construct(
78-
\Magento\Backend\Block\Template\Context $context,
79-
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
80-
\Magento\Backend\Model\Auth\Session $authSession,
81-
\Magento\Framework\Module\Manager $moduleManager,
82-
\Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory,
83-
\Magento\Catalog\Helper\Catalog $helperCatalog,
84-
\Magento\Catalog\Helper\Data $catalogData,
85-
\Magento\Framework\Registry $registry,
86-
\Magento\Framework\Translate\InlineInterface $translateInline,
91+
Context $context,
92+
EncoderInterface $jsonEncoder,
93+
Session $authSession,
94+
Manager $moduleManager,
95+
CollectionFactory $collectionFactory,
96+
Catalog $helperCatalog,
97+
Data $catalogData,
98+
Registry $registry,
99+
InlineInterface $translateInline,
87100
array $data = []
88101
) {
89102
$this->_moduleManager = $moduleManager;
@@ -322,4 +335,19 @@ protected function _translateHtml($html)
322335
$this->_translateInline->processResponseBody($html);
323336
return $html;
324337
}
338+
339+
/**
340+
* @param string $parentTab
341+
* @return string
342+
*/
343+
public function getAccordion($parentTab)
344+
{
345+
$html = '';
346+
foreach ($this->_tabs as $childTab) {
347+
if ($childTab->getParentTab() === $parentTab->getId()) {
348+
$html .= $this->getChildBlock('child-tab')->setTab($childTab)->toHtml();
349+
}
350+
}
351+
return $html;
352+
}
325353
}

0 commit comments

Comments
 (0)