0

I'm trying to get the customer increment_id to be included as customer_increment_id as an extension_attribute in orders when I search orders through rest/V1/ordes?searchCriteria...

I added following to my modules etc/extension_attributes.xml but it doesn't seem to work.

<extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
 <attribute code="customer_increment_id" type="string">
 <join reference_table="customer_entity" reference_field="entity_id" join_on_field="customer_id">
 <field>increment_id</field>
 </join>
 </attribute>
</extension_attributes>

I have checked my permissions cleared var/generations/* var/cache/* runed magento setup:upgrade in all possible ways!

So what am I missing?

I have this extension in the same file and that one works fine searching customer via rest/V1/customer/search.

<extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
 <attribute code="increment_id" type="string">
 <join reference_table="customer_entity" reference_field="entity_id" join_on_field="entity_id">
 <field>increment_id</field>
 </join>
 </attribute>
</extension_attributes>

/Thomas

asked Jul 28, 2016 at 8:12

1 Answer 1

0

I don't know how the JoinProcessor works exactly.

Anyway, following this answer I actually found out that Resource Models belonging to magento-customer inject a dependency on JoinProcessor while those belonging to magento-sales don't. I think this should explain why the attribute is working in the latter case and not in the former: in this case an explicit data loading is required (please have a look to Gift Message case). This can be done for example by using Plugins.

1
  • I had all forgotten about this question. I too have come to this conclution. The join processor isn't added to magento sales. To add customer increment_id to the searchresult would require some plugin or extension work. Commented Nov 30, 2016 at 15:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.