31 private static $groupContent =
'content';
36 private static $sortOrder = 30;
51 private $dataScopeName;
56 private $dataSourceName;
61 private $associatedListingPrefix;
82 $associatedListingPrefix =
'' 84 $this->locator = $locator;
85 $this->urlBuilder = $urlBuilder;
86 $this->formName = $formName;
87 $this->dataScopeName = $dataScopeName;
88 $this->dataSourceName = $dataSourceName;
89 $this->associatedListingPrefix = $associatedListingPrefix;
106 $meta = array_merge_recursive(
109 static::GROUP_CONFIGURABLE => [
113 'label' =>
__(
'Configurations'),
114 'collapsible' =>
true,
116 'componentType' =>
Form\Fieldset::NAME,
127 static::ASSOCIATED_PRODUCT_MODAL => [
133 'provider' => $this->dataSourceName,
135 'title' =>
__(
'Select Associated Product'),
138 'text' =>
__(
'Done'),
139 'class' =>
'action-primary',
142 'targetName' =>
'ns= ' . $this->associatedListingPrefix
143 . static::ASSOCIATED_PRODUCT_LISTING
144 .
', index=' . static::ASSOCIATED_PRODUCT_LISTING,
145 'actionName' =>
'save' 156 'information-block1' => [
161 'component' =>
'Magento_Ui/js/form/components/html',
162 'additionalClasses' =>
'message message-notice',
164 'Choose a new product to delete and replace' 165 .
' the current product configuration.' 168 'visible' =>
'!ns = ${ $.ns }, index = ' 175 'information-block2' => [
180 'component' =>
'Magento_Ui/js/form/components/html',
181 'additionalClasses' =>
'message message-notice',
183 'For better results, add attributes and attribute values to your products.' 186 'visible' =>
'ns = ${ $.ns }, index = ' 193 static::ASSOCIATED_PRODUCT_LISTING => [
197 'autoRender' =>
false,
198 'componentType' =>
'insertListing',
199 'component' =>
'Magento_ConfigurableProduct/js' 200 .
'/components/associated-product-insert-listing',
201 'dataScope' => $this->associatedListingPrefix
202 . static::ASSOCIATED_PRODUCT_LISTING,
203 'externalProvider' => $this->associatedListingPrefix
204 . static::ASSOCIATED_PRODUCT_LISTING .
'.data_source',
205 'selectionsProvider' => $this->associatedListingPrefix
206 . static::ASSOCIATED_PRODUCT_LISTING .
'.' 207 . $this->associatedListingPrefix
208 . static::ASSOCIATED_PRODUCT_LISTING .
'.product_columns.ids',
209 'ns' => $this->associatedListingPrefix . static::ASSOCIATED_PRODUCT_LISTING,
210 'render_url' => $this->urlBuilder->getUrl(
'mui/index/render'),
211 'realTimeLink' =>
true,
212 'behaviourType' =>
'simple',
213 'externalFilterMode' =>
false,
214 'currentProductId' => $this->locator->getProduct()->getId(),
219 'changeProductProvider' =>
'change_product',
220 'productsProvider' => $this->associatedListingPrefix
221 .
'configurable_associated_product_listing.data_source',
222 'productsColumns' => $this->associatedListingPrefix
223 .
'configurable_associated_product_listing' 224 .
'.' . $this->associatedListingPrefix
225 .
'configurable_associated_product_listing.product_columns',
226 'productsMassAction' => $this->associatedListingPrefix
227 .
'configurable_associated_product_listing' 228 .
'.' . $this->associatedListingPrefix
229 .
'configurable_associated_product_listing.product_columns.ids',
230 'modalWithGrid' =>
'ns=' . $this->formName .
', index=' 231 . static::ASSOCIATED_PRODUCT_MODAL,
232 'productsFilters' => $this->associatedListingPrefix
233 .
'configurable_associated_product_listing' 234 .
'.' . $this->associatedListingPrefix
235 .
'configurable_associated_product_listing.listing_top.listing_filters',
256 'configurable_products_button_set' => $this->
getButtonSet(),
257 'configurable-matrix' => $this->
getGrid(),
272 'component' =>
'Magento_ConfigurableProduct/js/components/container-configurable-handler',
273 'formElement' =>
'container',
274 'componentType' =>
'container',
277 'Configurable products allow customers to choose options ' 278 .
'(Ex: shirt color). You need to create a simple product for each ' 279 .
'configuration (Ex: a product for each color).' 282 'Configurations cannot be created for a standard product with downloadable files. ' 283 .
'To create configurations, first remove all downloadable files.' 285 'template' =>
'ui/form/components/complex',
286 'createConfigurableButton' =>
'ns = ${ $.ns }, index = create_configurable_products_button',
291 'add_products_manually_button' => [
295 'formElement' =>
'container',
296 'componentType' =>
'container',
297 'component' =>
'Magento_Ui/js/form/components/button',
298 'displayAsLink' =>
true,
301 'targetName' =>
'ns=' . $this->formName .
', index=' 302 . static::ASSOCIATED_PRODUCT_MODAL,
303 'actionName' =>
'openModal',
306 'targetName' =>
'ns=' . $this->associatedListingPrefix
307 . static::ASSOCIATED_PRODUCT_LISTING
308 .
', index=' . static::ASSOCIATED_PRODUCT_LISTING,
309 'actionName' =>
'showGridAssignProduct',
312 'title' =>
__(
'Add Products Manually'),
315 'visible' =>
'ns = ${ $.ns }, index = ' 322 'create_configurable_products_button' => [
326 'formElement' =>
'container',
327 'componentType' =>
'container',
328 'component' =>
'Magento_Ui/js/form/components/button',
332 $this->dataScopeName .
'.configurableModal',
333 'actionName' =>
'trigger',
334 'params' => [
'active',
true],
338 $this->dataScopeName .
'.configurableModal',
339 'actionName' =>
'openModal',
342 'title' =>
__(
'Create Configurations'),
363 'additionalClasses' =>
'admin__field-wide',
368 'label' =>
__(
'Current Variations'),
369 'renderDefaultRecord' =>
false,
370 'template' =>
'ui/dynamic-rows/templates/grid',
371 'component' =>
'Magento_ConfigurableProduct/js/components/dynamic-rows-configurable',
372 'addButton' =>
false,
374 'itemTemplate' =>
'record',
375 'dataScope' =>
'data',
376 'dataProviderFromGrid' => $this->associatedListingPrefix . static::ASSOCIATED_PRODUCT_LISTING,
377 'dataProviderChangeFromGrid' =>
'change_product',
378 'dataProviderFromWizard' =>
'variations',
381 'product_link' =>
'product_link',
384 'price' =>
'price_number',
385 'price_string' =>
'price',
386 'price_currency' =>
'price_currency',
388 'weight' =>
'weight',
389 'thumbnail_image' =>
'thumbnail_src',
390 'status' =>
'status',
391 'attributes' =>
'attributes',
394 'insertDataFromGrid' =>
'${$.provider}:${$.dataProviderFromGrid}',
395 'insertDataFromWizard' =>
'${$.provider}:${$.dataProviderFromWizard}',
396 'changeDataFromGrid' =>
'${$.provider}:${$.dataProviderChangeFromGrid}',
399 'columnsHeader' =>
false,
400 'columnsHeaderAfterRender' =>
true,
401 'modalWithGrid' =>
'ns=' . $this->formName .
', index=' 402 . static::ASSOCIATED_PRODUCT_MODAL,
403 'gridWithProducts' =>
'ns=' . $this->associatedListingPrefix
404 . static::ASSOCIATED_PRODUCT_LISTING
405 .
', index=' . static::ASSOCIATED_PRODUCT_LISTING,
409 'children' => $this->
getRows(),
427 'isTemplate' =>
true,
428 'is_collection' =>
true,
429 'component' =>
'Magento_Ui/js/dynamic-rows/record',
435 'thumbnail_image_container' => $this->
getColumn(
440 'formElement' =>
'fileUploader',
441 'componentType' =>
'fileUploader',
442 'component' =>
'Magento_ConfigurableProduct/js/components/file-uploader',
443 'elementTmpl' =>
'Magento_ConfigurableProduct/components/file-uploader',
444 'fileInputName' =>
'image',
445 'isMultipleFiles' =>
false,
447 'thumbnailUrl' =>
'${$.provider}:${$.parentScope}.thumbnail_image',
448 'thumbnail' =>
'${$.provider}:${$.parentScope}.thumbnail',
449 'smallImage' =>
'${$.provider}:${$.parentScope}.small_image',
451 'uploaderConfig' => [
452 'url' => $this->urlBuilder->addSessionParam()->getUrl(
453 'catalog/product_gallery/upload' 456 'dataScope' =>
'image',
459 'elementTmpl' =>
'ui/dynamic-rows/cells/thumbnail',
468 [
'dataScope' =>
'product_link']
476 'required-entry' =>
true,
481 'elementTmpl' =>
'Magento_ConfigurableProduct/components/cell-sku',
488 'imports' => [
'addbefore' =>
'${$.provider}:${$.parentScope}.price_currency'],
489 'validation' => [
'validate-zero-or-greater' =>
true]
491 [
'dataScope' =>
'price_string']
493 'quantity_container' => $this->
getColumn(
496 [
'dataScope' =>
'qty'],
497 [
'dataScope' =>
'qty']
499 'price_weight' => $this->
getColumn(
'weight',
__(
'Weight')),
504 'componentType' =>
'text',
505 'component' =>
'Magento_Ui/js/form/element/abstract',
506 'template' =>
'Magento_ConfigurableProduct/components/cell-status',
507 'label' =>
__(
'Status'),
508 'dataScope' =>
'status',
517 'componentType' => Form\Field::NAME,
518 'formElement' => Form\Element\Input::NAME,
519 'component' =>
'Magento_Ui/js/form/element/text',
520 'elementTmpl' =>
'ui/dynamic-rows/cells/text',
521 'dataType' => Form\Element\DataType\Text::NAME,
522 'label' =>
__(
'Attributes'),
531 'additionalClasses' =>
'data-grid-actions-cell',
532 'componentType' =>
'text',
533 'component' =>
'Magento_Ui/js/form/element/abstract',
534 'template' =>
'Magento_ConfigurableProduct/components/actions-list',
535 'label' =>
__(
'Actions'),
537 'dataScope' =>
'status',
562 $fieldEdit[
'arguments'][
'data'][
'config'] = [
563 'dataType' => Form\Element\DataType\Number::NAME,
564 'formElement' => Form\Element\Input::NAME,
565 'componentType' => Form\Field::NAME,
566 'dataScope' =>
$name,
568 'visibleIfCanEdit' =>
true,
570 'visible' =>
'${$.provider}:${$.parentScope}.canEdit' 573 $fieldText[
'arguments'][
'data'][
'config'] = [
574 'componentType' => Form\Field::NAME,
575 'formElement' => Form\Element\Input::NAME,
576 'elementTmpl' =>
'Magento_ConfigurableProduct/components/cell-html',
577 'dataType' => Form\Element\DataType\Text::NAME,
578 'dataScope' =>
$name,
579 'visibleIfCanEdit' =>
false,
581 'visible' =>
'!${$.provider}:${$.parentScope}.canEdit' 584 $fieldEdit[
'arguments'][
'data'][
'config'] = array_replace_recursive(
585 $fieldEdit[
'arguments'][
'data'][
'config'],
588 $fieldText[
'arguments'][
'data'][
'config'] = array_replace_recursive(
589 $fieldText[
'arguments'][
'data'][
'config'],
592 $container[
'arguments'][
'data'][
'config'] = [
595 'component' =>
'Magento_Ui/js/form/components/group',
599 $container[
'children'] = [
600 $name .
'_edit' => $fieldEdit,
601 $name .
'_text' => $fieldText,
if(!isset($_GET['name'])) $name