Questions tagged [layout]

Denotes the xml files used to define the block hierarchy which eventually renders the template files.

Filter by
Sorted by
Tagged with
8
votes
3answers
13k views

How to load a specific JS at the end of all other included JS files?

I have a specific fancybox.js file which I want to load at the end of all the JS files included in my local.xml If load order can be changed then how can a JS file be loaded (included) at the end ? ...
6
votes
2answers
25k views

Add custom js in head in magento2?

I have custom module. I want add file my.js in folder app\code\Xanka\Slider\view\frontend\web\js\slider\my.js. I used code in app\code\Xanka\Slider\view\frontend\layout\default.xml <head> &...
7
votes
5answers
6k views

Magento2 getting 'Constr is not a constructor' error for custom theme

I am not sure what this error is and if it is affecting anthing, however this is coming into my console: layout.js:64 Uncaught TypeError: Constr is not a constructor (layout.js line 64)
6
votes
2answers
14k views

Https - layout broken

When I open the site using https://mydomain.com all layout (front/backend) is "broken" and appears inconsistent: The headers contains all js/css but they are loaded with http:// protocol and the css ...
5
votes
1answer
6k views

How to Override Mage_Checkout_Block_Links

What is the proper way to override a method, for example, the Mage_Checkout_Block_Links::addCartLink() method. My goal is to add some HTML before the Mage_Checkout_Block_Links::addCartLink() method. ...
0
votes
2answers
3k views

Layout XML block rendered twice in Magento skin

I'm having a bit of trouble with a custom layout block which I'm trying to add to the head.phtml file of my theme. Basically, I'm trying to add extra favicon definitions to the header of my document. ...
12
votes
2answers
12k views

Magento2: Default to sort by price descending not ascending

Ok so I have my categories sorting by price. Magento 2 defaults this to price ascending. But I would prefer it to be by price descending. Pretty sure I can do this by customising ...
6
votes
5answers
2k views

Load review form on external page

By default the Magento URL for the review form is: www.domain.com/(producturl)-reviews#review-form. But in this page the review-form is a section in the reviews page. I want to load the review-form ...
3
votes
2answers
4k views

Add placeholder and remove all labels in Magento 2 Checkout

Searched a lot but didn't found anything removing the Lables like "First Name, Last Name, City, Address, Email, Phone etc" Add Placeholders in all "shipping fields" and "sign In" places. After ...
2
votes
3answers
8k views

how to use different template file for category magento 2

I want to customize the design of the catalog list page. I want to use different layout and design for each product category. For that, I am calling different phtml files from static block. using a ...
0
votes
1answer
109 views

Magento 2: Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid block type: Perfectmirrors\PmmLayout\Block\Head

I am really not sure how to create the block class Pmm\PmmLayout\Block\Head , function of which $block->getAllPagesJSContent() should be called inside my phtml file pmm_head.phtml <...
15
votes
1answer
9k views

How can I debug layout file processing in Magento 2?

According to magento 2 theme specification about Layout files processing : The Magento application processes layout files in the following order: 1/ Collects all layout files from modules. The ...
14
votes
2answers
3k views

Checkout Form - How to wrap multiple elements in a class - Magento 2

How do you wrap two checkout form elements inside a div? For example let's say I wanted to wrap these country and zip/postcode fields in a div with the class of example-class, how would I do this? ...
13
votes
4answers
11k views

Magento 2: Remove block depending on a config setting

I'm trying to remove a block from a certain page (be it frontend or backend) but only if a certain config flag is set to true. Let's take an example. I want to remove the block with the name dashboard ...
19
votes
1answer
12k views

Magento 2 - ifconfig in layout xml

I'm working with magento 2. I can use ifconfig attribute in the block code, and it works well. <block class="Magento\Catalog\Block\Category\View" name="category_desc_main_column" template="...
12
votes
2answers
6k views

Magento 2: Passing Variables from Controller Action to “View”

In Magento 1, if you want to pass data from your Controller action to the "View" (i.e. a block in your layout, you can) Add a value/object to the global registry via Mage::register Directly fetch a ...
4
votes
1answer
9k views

