Skip to main content
56 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 ...
Makwana Ketan's user avatar
21 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 &...
Suresh Chikani's user avatar
20 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 ...
Rakesh Jesadiya's 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 ...
simonthesorcerer's user avatar
12 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 ...
Khoa TruongDinh's user avatar
12 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/...
Ben Crook's user avatar
  • 15.7k
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 ...
Siarhey Uchukhlebau's 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 ...
Ben Crook's user avatar
  • 15.7k
9 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 ...
Pawan's user avatar
  • 5,906
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 ...
Manthan Dave's user avatar
  • 9,856
8 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/...
Siarhey Uchukhlebau's user avatar
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: { "*": { ...
embed0's user avatar
  • 192
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 } ...
7ochem's user avatar
  • 7,562
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: { ...
surbhi agr's 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 ...
Khoa TruongDinh's 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 ...
Andreas Schrammel's 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 ...
gelanivishal's user avatar
  • 1,336
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, ...
Ankita Patel's user avatar
4 votes

How do I change my DOCTYPE to HTML5?

You need to change the doctype in the following files: app/design/frontend/<your_package>/<your_theme/page/1column.phtml app/design/frontend/<your_package>/<your_theme/page/2columns-...
Raphael at Digital Pianism's user avatar
4 votes
Accepted

How do i display Sub Categories as Images on category page?

Update your code with below code <?php $category = Mage::registry("current_category"); if($category->getId()){ $categories = $category->getCollection() ->...
Neha Raval's user avatar
4 votes

Cache Issue on mobile and desktop

for the HTML, JS and CSS changes you can enable the merging and bundling the JS and CSS files, and then it will merge it to the client's browser too and reflect the changes, https://devdocs.magento....
Ankit Srivastava's user avatar
3 votes
Accepted

Adding an ID to the UI-form element

The configuration of your component defined using config array. In this array there is componentType attribute, which defined in etc/definition.xml file (Magento/Ui/view/base/ui_component/etc/...
Max's user avatar
  • 4,054
3 votes

Defer parsing of JavaScript in Magento

Main idea here is to move all javascript to the bottom. Create observer on http_response_send_before: <frontend> <events> <http_response_send_before> <observers> <...
Konstantin Gerasimov's user avatar
3 votes
Accepted

Optimize revolution slider on magento home page

I got Solution from below link : http://previous.themepunch.com/revolution4-jquery/liveguide/10.Sample-LazyLoading.html
Ram Pratap Singh Gour's user avatar
3 votes

Custom theme selection

You need to create registration.php to register your theme. Registration.php file code : <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\...
Manthan Dave's user avatar
  • 9,856
3 votes
Accepted

Custom theme selection

You need to create media folder and inside that folder add your preview.jpg file. Create registration.php file inside theme, <?php \Magento\Framework\Component\ComponentRegistrar::register( ...
Rakesh Jesadiya's user avatar
3 votes

Magento 2: How to change Contact Us Email Type?

Try creating new email template file in your custom module. submitted_form.html {{trans "Name: %name" name=$data.name}} <br/> {{trans "Email: %email" email=$data.email}} <br/> {{trans "...
Mike's user avatar
  • 1,148
3 votes
Accepted

Magento 2: How to change Contact Us Email Type?

You need to create a new module for overwrite template config. Your module.xml should be [Vendor/RewriteContact/etc/module.xml] <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...
Sohel Rana's user avatar
  • 35.9k
3 votes
Accepted

Weird image whitespace

This is not css issue. When you resize the image the magento will automatically add the white background to fill the container size. use keepFrame(false) $this->helper('catalog/image')->init($...
Qaisar Satti's user avatar
  • 32.5k
3 votes

HTML Head issue using Magento2

Magento will store the content of Content > Design > Configuration > Theme Edit > HTML Head. within core_config_data using the path design/head/includes. You should be able to edit the ...
Douglas Radburn's user avatar

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