Adding <referenceBlock name="head.additional"> Magento 2 not working - magento

I had these blocks in the frontend layout:
<referenceContainer name="content">
<block class="Dfl\Marketplace\Block\Profile" name="marketplace_sellerprofile" template="profile.phtml" cacheable="false" before="-"/>
</referenceContainer>
<referenceContainer name="sidebar.main">
<block class="Dfl\Marketplace\Block\Profile" name="marketplace_sellerprofileleft" template="profile_left_sidebar.phtml" cacheable="false" before="-"/>
</referenceContainer>
<referenceContainer name="sidebar.additional">
<block class="Dfl\Marketplace\Block\Profile" name="marketplace_sellerprofileright" template="profile_right_sidebar.phtml" cacheable="false" before="-"/>
</referenceContainer>
then i wanted to add a new block in order to insert it in the section.
I added the following command above these blocks
<referenceBlock name="head.additional">
<block class="Dfl\Marketplace\Block\Profile" name="marketplace_social_tags" template="social_tags.phtml" />
</referenceBlock>
then in my social_tags.phtml template I just added a simple meta entry.
meta entry example
Then I run setup:upgrade and setup:static-content:deploy en_US es_ES
But the entry wasn't there in the head tag.
I followed these links yet i was unable to display the meta entries.
Atwix - Adding blocks to the head section in Magento 2
add-block-in-head-tag-in-magento-2
Any help? What it's missing?

Man. I had the same problem while trying to get hreflang things in the head.
Tried for 4 hours.
Even though several sites and even an example module reference the head.additional in the default.xml - I found out, for me it was only working when using
<referenceBlock name="head.additional">
in the default_head_blocks.xml
That drived me so crazy.

Related

How to add Block into another one - Magento 2

what's up!
I need a little help.
I am trying to create some blocks usign the code below:
<referenceContainer name="content">
<block class="Gysa\Quotes\Block\Adminhtml\Quotes\Edit" name="quotes_quotes_edit" template="Gysa_Quotes::quote/create/form.phtml">
<block class="Gysa\Quotes\Block\Adminhtml\Quotes\Edit\Products" template="Gysa_Quotes::quote/create/products.phtml" name="quotes_quotes_edit_products" />
</block>
</referenceContainer>
But the block "quotes_quotes_edit_products" doens't showing up. I have looked some examples on "Magento Sales" and there I can see that is possible. So What Am I doing wrong.
Anyone Can help please.
Cheers.
It might sound silly but have you cleared cache?
Also it would help to see if the block is loaded if you enable the template hints
Just Change It :-
<referenceContainer name="content">
<block class="Gysa\Quotes\Block\Adminhtml\Quotes\Edit" name="quotes_quotes_edit" template="Gysa_Quotes::quote/create/form.phtml">
name="quotes_quotes_edit_products" />
</block>
<refernceBlock name="quotes_quotes_edit">
<block class="Gysa\Quotes\Block\Adminhtml\Quotes\Edit\Products" template="Gysa_Quotes::quote/create/products.phtml"
</refernceBlock>
</referenceContainer>

How to remove recently viewed products in product page magento

I want to remove the recently viewed products which are in the product page . and i have tried many times but not been able to find a solution . i have done some editing in the local.xml
but it didnot worked
Open reports.xml of your theme template. (app\design\frontend\theme\default\layout\reports.xml)
There will be code like
<block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />
Remove that, clear cache and Reload
Try removing the related products block from <catalog_product_view> in your catalog.xml file:
<reference name="right">
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/>
</reference>
Remove the block:
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/>
Try and find the viewed products instruction in your store. And then, in yout theme's local.xml, use the correct handle to remove it from the wanted section.
For example, how to remove Magento's base theme default instruction in product view:
<catalog_product_view>
<remove name="right.reports.product.viewed" />
</catalog_product_view>
The next example is how I removed it from my store, which was based on a different theme:
<catalog_product_view>
<remove name="product.info.viewed" />
<catalog_product_view>
Clear the cache and you're good to go!
This is the recommended way. You should avoid to duplicate or modify the original XML layout files. Always use your theme local.xml file instead.

Vote and Compare Blocks need to be taken out in magento

