Hot answers tagged

24

I Hope this is useful for you, if you want to remove top.links Add default.xml file in this path app/design/frontend/vendor/theme/Magento_Theme/layout/default.xml <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body>...


22

copy templates folder from vendor/magento/module-theme/view/frontend/templates and paste into app/design/frontend/MySpaceName/MyTheme/Magento_Theme/paste templates folder here


15

The welcome message is in html/header.phtml and the block is referenced from this XML file: /vendor/magento/module-theme/view/frontend/layout/default.xml. The template is referenced by the $_template property within the \Magento\Theme\Block\Html\Header block. If you want to maintain some of the customer welcome functionality, you will need to override the ...


14

when editing the cms page, there's a field called layout update. use this code in it: <reference name="root"> <remove name="header"/> <remove name="footer"/> </reference>


12

When you add a block directly inside header block, magento will put your block just after all of it's child block that are added via other layout xml files that are processed before your pinsearch.xml. Basically a header block contains following blocks by default. This is added via page.xml which will get processed before your pinsearch.xml <block type="...


11

Block name to remove currency should be "currency", please try: <referenceBlock name="currency" remove="true"/>


10

you use referenceBlock logo <referenceBlock name="logo"> <block class="Magento\Cms\Block\Block" name="test_links"> <arguments> <argument name="block_id" xsi:type="string">test_links</argument> </arguments> </block> </referenceBlock>


10

You can do this by putting DIV over your logo and search box Also create a "container" for your static block (inside this you can call your static block) in logo.phtml. Now assign a class to each container and give them required width and float them accordingly . So it will look like 1) Static block 2) Logo 3) Search I hope someone else will get idea ...


9

You can add and remove top links by add this line in your in Magento_Theme/layout/default.xml <referenceBlock name="header.links"> <block class="Magento\Framework\View\Element\Html\Link" name="new.link" after="register-link"> <arguments> <argument name="label" xsi:type="string" translate="false">New Link&...


9

Change your default.xml to <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="header-wrapper"> <block class="Magento\Framework\View\Element\Template" ...


8