How to add extra container to page header in Magento 2

I am working on a new theme which is based on the Luma theme. I need to add a extra container to page header.my problem is that I can't identify how/where to add this. Can anyone advise on what page ...
6
votes
1answer
1k views

Understanding how magento merges layout XML data

How does Magento handle layout XML files? For example if I have created a theme app/design/frontend/example/theme and copy an XML file from the base/default/layout directory in my theme's layout ...
5
votes
6answers
33k views

How can I disable filter “category” from Sidebar

I choose my Category XY and get the Product-Grid, on the left side there is the Sub-navigation and below the "Filter Navigation". The attribute filters starts with "categories", "manufacturer", "size"...
5
votes
1answer
3k views

Magento 2 - editing module structure and functions

in Magento 1.x you could duplicate the extensions to app/design/frontend/themeName/default/template/or/layout and then modify it's layout or functionality via xml or phtml files. How do we duplicate ...
3
votes
1answer
873 views

removing a template from the cache

I'm getting a template via: <?php echo $this->getChildHtml('ajaxCart'); ?> and the block is declared like this: <block type="page/html_topmenu" name="ajaxCart" as="ajaxCart" template="...
3
votes
3answers
7k views

Magento 2 Create custom 404 page for not-found products

In Magento 2 I am looking to create a module that adds a custom 404 page specifically for not-found products in the catalog, however keep the default 404 page for all other pages. My initial thoughts ...
6
votes
3answers
3k views

Magento 2.2 move review tab below description with all product reviews

I have added the following code to 'Magento_Review/layout/catalog_product_view.xml': <move element="reviews.tab" destination="content" after="product.info.details" /> The above code moved the ...
6
votes
1answer
1k views

Difference Between $block and $this magento 2

