So I thought I'd add an extra attribute column to the associated products / variants grid on the edit page for configurable products, so whenever you add configurations to a configurable product some custom stuff can be viewed and set correctly on the fly.
It seems there are a 3 different display mechanisms:
1. The UI component grid managed by configurable_associated_product_listing.xml
2. the list of existing variations when you edit a configurable product
3. the form-grid with the products to create after you've used the "edit configurations" wizard
All caching is turned off btw.
I thought to extend configurable_associated_product_listing.xml first.
Original location: module-configurable-product/view/adminhtml/ui_component/configurable_associated_product_listing.xml
My location: code/(myvendor)/(mymodule)/view/adminhtml/ui_component/configurable_associated_product_listing.xml
Added Magento_ConfigurableProduct to my module.xml.
No luck, no change. Even altering the original file in place didn't change anything. By now I suspect it isn't even being used.
<?xml version="1.0" encoding="UTF-8"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <columns name="product_columns"> <column name="my_attribute" sortOrder="85"> <settings> <addField>true</addField> <filter>textRange</filter> <label translate="false">my_attribute</label> </settings> </column> </columns> </listing>
Then I found
Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Variations\Config\Matrix
module-configurable-product/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml
It builds a productMatrix array with a hard coded list of attributes inside a protected method.
Another team are module-configurable-product/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php, another productMatrix array with a hard coded list of attributes. It's buddy seems to be Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\ConfigurablePanel
These look like they handle the form-grid.
While it should be doable to alter al this, the protected methods prevent me from using plugins, which are the less intrusive way to do thing. Also the productMatrix building looks a bit like duplicate code. But what really worries me is configurable_associated_product_listing.xml not seeming to play any role in all this.
Can somebody shed a light on the right way of doing this?
It seems so bizarrely complex.
And what's up with configurable_associated_product_listing.xml ?
I have created,
module-configurable-product/view/adminhtml/ui_component/configurable_associated_product_listing.xml
this file in my module,
app/code/Ced/Save/view/adminhtml/ui_component/configurable_associated_product_listing.xml
and added below code,
<?xml version="1.0" encoding="UTF-8"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">configurable_associated_product_listing.data_source</item> </item> </argument> <columns name="product_columns" class="Magento\ConfigurableProduct\Ui\Component\Listing\AssociatedProduct\Columns"> <column name="my_attribute" sortOrder="85"> <settings> <addField>true</addField> <filter>textRange</filter> <label translate="false">my_attribute</label> </settings> </column> </columns> </listing>
http://i.imgur.com/47d2XIE.png
Cleared Cache and it worked.
Can you please try one more time by using above code?
Let me know if it is still not working?
Thanks!
May I ask why specifically and only the data argument needs to be repeated? The class of columns also remains the same.
Are you implying magento discards some specific information when merging ui component xml?
I'll let you know the outcome.
If it doesn't work, the problem must be something else than bad xml.
No effect.
I also edited the original file in place, so inside the vendor folder.
All cache types are turned off including opcache.
Except for COMPILED_CONFIG, that one can't be disabled in 2.3.2 apparently.
https://github.com/magento/magento2/issues/23133
I ran both setup:di:compile and cache:clean.
No effect.
It seems there is some very aggressive caching going on.
Did you get an update on this? @a_vreugdenhil
How did you fixed?
@a_vreugdenhil wrote:No effect.
I also edited the original file in place, so inside the vendor folder.
All cache types are turned off including opcache.
Except for COMPILED_CONFIG, that one can't be disabled in 2.3.2 apparently.
https://github.com/magento/magento2/issues/23133
I ran both setup:di:compile and cache:clean.
No effect.
It seems there is some very aggressive caching going on.
Nope.
I still don't have a clue why nothing changed, but the problem doesn't seem to be caused by xml issues but by some weird caching or something.
If I figure this one out I'll post my findings here.
Hello.
Did you figure this out, im trying to do the same and im having the same issues.
thank