I have some troubles in /checkout/cart page with taking out two blocks:
- compare products block
- voting block
I cant remove them from right sidebar
at current layout xml
/layout/checkout.xml
There is only MY ONE adding template to right sidedar
<reference name="right">
my adding template code here
</reference>
also I have just removed all adding templates to right sidebar from
/layout/page.xml
and as a result I see these two blocks (compare and voting) at right bar anyway (
Let me know where can They be removed by me from ?
Thanks
I hope you're using local.xml to do your customizations.
In local.xml
<default>
<!--other codes-->
<remove name="catalog.compare.sidebar" />
<remove name="right.poll" />
<!--other codes-->
</default>
if need to remove from checkout - cart page only and retain on other pages then use <checkout_cart_index> handler instead of and use "unSetChild". Remember <remove> will completely remove the block.
I found out where was problem )
Magento layouts include one of this
/layout/poll.xml
and There I saw these lines
<!-- Mage_Poll -->
<reference name="right">
<block type="poll/activePoll" name="right.poll">
<action method="setPollTemplate"><template>poll/active.phtml</template><type>poll</type></action>
<action method="setPollTemplate"><template>poll/result.phtml</template><type>results</type></action>
</block>
</reference>
</default>
after commented it They disappeared )

how to find the links in the footer in magento

I am trying to find the links in the footer of a magento website , but i am having difficulty finding the phtml file. I found the block code in the page.xml file
<block type="page/template_links" name="footer_links" as="footer_links" after="footer.newsletter" template="page/template/links.phtml"/>
but i cannot find the file links.phtml file , i checked the current template
website/app/design/frontend/website.com/default/template/page/
but i cannot see any template folder there.
Can anybody help me please with this, how to find the file, i even tried turning on template path hints it didn't help. Thanking you for your help in advance.
It can be confusing, the footer links i Magento are generated in one of two ways:
1) Added via XML layouts, which is how the sitemap link etc are added, example:
contacts.xml
<reference name="footer_links">
<action method="addLink" translate="label title" module="contacts" ifconfig="contacts/contacts/enabled">
<label>Contact Us</label>
<url>contacts</url>
<title>Contact Us</title>
<prepare>true</prepare></action>
</reference>
You can add more like this, or comment out to remove each link
They are generated using a standard template file (template/page/template/links.phtml) which is enabled in the config below. Each link definition as above (there's multiple in different xml configs) will use the template below to display the actual HTML link.
page.xml
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<!-- uncomment this to ditech them.. -->
<block type="page/template_links"
name="footer_links" as="footer_links"
template="page/template/links.phtml" />
</block>
2) You will find a static block called footer_links which also includes some links, this is to make it easier for you to add your own link. They are enabled inside
cms.xml
<reference name="footer">
<block type="cms/block" name="cms_footer_links" before="footer_links">
<!--
The content of this block is taken from the database by its block_id.
You can manage it in admin CMS -> Static Blocks
-->
<action method="setBlockId"><block_id>footer_links</block_id></action>
</block>
</reference>
Both methods are used to generate the footer links which can be confusing :)
Try this path:
/app/design/frontend/base/default/template/page/template
Hope that helps you...
to remove "orders and returns" from the footer link i had to comment out the block from sales.xml file
<!-- <default>
<reference name = "footer_links">
<block type="sales/guest_links" name="return_link"/>
<action method="addlinkBlock">
<blockName>return_link</blockName>
</action>
</reference>
</default>
-->

Removing the block "Popular Tags" from the index view in Magento

I started working with Magento this week and I'm trying to create a new theme. Following the "Designing for Magento" article of the wiki, I tried to remove the Popular Tags block from the index view, adding this line to local.xml on magento\app\design\frontend\default\mytheme\layout:
<remove name="tags_popular"/>
I don't why, but the tags are still there while if I do the following the language switcher disappears:
<remove name="store_language"/>
I also tried this to no effect:
<reference name="left">
<action method="unsetChild"><name>tags_popular</name></action>
</reference>
I even deleted tag.xml and the tags are still there!
I know that I can get rid of them disabling the Mage_tag in the backend, buy I want to understand why this is not working.
Thanks!
Just add this in your theme->page.xml default block
<remove name="tags_popular"/>
you can remove block any of magneto. then you can remove after it's block name.
here you see tag_popular it's block name remove plus it's block name
Remove default magento block
Have a look into tag.xml where you will find this code, which you have to comment out:
<default>
<!-- Mage_Tag -->
<reference name="left">
<block type="tag/popular" name="tags_popular" template="tag/popular.phtm">
<action method="setTemplate"><template>tag/popular.phtml</template></action>
</block>
</reference>
</default>
How silly, the popular tags were shown in the main page because they came in the default code of the content page (menu: CMS > Pages), so I just had to erase that :P

Resources