I have block Class Name NameSpace1\Test\Block\Test with method getTest() namespace NameSpace1\Test\Block; class Test extends \Magento\Framework\View\Element\Template { public function getTest(){ ...
5
votes
1answer
13k views

Magento 2: Creating a custom layout

I'm having trouble creating a custom layout. I have successfully created a layout called home_page.xml which is a copy of the default 1column layout. I have selected this layout for my home page, ...
5
votes
1answer
11k views

How to add custom block at the /checkout/cart/ page?

I am working on a custom extension and i want to add additional block to the /checkout/cart/ page. Take a look: Here is my config: <?xml version="1.0"?> <config> <modules> &...
4
votes
3answers
4k views

Create link dynamically in customer account navigation

I want to create a link dynamically in customer_block_account_navigation (link supposed to show up in the sidebar) A static link isn't a problem, you can achieve that with a xml layout update: <...
4
votes
2answers
7k views

Add block to category page

I want to add a custom block to the category pages and not care if the the category is anchor or not or if it has children or not. I want to add that block at the bottom of the page after the product ...
4
votes
1answer
2k views

Magento 2: replacement for the <PRODUCT_TYPE_simple>, <PRODUCT_TYPE_configurable> etc… product type specific layout handles

In Magento 1, we had some specific layout handles for each product types: <PRODUCT_TYPE_simple> <PRODUCT_TYPE_configurable> <PRODUCT_TYPE_grouped> <PRODUCT_TYPE_bundle> <...
2
votes
3answers
5k views

Magento2 Update layout Using Observer on Product page

I want to Update XML using observer on Product Page when page load. I want to set there condition with product Attribute there. How can I do that?
2
votes
1answer
1k views

Product page Review Section from tabs to Bottom of page

I need to move/rearrange Reviews from tabs of product page to bottom of page. Here is how I updated my theme file's default.xml <referenceBlock name="reviews.tab" remove="true" /> <!-- ...
1
vote
1answer
647 views

Import Export is not working in magento 1.7

Trying to export Magento single products but only a blank page is appearing. could not export any products either from System ->Import/Export->Export or from System->Import/Export/Dataflow-profile. ...
1
vote
1answer
637 views

Editing an Existing Theme - Locating the XML

Sorry for the beginner question but I'm completely stuck, otherwise I wouldn't ask. I'm determined to learn Magento correctly and need pointing in the right direction before I can continue. I'm ...
8
votes
1answer
8k views

Add block to layout dynamically in event observer

I want to know how to use layout.xml with event observer. I want to show a message in footer when payment made successfully. I know I have to use the event ...
4
votes
4answers
6k views

Add Content before footer

I am using magento 1.9.2.2 version. I want to add content from custom module before footer (after all page content) without change any core file and theme files ( .phtml ) .
4
votes
1answer
3k views

Use a dropdown select for the shipping address on the Onepage Checkout

In Magento 2, I would like to be able to select the shipping address with a dropdown, similar to how you can if you choose to change the billing address. This is how it currently works: I would like ...
3
votes
1answer
509 views

What is the benefit of the letter case conventions in layout xml?

Example scenario: $ grep ^class app/code/local/MyApp/MadCaseExample/Block/CaseMaker/BlockThing.php class MyApp_MadCaseExample_Block_CaseMaker_BlockThing extends MyApp_MadCaseExample_Block_Mce $ grep -...
3
votes
1answer
4k views

New products list dedicated page

I need to display the products marked as new in a dedicated page in my e-shop and use the same products list template I am using in the catalog_category_view page. Does Magento already provide this ...
3
votes
4answers
3k views

Magento 2 - How to auto open cart items on checkout page?

I'm using a mostly stock Magento 2 checkout_index_index layout (checkout page), I was wondering if anyone knew how to default the order summary collapsible to be open on page load. It isn't clear ...
3
votes
1answer
2k views

Can I get store config value in layout xml file?

In my extension I want to add custom link to the customer account page menu. there is my xml layout update file <customer_account> <reference name="customer_account_navigation"> ...
2
votes
1answer
3k views

Magento2: Add JS from Admin CMS page Design “layout update XML”

I did added JS file from design layout update from Admin CMS page- > Design layout update XML , but it showing jQuery is not defined error, When I view source , these files are being added before the ...
2
votes
1answer
7k views

Creating custom header extending Magento blank in Magento 2

I am trying to create a theme with Magento Blank as parent in Magento 2 but I can't figure it out how to change the header with a custom one. I first remove header.container from magento blank and ...
2
votes
1answer
2k views

Show description of product in wish list phtml file

I want to get description of product in wishlist Page, I tried this code In list.phtml file but no luck . <?php echo $_product->getDescription() ?> EDIT my code now look like this <?...
2
votes
2answers
3k views

Magento 2 - Add step on checkout

I'm trying to add a new step to the normal workflow of magento 2 checkout, I follow the tutorial on magento dev page (http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_new_step.html) but ...
1
vote
1answer
667 views

Overwrite template without the “name” attribute

How can I overwrite the template of something like select.phtml <block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="...
1
vote
2answers
1k views

Execute custom Javascript code in Frontend/Admin on sales_order_place_after event

I need to execute some custom JavaScript right after the sales_order_place_after event is fired for collecting analytic data. I know how to make an observer and do something in the relevant method. ...
1
vote
2answers
6k views

how to override only .phtml files in my custom module in magento?

I don't want to override .php files I want to edit only .phtml files of Page Module how can I create layout file and assign? thanks.
0
votes
1answer
56 views

How to restore the default checkout template?

I never use Magento but, a friend uses it and a dev. broke their checkout page, how I can restore the TEMPLATE of the checkout to default? I don't see a backup of any of the files, and I no have clue ...
0
votes
5answers
12k views

How To Change Default Layout Template as 2column-left.phtml

I have just installed the Magento Bootstrap theme webcomm/magento-boilerplate By default, Mangeto loads the 2column-right.phtml as the skeleton layout template. How do I ask it to load another ...
0
votes
1answer
355 views

Magento “left” reference element xml layout problem

I have been trying to solve the issue for past few days with no luck. The left sidebar is missing from all of the 2column-left pages. It worries me especially when it comes to customer account as the ...