Skip to content

#10824 add name for order items grid default renderer block #10936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2017

Conversation

Zefiryn
Copy link
Contributor

@Zefiryn Zefiryn commented Sep 17, 2017

Add name for default renderer block of order items to allow other modules reference it.

Fixed Issues (if relevant)

  1. Cannot add new columns to item grid in admin sales_order_view layout #10824: Cannot add new columns to item grid in admin sales_order_view layout

Manual testing scenarios

  1. In custom module create file view/adminhtml/layout/sales_order_view.xml with the following content
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="order_items">
            <arguments>
                <argument name="columns" xsi:type="array">
                    <item name="test_column" xsi:type="string" translate="true">Test Header</item>
                </argument>
            </arguments>
            <referenceBlock name="default_order_items_renderer">
                <arguments>
                    <argument name="columns" xsi:type="array">
                        <item name="test_column" xsi:type="string" translate="true">col-test</item>
                    </argument>
                </arguments>
            </referenceBlock>

            <block class="Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn"
                   name="column_test_column"
                   template="Vendor_Module::test.phtml" group="column" />
        </referenceBlock>
    </body>
</page>
  1. create file view/adminhtml/templates/test.phtml file with content
Test column
  1. Go to the order view page.
  2. Column with header "Test Header" is shown with content "Test column"

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@ishakhsuvarov
Copy link
Contributor

@Zefiryn Thanks for the PR. I think this process may be automated and all blocks which lack name may be updated. Are you interested in that kind of automation?

@ishakhsuvarov ishakhsuvarov added this to the September 2017 milestone Sep 17, 2017
@Zefiryn
Copy link
Contributor Author

Zefiryn commented Sep 17, 2017

@ishakhsuvarov sure, are you thinking about bin/magento command?

@ishakhsuvarov
Copy link
Contributor

@Zefiryn more like one-time fix which updates all the blocks without names. That can be backed up by static test which would not allow to create new blocks without names.

@Zefiryn
Copy link
Contributor Author

Zefiryn commented Sep 17, 2017

@ishakhsuvarov ok, I will try to work on it in the next 2 weeks and I will push it to this PR.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Sep 17, 2017

@Zefiryn I also prepared similar pull request but for other blocks and got good feedback how it could be fixed in better way. Just take a look at the following comment: #10354 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants