Hot answers tagged

52 votes
Accepted

How to override a HTML file using a custom module?

Working solution. Just create or edit requirejs-config.js file from below path. /app/code/Namespace/Module/view/frontend/requirejs-config.js And place below code in requirejs-config.js var ...
user avatar
19 votes

Best Way Of Getting Base URL Inside KnockoutJS .html File

I managed to do this in app/design/frontend/<Vendor>/<Theme>/Magento_OfflinePayments/web/template/<Filename>.html, but the solution should work in the Magento_Checkout as well. When ...
user avatar
19 votes
Accepted

Knockout If-else condition inside html file in Magento 2

You should write a below code for else condition <!-- ko if: isFreeShipping() --> //My Code goes here <!-- /ko --> <!-- ko ifnot: isFreeShipping() --> //My Code goes here &...
user avatar
18 votes

How to override a HTML file using a custom module?

You can just add your cc-form.html file inside your theme payment module. <mage_dir>/app/design/frontend/{Package}/{themename}/Magento_Payment/web/template/payment/cc-form.html You can change ...
user avatar
15 votes
Accepted

How do you change the number of product columns?

The question is in fact, how do you change the number of product columns. The line you wish to change is generated by this code: <?php $_columnCount = $this->getColumnCount(); ?> <ul ...
user avatar
13 votes

how to add expires headers in magento

Try to put this in .htaccess <ifModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 2 days" ExpiresByType image/x-icon "access plus 2592000 seconds" ExpiresByType ...
user avatar
  • 389
11 votes

How to override a HTML file using a custom module?

Accepted solution is right, but I copy here the full @AntonGuz answer from the "Stack Overflow" (very well explained): Yes, there is. You can look in pub static to see how path to static asset ...
user avatar
10 votes
Accepted

How to overwrite lib template file - Magento 2

Correct Location The correct location in this example is actually the first one I tried, I just didn't clear the directories required. So to overwrite lib templates they need duplicating in to the ...
user avatar
  • 15.2k
10 votes
Accepted

Magento 2: Email Templates Template Style is not Working

First of all, we need to read here: http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/templates/template-email.html#non-inline-styles. For the Non Inline Styles, they must be in a <style ...
user avatar
10 votes
Accepted

Best Way Of Getting Base URL Inside KnockoutJS .html File

There are three parts to this, I will use the checkout authentication as an example but this should work in any KO/JS file that has mage/url as a dependency. vendor/magento/module-checkout/view/...
user avatar
  • 15.2k
8 votes
Accepted

how to use cookie-free domains in magento?

Configure another domain for skin and media check that the cookie domain is configured that way, that the cookies are not send along these domains Make sure, that you don't get a problem with the JS ...
user avatar
8 votes
Accepted

How to hide Magento from CMS detectors?

First you need to know, how your website is identifiable as magento, as there are a big number of possible proves. basic html structure magento specifiv css special js code on product views (assuming ...
user avatar
  • 6,087
8 votes

hook into magento's output to the client

...at some point magento will need to ... stream it's html data to the client. At what point does this happen? See Mage_Core_Controller_Varien_Front::dispatch() - there's a code comment which answers ...
user avatar
  • 16.6k
8 votes
Accepted

HTML tags are not allowed in footer copyright

Magento have set validation to not allowed html tags in copyright box(ex - validate-no-html-tags) . So default it won't allowed you to add html tags. But if you still want to add the html tags in ...
user avatar
  • 9,580
8 votes
Accepted

Allow HTML tags in Bank Tranfer Payment instructions

As I understood you want to add some HTML tags to Bank transfer Payment method. By default Magento escapeHtml when rendering Instruction for COD and Bank transfer Payment. We need to Create a small ...
user avatar
  • 5,346
7 votes

How to copy a product's attributes value to another attribute?

You can do this with a sql query. But First you need to identify the attribute ids for your attributes and their types. SELECT attribute_id, attribute_code, backend_type FROM ...
user avatar
  • 195k
7 votes

How to override a HTML file using a custom module?

I don't know since which version of Magento2 it is required but if you want to override template from Magento_Ui module, you need to provide path like this: var config = { map: { "*": { ...
user avatar
  • 182
7 votes

Knockout If-else condition inside html file in Magento 2

Just to extend a bit on Suresh Chikani's answer to include more combinations under this question: To do a if-elseif-else construction you would have in PHP: if (A && B) { //...code } ...
user avatar
  • 7,352
6 votes
Accepted

hook into magento's output to the client

You can use the event controller_action_layout_render_before if you want to alter the html for all the pages. If you want it for a specific page page use the event ...
user avatar
  • 195k
6 votes
Accepted

I want to change the html of breadcrumb?

The file is app/design/frontend/{package}/{theme}/template/page/html/breadcrumbs.phtml As a future reference, when you cannot find a template, turn on the template path hints
user avatar
  • 195k
6 votes

web html template not able to overwrite

Just create or edit requirejs-config.js file from below path. app/code/Namespace/Module/view/frontend/requirejs-config.js And place below code in requirejs-config.js var config = { map: { ...
user avatar
6 votes
Accepted

Add custom javascript in afterRender in Magento 2 with knockout

The afterRender method calls the specified method (test) of your component. So for your case you must define the test method inside the minicart component. You must add a mixin for the vendor/magento/...
user avatar
5 votes
Accepted

Defer parsing of JavaScript in Magento

Solution 1. Best solution: Less Javascript or find out which JS loads the part 'above the fold' and Solution 2. load that in header + de rest of the JS in footer Solution 3. or use the attribute ...
user avatar
  • 5,322
5 votes
Accepted

Edit Magento "Product Comparison page" template

It is generated from this file: app\design\frontend\base\default\template\catalog\product\compare\list.phtml You can copy this to your theme's folder and make changes. You can get the view files ...
user avatar
5 votes
Accepted

Change plain text email into HTML email

I think you'll find all the necessary info here: How to override config.xml Don't forget to clear the cache and create a new contact email template in the admin (or delete them to use the default ...
user avatar
5 votes
Accepted

Magento 2: Overriding Block class – not generating output

First of all, we need to add Constructor injection method to our custom select class: (Edit: we don't need to add Constructor Injection, we need to add the sequence module) <?php namespace ...
user avatar
5 votes

Updating Basket quantity (using ENTER) clears the basket entirely

As I ran into the same problem and it's already the behavior observed in Magento 2.2.8, I decided to post this answer. In Magento 2.3.x this issue seems to be fixed. You can override the form.phtml ...
user avatar
5 votes

override knockout html template file in theme

Check deploy mode, If deploy mode is not developer mode then set it. php bin/magento deploy:mode:set developer Check .htaccess is in pub/static/ folder or not. If not then please take from fresh ...
user avatar
  • 1,296
5 votes
Accepted

What's the difference between element and elementTmpl

template : It means path of the .html template of the general type of field to generate field i.e. ui/form/field elementTmpl : It means path of .html template of the particular type of field (select, ...
user avatar
4 votes
Accepted

How do I remove the div `col-right sidebar` from the default theme html?

You have to change the root template for <catalog_category_default> and <catalog_category_layered> inside your local.xml i.e. <catalog_category_default> <reference name="...
user avatar
  • 815

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