Hi, I am using omega kickstart subtheme, wondering how I can display social media facebook and twitter buttons right below product image and remove it from description side. Also how I can insert a block below product image grid, for example related products block. Thanks.

CommentFileSizeAuthor
#1 node--product--type.txt1.35 KBCookiz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Cookiz’s picture

FileSize
1.35 KB

Hi,

In order to move the social links elsewhere on the page,
you will first need to duplicate the template file named node--product--type.tpl.php located in :
profiles/commerce_kickstart/modules/commerce_kickstart/commerce_kickstart_product_ui/theme
in your theme folder in the templates subfolder (in my case the file is located in commerce_kickstart_theme)

Then in the file, before line 22 : print render($content);
please add the following code : hide($content['service_links']);

now, if you want to add the social links under the image display, below the line 15:
<?php print render($content['product:field_images']); ?>
you'll need to add this : <?php print print render($content['service_links']); ?>

I've attached the file below if you need, just rename it as a tpl.php file.

fhdrupal’s picture

That's brilliant thanks, and how can I insert a view block e.g. related products right underneath the image. Because there is much empty space in between, especially when read more link is clicked. It pushes related products block very much down.

Cookiz’s picture

Hi again, sorry for the last post, i've forgotten to reply to your second question ;)

So according to me there is two ways to handle that, one can be simpler than the other :-)

First method, you can use views_embed_views
to render the view block where you want to. You'll need to edit the previous template file mentioned above.

Second method, you can use EVA (Entity Views Attachment) to attach your view to the content type view_mode
of the product type you want. (In my case I've attached that to the Shoes content type)
The boring part in this method is that you'll need to add this eva field in each content type view_mode of each product type...

After doing that, the field will be rendered by default in the :
<?php print render($content); ?>

So in your case you'll need to find out the name of the eva field in order to place it just below the image grid (like I told you in the previous comment)

fhdrupal’s picture

Status: Active » Fixed

Thank you very much, your both solutions worked like charm. For the second solution I had to go through a little reading and a video from the links you gave me.

Only one thing that I could not find straight forward was the Entity View variable machine name, like 'service_links' to render. I tried the view machine name of the view, but it didn't work. So I had to print full content array using 'var_dump', to find out the variable to render, and interestingly it was different then view machine name shown.

If I can get an answer to it, that will be great, otherwise I am marking it as fixed anyway.

Cookiz’s picture

hum the quickest way is to dsm the content variable :
<?php dsm($content); ?> instead of <?php print render($content); ?>
NB: you'll need to have devel installed and activated;

this will give you all the "fields" rendered so in my case the eva field has been created in a new new called "test" so this is what i'm having :
http://cl.ly/image/1u2Y090j3O3V

So like I said previously, you'll need to render the field before the <?php print render($content); ?>.
In my case "test_entity_view_1" (because i've created 2 eva in my views...)
So I will have a line just after my image field which render's it. ;-)

Cookiz’s picture

Hum quick fix concerning the template file.
You don't need to "hide" your fields if they are rendered before the $content.

fhdrupal’s picture

That's right I tried it and it didn't appear twice. Nice hints, Thanks again.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Corrected some mistakes.