Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#1 | node--product--type.txt | 1.35 KB | Cookiz |
Comments
Comment #1
Cookiz CreditAttribution: Cookiz commentedHi,
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.
Comment #2
fhdrupal CreditAttribution: fhdrupal commentedThat'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.
Comment #3
Cookiz CreditAttribution: Cookiz commentedHi 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)
Comment #4
fhdrupal CreditAttribution: fhdrupal commentedThank 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.
Comment #5
Cookiz CreditAttribution: Cookiz commentedhum 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. ;-)
Comment #6
Cookiz CreditAttribution: Cookiz commentedHum quick fix concerning the template file.
You don't need to "hide" your fields if they are rendered before the $content.
Comment #7
fhdrupal CreditAttribution: fhdrupal commentedThat's right I tried it and it didn't appear twice. Nice hints, Thanks again.
Comment #8.0
(not verified) CreditAttribution: commentedCorrected some mistakes.