2

I have several Drupal Commerce views. I want to sort on whether the image is "interesting", which means not equal to no-image-available.png.

I have added "Indexed Commerce Product: Image » The image file." as a relationship but it's still not showing up in the sortable fields.

I remember there was something like "enforce" relationship but this is not showing up where I was expecting it:

enter image description here

1
  • Computed field could be interesting. But I did not try this myself yet.
    – donquixote
    Mar 20, 2014 at 19:43

1 Answer 1

0

One way to solve this is to store a sortable value in an extra field.

Computed field can be a good choice. There is a quite lengthy article here. See "Additional Values for Sorting".

I also want to quote the "Downsides" mentioned in this article:

Since the stored value computed field is only computed when the node is saved, your nodes need to be re-saved to allow for code changes. If you change the content type’s field, you may need to re-save all nodes of that type. If you have thousands of nodes, this can be troublesome. However, several modules (which are outside the scope of this post) can help, as can simple one-off scripts.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.