It is well-known that OrderItem doesn't support record types so you can't vary the page layout based on recordtype like you can for most other objects.
Given that OrderItem is a detail to Order, and Order does support record types, how might one override the OrderItem Edit page without using a VF controller redirect via a page action method?
That is, without recourse to:
Page that overrides the standard Edit button
<apex:page standardController="OrderItem" extensions="MyRedirector"
action="{!redirect}">
</apex:page>
and VF controller method:
PageReference redirect() {
return isParentOrderOfRecordTypeX
? new PageReference('/apex/PageOrderItemX')
: new PageReference(this.id+'/e');
}
and the custom PageOrderItemX
<apex:page standardController="OrderItem">
... custom layout as needed ...
</apex:page>
That is, can this be done more elegantly with fewer components?