Currently when adding existing products the field requires to type in SKU and select a product from the autocomplete list witch shows product id and it's title.
I think this is confusing for some scenerios and some users and I would like to be able to select which field is used for autocomplete widget.
This would be Title or SKU in most simple scenerio.

It's just that when typing SKU one would expect it to show up in the autocomplete not something else :)

Comments

philipz’s picture

Title: Allwo to show SKU not title on autocomplete reference widget » Allow SKU in autocomplete reference widget
Status: Active » Needs review
StatusFileSize
new2.06 KB

Here's a simple patch and seems to be working fine.

philipz’s picture

Forgot t() function in two places.

summit’s picture

Hi,

Using this patch I got error 500 and:

mod_fcgid: stderr: PHP Parse error: syntax error, unexpected $end in /sites/all/modules/commerce/contributions/inline_entity_form/inline_entity_form.module on line 1335 

Greetings, Martijn

summit’s picture

Status: Needs review » Needs work

Hi, set this to "needs work" if thats ok.
greetings, Martijn

summit’s picture

Status: Needs work » Reviewed & tested by the community

Sorry it is working as http://drupal.org/node/1940664#comment-7168446! somehow my field became cut off..
sorry for the inconvenience.

It would be great if I could select based on sku (and filtered by producttype).

Greetings, Martijn

bendiy’s picture

This feature already exists with Entity Reference. You just need to create a view and in your reference field settings, set "Entity selection" to use "Views: Filter by an entity reference view".

Here's a module that add support for Entity Field Query views as well:
https://drupal.org/project/entityreference_efq_views
See the "Instructions" section on that page. It details how to set this up.

This gives you full control of what fields are searched for a matching string when using the Autocomplete widget. It also allows you to control what fields display in the list returned by the Autocomplete widget.

bojanz’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (won't fix)

I'm not going to commit this.

The default behavior is the same for all entity types: you search by entity title, get a "$title ($id)" result.
Product reference fields have the additional feature that you can search by title OR sku.
So someone might expect the title, someone might expect the SKU. The added code complexity of this patch
still misses in 50% of the cases (if you were expecting the title for instance).

I agree that it's better to use the entityreference feature to truly configure this, it's more powerful than an IEF feature can ever be.