You have to loop through your stores and get URL and locale for each: foreach (Mage::app()->getWebsites() as $website) { foreach ($website->getGroups() as $group) { $stores = $group->getStores(); foreach ($stores as $store) { echo '<link rel="alternate" href="' . $store->getCurrentUrl() . '" hreflang="' . $...


8

Add code in your header.phtml or footer.phtml <script> jQuery.noConflict(); jQuery(window).scroll(function() { var height = jQuery(window).scrollTop(); if(height > 150) { jQuery('#header').addClass('fixed-menu'); }else{ jQuery('#header').removeClass('fixed-menu'); } }); </script> <style> .fixed-...


8

Not Tried but you can add directly in phtml with below code <?php echo $this->getLayout() ->createBlock('Magento\Checkout\Block\Cart\Sidebar') ->setTemplate('Magento_Checkout::cart/minicart.phtml') ->toHtml(); ?>


7

Try moving your core session initialization above the layout calls: require_once ("/var/www/magento_pack/app/Mage.php"); umask(0); Mage::app("default"); #Mage::setIsDeveloperMode(true); #ini_set('display_errors', 1); umask(0); Mage::app()->loadArea('frontend'); Mage::getSingleton('core/session', array('name' => 'frontend')); $layout = Mage::...


7

I had similar frustrations when trying to customise my theme which was extending the blank theme. I've now opted to create a fresh theme that does not inherit from a parent theme and I've found it far easier to manipulate. The difficulty is no doubt due to the fact I don't yet fully understand the underlying architecture and how it works. However, this is ...


7

There are 2 ways to do that:- 1- Add wrapping container to your block, like :- <container name="div.header.links" htmlTag="div" htmlClass="header_links" after="-"> <block class="Magento\Framework\View\Element\Html\Links" name="header.links" > </block> </container> 2:- Add referenceContainer tag, like :- <...


7

TLDR; You need to create a plugin in a custom module to override the Magento\Customer\CustomerData\Customer class. In your module's di.xml file: app/code/Vendor/LastName/Plugin/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/...


7

The data that code references (sectionLoadUrl) is usually set in the following snippet that (should) be on every Magento front-end page <script type="text/x-magento-init"> {"*":{"Magento_Customer\/js\/customer-data":{"sectionLoadUrl":"http:\/\/magento-2-1-4.dev\/customer\/section\/load\/","cookieLifeTime":"3600","updateSessionUrl":"http:\/\/magento-2-...


7

Please try this: Step 1: Get a bearer token: You can get a token by executing the signup mutation in the playground to create a new user. This is the signup mutation I ran: Request: mutation { generateCustomerToken(email: "customer@example.com", password: "password") { token } } Response: { "data": { &...


6

In my case, I wanted to do different hreflangs for each website. So to do just for the current one: $website = Mage::app()->getWebsite()->getStores(); foreach ( $website as $store) { $lang = $store->getConfig('general/locale/code'); echo '<link rel="alternate" href="' . $store->getCurrentUrl() . '" hreflang="' . $lang . '"/>' . "\...


6

Use the following code to show your account link in header: <?php $objectManagerlogin = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManagerlogin->get('Magento\Customer\Model\Session'); $baseurl = $objectManagerlogin->get('Magento\Store\Model\StoreManagerInterface')->getStore(0)->getBaseUrl(); ?&...


6

Looking at the Magento\Framework\View\Element\Html\Link\Current code for version 2.2.6, there is no class argument supported (as documented in the previously accepted answer). However class is an accepted attribute. It can be used to set the css_class as follows: <block class="Magento\Framework\View\Element\Html\Link\Current"> <arguments> ...


6

Firstly you need to create static cms block about us. and add your content in content part. Now to add that block in header follow the below steps : Create/Add new category from product/categories from admin menu. Make Sure Enable Categories menu and Include in menu is selected as enable. Click on Content tab and go to the Add CMS Block - Select your about ...


6

I think something like this would work, though I am often wrong :) <referenceContainer name="header-wrapper"> <container name="block-wrapper-to-hold-the-items" as="block-wrapper-to-hold-the-items" htmlTag="div" htmlClass="block-wrapper-to-hold-the-items"/> </referenceContainer> <move element="minicart" destination="block-wrapper-to-...


6

There is no difference. The default offloader header in Magento 2 is X-Forwarded-Proto, which matches the de facto standard. SSL_OFFLOADED on the other hand, was the default offloader header in Magento 1, and also used by Nexcess_Turpentine, the popular Varnish extension for Magento 1. Basically, you can call the header however you want, you just have to ...


6

1) To change class of Header Tag , edit your extended/custom default.xml app/design/frontend/vendor-name/theme-name/Magento_Theme/layout/default.xml Now add this line of code to change the class , here I changed page-header to test <referenceContainer name="header.container" htmlClass="test" /> 2) To remove tag <div class="panel wrapper"> ...


6

The simple way is to add default text with your text into app/design/frontend/Custom/default/i18n/en_US.csv like "Sign In","Login" clear cache after that php bin/magento cache:clean && php bin/magento cache:flush


6

Use helper to get email address in phtml. You can do it by following way. In phtml: $helper = $this->helper('Vendorname\Modulename\Helper\Data'); $email = $helper->getEmails(); //pass storeId in getEmails if you want to get email for specific store In helper define any function, For example getEmails(). <?php namespace Vendorname\Modulename\...


5

It's really Easy as magento taking care of everything. I found an option for the same in : Magento Admin Panel => System (from main navigation) => Configuration (might be last in sub-menu list) => Admin (found at bottom in left options column) => Security Section (As shown in below image) In Security section, there will be option to Allow ...


5

You can change this email from the admin panel, go to: System -> Configuration -> Store Email Address (this is in the left side menu) There you will see different email addresses, change the ones you need. Check this post for more details: http://www.hostknox.com/tutorials/magento/store-emails


Only top voted, non community-wiki answers of a minimum length are eligible