0

I want a two-column page layout to display my products which I create with 'drupal commerce'. The layout is basically the picture and similar articles on the left. Description on the right.

Now, I can manage the display of the product in two column with 'display suite' and then create a node view that is just a dummy page which really all it does is having one big field with the reference of the product.

I almost have what I want now because I have the picture on the left and the description on the right. How do I put the similar products block (I suppose it could be a block, right?) under the picture on the left?

It seems very dirty to add it as a field into the product. But I can’t add it to the column from the view node since I have no granular access on the single columns or fields.

What do?

Layout

3
  • 1
    what you can do is theme the ds file on you product page and call that block in the particular area. <?php $search_block = block_load('views', '-exp-abc-page'); $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($search_block)))); print $output; ?> Commented Oct 17, 2014 at 13:02
  • nice, but where do I write this code?
    – gurghet
    Commented Oct 17, 2014 at 13:03
  • 1
    in manage display in ds section you can find the exact tpl name for that content type then copy ds modules's theme tpl file with name you find in manage display and place in between the html or the other way is to theme your content type.. from scratch Commented Oct 17, 2014 at 13:06

2 Answers 2

1

If you need to put a view into the display, then you can do it completely from Display Suite's user interface. Display Suite has four custom fields that you can make use of. One of them is the Dynamic Field.

Make sure 'Views content panes' is installed (CTools package).

Create a view (deselect page and block on wizard) which takes the product display id (nid) as contextual filter. Under pane settings there is an 'Argument input' setting. Open it and select 'From context' from the dropdown, then in the required context select the Content Id. This tells views that you will be sending it a node id from the context (ie the page you are viewing).

Go to the display page of the product display where you have the display suite columsn set up. Create a dynamic field and select node as the entity during the wizard process. When done it will display in the list of fields available. You can now drag it to wher you want it, but it will still be unconfigured. To configure it you need to click on the geard icon nest to it, then click on 'select content'. This will open up a dialog where you select 'View panes' and your view that you just created.

Thats it. The view pane will now be embedded as a field in your content type.

Now all you need to do is to adapt the view, seeing that you want related products to show up.

Look here for a video demo - Using Display Suite Dynamic Fields - YouTube

1
  • This answer is excellent!
    – gurghet
    Commented Oct 18, 2014 at 10:16
1

You can use EVA module. With that it is possible to have a views block as a field in DS.

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.