如何针对Drupal commerce的variation做image对应node ID的views

Background:

因为: Drupal commerce因为将产品和NODE 分离了,每个product是一个entity,而entity 默认是无法直接在views里提取出里面的如图片或文字任何元素的。

所以:如果想要使用views从众多products里筛分出[图片]并对应到与其关联的[NODE ID]的列表,无法直接实现。

换句话说:无法直接使用views从node当中筛分出product 图片 ; How to get images with its refrence node linking from entities?

Thinking of Proccess: Display Suite可以对任何entity实体进行元素分离、重整合、及模板调控;相当于一个具有模板化的实体分离器Display Suite=Can be templated Entity Separator; 建立一个自定义名称的entity view mode给views套用 同时使用DS对这个自定义的entity view mode进行必要的元素提取分离和前台模板样式呈现。

Setup by setup:

  1. install Display Suite module and Entity view modes ( It is Required! )
  2. go { admin/config/system/entity-view-modes } , add new view mode (eg: test_entity_view_mode) for the specifical entity what you want extractor image from.
  3. Build a views eg: ex_images_from_entity_product In views Format, make your setting as follow: Show: Rendered entity | Settings ( choice the "test_entity_view_mode as" as your View mode ) we suppose the view has a view page is : test123; Take look on this url, you can make more changing in the views lists, such as iteam display type, just go "manage display"
  4. Done!
分类: