Hot answers tagged

21

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


19

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>...


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="...


12

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 ...


10

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 ...


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="' . $...


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

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" ...


6

This is a tough one. I had an errant whitespace character at the beginning of a core class definition which screwing with me for a couple months till I realized what was going on. Someone will write an extension one day to fix this, but till they do, one way to troubleshoot in Magento would be to start output buffering manually in index.php, then try to ...


6

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 ...


6

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(); ?>


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

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&...


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

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-...


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

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 . '"/>' . "\...


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


5

You can use default.xml to add your phtml in header <?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> <referenceBlock name="header.container"> <block class="Magento\Framework\View\Element\...


5

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-...


5

With regards to the XML, that block is called header and is set in \vendor\magento\module-theme\view\frontend\layout\default.xml You can remove it via a theme override at \app\design\frontend\YOURNAME\YOURTHEME\Magento_Theme\layout\default.xml with the following xml: <referenceBlock name="header" remove="true"/> This seems to be the only thing ...


5

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-...


5

You can do url rewriting from magento admin panel by following below steps : Logged into magento admin then click on Catalog -> URL Rewrite Management To add new url rewrite rule Click on Add Url rewrite. Select custom if you want to used it as custom url rewrite.(Ex here Request url -http://www.xxxx.com/blog and target url - http://www.xxxx.com/modular) ...


5

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"> ...


5

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": { "generateCustomerToken": { ...


4

Try with the code below <a href="why-us"><img src="<?php echo Mage::getBaseUrl() ?>/media/upload/logo/WhyOrder.gif" alt="Why Order With Us" align="center" > </a> Mage::getBaseUrl() in the image src gets the website base url. Let me know once its worked.


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