Skip to content
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

Replace into the layout adminhtml_order_shipment_new.xml block alias … #8353

Merged
merged 4 commits into from
Feb 4, 2017
Merged

Replace into the layout adminhtml_order_shipment_new.xml block alias … #8353

merged 4 commits into from
Feb 4, 2017

Conversation

sylvainraye
Copy link
Contributor

@sylvainraye sylvainraye commented Jan 31, 2017

…attribute with block name attribute to allow template overrides.

…attribute with block name attribute to allow template overrides.
@vrann vrann self-requested a review February 2, 2017 17:05
@vrann vrann self-assigned this Feb 2, 2017
@vrann
Copy link
Contributor

vrann commented Feb 2, 2017

@diglin thanks for contribution.
Can you explain why this change is needed and describe how to reproduce result?

@sylvainraye
Copy link
Contributor Author

@vrann it's needed otherwise you can't overwrite the renderer template properly. You can't get a block via its alias but only via its name. A block having an alias but no name, receive an anonymous block name like $parentNode->getElementName() . '_schedule_block' + VALUE as referenced at \Magento\Framework\View\Layout\ScheduledStructure\Helper::scheduleStructure
It's difficult to be sure that this name doesn't change as soon as other block are created into the parent block.

If a developer wants to customize or change the renderer block, he can't because <referenceBlock> works only with name not with alias.

Thanks to the commited changes, a developer can extends/customize the renderer like that

In File adminhtml_order_shipment_new.xml:

        <referenceBlock name="default"><!-- without the fix the block anonymous name  may be like order_items_schedule_block3 -->
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Diglin_BasePriceUnit::shipping/create/items/renderer/default.phtml</argument>
            </action>
        </referenceBlock>

@vrann
Copy link
Contributor

vrann commented Feb 2, 2017

@diglin Thank you for the explanation; it makes sense.

@vrann
Copy link
Contributor

vrann commented Feb 2, 2017

@diglin can you please come up with unique names for the blocks? "bundle" and "default" are pretty generic and there are high chances that another block with the same name will call collision. Block names should be unique within context.

Something like "sales_order_bundle_renderrer" and "sales_order_bundle_default" will work

@sylvainraye
Copy link
Contributor Author

@vrann I agree hw that's what comes from core code. I didn't changed anything, I just setup a replacement of as to name. Should I update my pull request?

@vrann
Copy link
Contributor

vrann commented Feb 2, 2017

@diglin yes, please, go ahead.
Those tokens makes sense as aliases, but for names they are too generic.

@sylvainraye
Copy link
Contributor Author

@vrann done :-)

@vrann
Copy link
Contributor

vrann commented Feb 3, 2017

@diglin change looks good, accepting

@mmansoor-magento mmansoor-magento merged commit 5831ca1 into magento:develop Feb 4, 2017
mmansoor-magento pushed a commit that referenced this pull request Feb 4, 2017
 - Updated composer.lock for monolog/monolog: ^1.17
@okorshenko
Copy link
Contributor

@diglin Thank you for your contribution to Magento 2 project! Your pull request has been successfully merged!

@okorshenko okorshenko added this to the February 2017 milestone Feb 11, 2017
@YevSent
Copy link
Contributor

YevSent commented Feb 21, 2017

@okorshenko, @vrann, @diglin this fix is incorrect and causes a fatal error. Try to create shipment for an order placed with a simple or bundle product. If specified rendered doesn't exist, the default must be used, but you changed the default name to shipment specific and now it doesn't work.

@orlangur
Copy link
Contributor

@joni-jones integration test demonstrating problem would be really nice

@YevSent
Copy link
Contributor

YevSent commented Feb 21, 2017

@orlangur, follow functional tests: Magento\Shipping\Test\TestCase\CreateShipmentEntityTest, Magento\Shipping\Test\TestCase\SalesShippingReportEntityTest, Magento\Sales\Test\TestCase\MassOrdersUpdateTest can be used.

@orlangur
Copy link
Contributor

No-no, I'm not saying the issue is hard to reproduce. Just would be nice to enforce correct behavior with mandatory test.

Are these functional tests failing now after merge?

@YevSent
Copy link
Contributor

YevSent commented Feb 21, 2017

Yes, these tests are failed now.

@orlangur
Copy link
Contributor

Dunno why it was merged then :-| Could you report new issue referring to this PR? Especially mentioning functional tests you found broken.

Don't want to arrogate your credits ;)

@YevSent
Copy link
Contributor

YevSent commented Feb 21, 2017

Mentioned tests don't present in required test plans. We have created internal ticket (MAGETWO-64909) and fix will be merged ASAP.

@orlangur
Copy link
Contributor

Ah, ok, didn't notice you are a member of Magento crew ("Member" label indicated this some time ago, now I see only "Contributor"s).

Too bad full functional tests suite is still not mandatory or at least such an important cases not covered with integration tests. Thanks for quick reaction 👍

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.

6 participants