21

In order to make it appear in the layout dropdown you need to create a custom module (you can also add something in a core file but please don't do that). Let's name the extension Easylife_Layout. For this you need to create the following files: app/etc/modules/Easylife_Layout.xml - the declaration file <?xml version="1.0"?> <config> <...


20

Why changing the root template doesn't work Both Mage_Cms_IndexController::indexAction() and Mage_Cms_IndexController::viewAction() which are responsible for displaying the default homepage and a CMS page respectively call a helper: Mage::helper('cms/page')->renderPage($this, $pageId) If you jump into the helper (located at app/code/core/Mage/Cms/...


18

To meet your requirements you need to create an extension - without this it's not possible. Module config file : Create the module file config file at app/etc/modules/Amit_NewLayout.xml Code: <?xml version="1.0"?> <config> <modules> <Amit_NewLayout> <active>true</active> <...


18

I would also go the way 2 and, indeed, you actually can render "pure" HTML via AJAX without the head, body, css and so on. The trick is to: tell your controller to instanciate a Response that is of type \Magento\Framework\View\Result\Layout rather than \Magento\Framework\View\Result\Page use a layout XML file with a root node that is <layout...>...&...


14

Regarding your "can't add a block using <reference name="left/>, are you sure your CMS page has a block named left? For example, if you consider the default home page that ships with the Magento sample data, it appears to have a block named left. However, if you look at the page in the backend, you can see it's set to use the root template `2 ...


13

You can remove using that code: <referenceContainer name="footer-container" remove="true"/> <referenceBlock name="form.subscribe" remove="true"/>


12

What about: creating a new container (instead of a block) move your blocks to the container remove the container Something like this: <container name="delete" htmlTag="div" htmlClass="delete"/> <move element="category.image" destination="delete"></move> <move element="category.description" destination="delete"></move> <...


12

Add this code in your custom theme or module in default.xml: app/design/frontend/Namespace/Themename/Magento_Theme/layout/default.xml <referenceContainer name="after.body.start"> <block class="Magento\Framework\View\Element\Template" name="custom.file" before="-" template="Magento_Theme::html/custom.phtml" ...


7

The page_types.xml file allows an admin to add custom content to all the controller actions defined in it. If you want to allow the admin to add custom block to your new page you can add it to the page_types.xml file. From what I can understand the page_types are referenced in the widget area, under the Layout Updates fieldset of the Storefront Properties ...


6

This is the best practice for remove any block or container in magento 2. You can pass name attribute inside name in below element. <referenceBlock name="block.name" remove="true" /> You can search inside magento 2 system, you have find many places syntax same as above. Its magento recommendation way.If attribute remove="true" then add the element ...


6

There are two possibilities: You add a custom layout to your category and do this: <layout> <reference name="root"> <action method="setTemplate"><template>page/1column-lookbook.phtml</template></action> </reference> </layout> You implement it as a page layout and add it to the config.xml in ...


6

<referenceContainer name="page.wrapper"> <container name="{your_name}" htmlTag="div" before="main.content"> <!-- must have content to display --> <block name="{some_content_block}" /> </container> </referenceContainer> Be aware that the container will only display if it has content! Reference: app/...


6

Try below steps Step:1 Create default.xmlat location app\code\<Vendor-Name>\<Module-Name>\view\frontend\layout and add below code <referenceContainer name="page.top"> <block class="Magento\Framework\View\Element\Template" name="custom-block-name" template="<Vendor-Name>_<Module-Name>::page\custom.phtml"/> </...


5

Create a module with a dependency on Mage_Page and add the new layout in your own config: app/etc/modules/My_Layout.xml <?xml version="1.0"?> <config> <modules> <My_Layout> <active>true</active> <codePool>local</codePool> <depends> <...


5

Adding new CSS <theme-dir>/blank/layout/default_head_blocks.xml <?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"> <head> <css src="css/newtheme.css" /> </head> </page> ...


5

Out of the box, Magento does not use any of those methods to render HTML via AJAX. From what I've seen, everytime such thing needs to be done, JSON is used to transport the result. Example from the Magento/Checkout/Controller/Cart/Add : $this->getResponse()->representJson( $this->_objectManager->get('Magento\Framework\Json\Helper\Data')-&...


4

You can use the Magento notification system. It should work anywhere anytime. Notice Mage::getSingleton(‘core/session’)->addNotice(‘Notice message’); Success Mage::getSingleton(‘core/session’)->addSuccess(‘Success message’); Error Mage::getSingleton(‘core/session’)->addError(‘Error message’); Mage::getSingleton(‘adminhtml/session’)->...


4

It still does not seem possible to set a title in the head section and translate it, but you could create a custom customer_account_forgotpassword.xml to fix the issue with this code <referenceBlock name="page.main.title"> <arguments> <argument name="title" xsi:type="string" translate="true">Forgot Your Password</argument>...


4

Maybe something like this : <reference name="root"> <action method="unsetChild" ifconfig="general/layout/enable"> <child>header</child> </action> <action method="unsetChild" ifconfig="general/layout/enable"> <child>footer</child> </action> </reference> I'm not sure if ...


4

You can customize login layout here vendor/magento/module-customer/view/frontend/layout/customer_account_login.xml Account create layout vendor/magento/module-customer/view/frontend/layout/customer_account_create.xml Do not edit directly core file. Copy customer_account_login.xml to your theme. Final customer_account_login.xml: <?xml version="1....


4

There are two ways to achieve this If you want it to be applied into a single category page only then perform following things Go to your Admin_Panel > Catalog > Category > Desired_Category > Design Put there below things at appropriate places Layout > 1 Column Layout Update XML > <move element="sidebar.main" destination="...


4

put that code in downloadable_customer_products.xml and it will work, please find attached screenshot i have tested in my local.


3

You can't do this with a simple layout update xml. The easiest way to achieve this is create a new root template specific to your cms page. Steps for this is given below. 1. Layout Update XML File Go to CMS > Pages > [Select your CMS Page] > Design > Layout Update XML section. Put this layout update code there. <!-- removing default page ...


3

In my example I can not use sections because it is not customer data and it is not after a PUT / POST action but using Raphael at Digital Pianism answer I figured out how Magento render sections. If we take the example of cart section it use the method \Magento\Customer\CustomerData\SectionPool::getSectionDataByNames to retrieve data from sections. This ...


3

Preferred way is to edit in theme's default.xml file. You may create or edit the default.xml file at path app/design/frontend/Vendor/theme/Magento_Theme/layout/default.xml If one wants to add container div under column div, should try this. <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...


3

The better way to do this will be using helper function. in your Magento_Theme/layout/default.xml you can pass argument for logo like this- <argument name="logo_file" xsi:type="helper" helper="Namespace\ModuleName\Helper\Data::getLogoImage"></argument> and then in your helper file you can return logo based on current url, Your helper file- ...


3

Instead of overriding layouts.xml I ended up doing the following Create a new Module: app/code/<Vendor>/Cms Create the file: app/code/<Vendor>/Cms/Model/PageLayout.php <?php namespace <Vendor>\Cms\Model; use Magento\Cms\Model\Page\Source\PageLayout as BasePageLayout; class PageLayout extends BasePageLayout{ public function ...


3

For the top.links and customer_account_navigation you can create your Block class Instead of Magento\Framework\View\Element\Html\Link\Current and add your condition there, like <?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"...


3

Try following way: <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-orders-link-2"> <arguments> <argument name="path" xsi:type="string">sales/order/history</argument> <argument name="label" xsi:type="string" translate="true">My Orders 2</argument> ...


2

contact_index_index.xml <body> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="title" xsi:type="string">Contact Us</argument> </action> </referenceBlock> <body> Reference: /vendor/magento/module-...


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