Questions tagged [template]
The folder that contains all the `phtml` files used to display at frontend or backend.
1,374
questions
0
votes
0answers
82 views
How to create template for WYSIWYG editor magento 2
I have problem with template in wysiwyg editor on admin page. In Catalog > Products > Content tab we have wysiwyg editor, but I'm confused were I need to create templates for selecting.
It ...
25
votes
5answers
18k views
Magento 2 - How to get the extension's configuration values in the phtml files?
I'm working with Magento 2 - beta.
But cannot find how to get the configuration values in the phtml files.
eg: I want to get my custom modules configuration values in Magento_Catalog/templates/...
0
votes
0answers
39 views
Magento 2: Refresh a widget at regular interval
I have developed an extension to provide a widget to list featured random products on CMS pages. The requirement is to refresh this list at regular interval without caching. Is there any option to ...
1
vote
3answers
2k views
Add product name in product view within a new phtml?
I copied catalog_product_view.xml and pasted it into app\design\frontend\Mytheme\DreamShop\Magento_Catalog\layout folder and code is added before the default.phtml
<block class="Magento\Catalog\...
0
votes
0answers
101 views
Magento 2 - Use multiple block classes in template
I try to show a block in the header which shows different content, depending on whether the user is logged in or not.
If the user is logged in, then I show:
If the user is NOT logged in, then I like ...
3
votes
1answer
782 views
Add filter toolbar to advanecd search page
How I can add filter toolbar to advanced search page.
I created catalog_category_view.xml and added the XML below but it does not change the template.
<referenceBlock name="product_list_toolbar"&...
2
votes
0answers
2k views
Magento 2 - Override Swatches renderer.phtml
I would like to override file :
app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml
In my own theme :
app/design/frontend/[VendorName]/[theme]/Magento_Swatches/...
0
votes
3answers
4k views
Magento 2 - How to extend customer account creation template
I want to extend the customer account creation template (register.phtml) of the Luma theme.
I copied the register.phtml to my custom theme directory:
\app\design\frontend\my\theme\module-customer\...
0
votes
1answer
44 views
Override magento 2 module file
I'm trying to override a file in my theme, but its not showing.
The file is located in
vendor/mollie/magento2/view/frontend/web/template/payment/creditcard-with-components.html.
location of my file is
...
0
votes
1answer
47 views
I have created a custom module for backed to add menu and submenu but it shows me on phtml file in Magento 2
I have created a custom module for back end Menu and sub menu but it shows me an error for phtml file.
1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template ...
0
votes
1answer
44 views
I have created a custom module for backed to add menu and submenu but it shows me Error?
I have created a custom module for back end Menu and sub menu but it shows me an error.
1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file:
'...
0
votes
1answer
23 views
Use phtml in stead of html for emails in magento 2
Im overwriting the template vendor/theme/Magento_Email/email/header.html
I want to add php in this template. Is there a way to include a template in header.phtml?
I currently have this which doesn't ...
0
votes
1answer
128 views
Can't override template from own module
It seems to be impossible to override the template vendor\magento\module-checkout\view\frontend\templates\cart\item\renderer\actions\edit.phtml from your own module e.g. by using layout updates.
(The ...
4
votes
5answers
10k views
Custom Email Template in Magento2
I'm trying to create a custom email template.
I have loaded header and I want to start styling it. For example a simple red background color.
Where do I need to add the style?
<!DOCTYPE html ...
0
votes
0answers
19 views
is creating block within template in magento 2 good practice
I often see in phtml templates blocks being creating dynamically like below:
$block->getLayout()->createBlock(BlockClass)->toHtml();
I worry whether this is good practice and particularly ...
0
votes
1answer
24 views
How to do use a different theme on search result page instead of default?
How do I make the search results page use a different theme like you can on category pages?
As, I'm using a different theme for a catalog on my store, but when you use the mini search it pulls the ...
0
votes
0answers
17 views
How to override adminhtml template file in magento 2.3.2 [duplicate]
I want to override account.phtml file located at /vendor/magento/module-sales/view/adminhtml/templates/order/create/form
How can i do that?
0
votes
1answer
26 views
Add a script to a template file
This is the default vendor/magento/module-checkout/view/frontend/layout/checkout_onepage_success.xml
This layout defines between other things :
<block class="Magento\Checkout\Block\Onepage\...
1
vote
0answers
15 views
Move block after size atributte of product page [Magento 2]
I want to move a block and put it after size attribute because when I click this button magento detect that I add to cart:
I use this to move after add to cart, but I don´t known to move to the other ...
1
vote
1answer
34 views
How to override a template file in magento 2
I want to override final_price.phtml template file located at /vendor/magento/module-grouped-product/view/base/templates/product/price/
How should i do that?
2
votes
2answers
3k views
How to create custom drop down field on checkout page in Magento 2?
How to create custom field on checkout billing address in magento2?
I want simple drop down on checkout page just we can use for admin order and this field also saves in the database table like ...
1
vote
1answer
34 views
file not created in pub/static
I have copied the file located in: vendor/magento/module_checkout/view/frontend/web/template/minicart/item/default.html
to my theme dir:app/design/frontend/MyVendor/Mytheme/Magento_Checkout/web/...
1
vote
0answers
29 views
Attempting to display specific custom attributes in a particular table format
This may not be the best place to ask this question as it might be more of a php question but I took up building a Magento site as a hobby during covid-lockdown so I thought I'll ask here - apologies ...
5
votes
1answer
583 views
Sanitizing HTML output in templates in 2.4
Before 2.4 the way you could sanitize an html value in a template was to use $block->escapeHtml($valueHere);.
Where $blick is the instance of the current block.
This still works in 2.4, but the ...
0
votes
1answer
88 views
How to override adminhtml template file in magento 2
I want to override one adminhtml template file located at /vendor/magento/module-sales/view/adminhtml/templates/order/create/form/account.phtml
What steps i need to follow?
2
votes
2answers
63 views
Error filtering template: The entity that was requested doesn't exist. Verify the entity and try again
I am trying to fetch the order details
$order = $objectManager->create('\Magento\Sales\Model\OrderRepository')->get($orderId);
Order id is correct 000000020. In var log main.CRITICAL: The entity ...
1
vote
1answer
71 views
Disable (product data items) tabs in Product page
I want to disable tabs in product pages, i mean not display product data items (description, more information,Ratings) as tabs.
So I override
web/css/source/sections.less
And remove tabs and ...
1
vote
1answer
1k views
Overriding parent templates by a child theme in same vendor directory
I want to override
app/design/frontend/vendor/maintheme/Magento_Catalog/templates/product/price/final_price.phtml
in
/app/design/frontend/vendor/child-of-maintheme/
I made same path
/app/design/...
1
vote
0answers
17 views
Display Custom CMS Fields in Magento 2 Template
I'm can't seem to find any documentation on how to get custom CMS fields in a PHTML template in Magento2. The following snippet did it in Magento2:
Mage::getBlockSingleton('cms/page')->getPage()-&...
1
vote
2answers
6k views
Magento 2.2.3 How to adjust date format?
The following piece of code:
<?= $post->getCreatedAt() ?>
Returns the following output: 2018-04-13 11:53:00
How to adjust that piece of code in a way that the output would be something ...
2
votes
2answers
12k views
How to move category title above products column in Magento 2
In Blank theme the category name is located to the left just above the layered navigation sidebar.
I'd like to move the category name to the right, above the products column, so the side bar goes up.
1
vote
2answers
1k views
Override template for module: /vendor/magento/offline-payments/
I want to override a template located here:
(magento_dir)/vendor/magento/module-offline-payments/view/frontend/web/template/payment/purchaseorder-form.html
I have done the override path liks this, ...
2
votes
1answer
305 views
Review form in custom template not working Magento 2.3.4
I have created a custom template for the product page based on the attribute value.
in my template i used below code to display the review section.
<?php echo $block->getLayout()->...
0
votes
0answers
18 views
Update/overwrite Third party module which is installed in vendor folder
I have two extensions installed via composer and that is in vendor folder. I have done some customisation on those modules ie: updating the files in the vendor/mymodule/ folder. Now after a Magento ...
6
votes
1answer
8k views
Magento 2: how to declare a custom email template for your module
In Magento 1, you could declare email templates directly in the config.xml like this:
<template>
<email>
<custom_email_template translate="label" module="modulename">
...
0
votes
2answers
14 views
Can't read new product attribute in template
I added a new attribute to a product. The attribute is named "is_brand_new". The product shows in the catalog product view in the upselling and related slider.
But the new attribute is not in the ...
0
votes
1answer
40 views
Best method to use helper in any template
It seems to be impossible to use a helper in the template Magento_Catalog\templates\product\list\items.phtml.
I have tried it via argument injection:
app\design\frontend\company\base\Magento_Catalog\...
1
vote
1answer
55 views
can't update a page template
Hi all and nice to meet you.
Some days ago I've modified vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml in order to add a static phrase to every product page.
I ...
0
votes
0answers
23 views
Overriding the product template, where to find the default file?
Inherited a project and am not familiar with Magento enough to know where to find things.
There are a bunch of errors on our product detail page (app/design/frontend/{name}/{dir}/Magento_Catalog/...
18
votes
6answers
14k views
How to get store phone number in magento 2
I want to display phone number saved in magento admin in frontend in magento 2.
Like in magento 1.9 its like
$storePhone = Mage::getStoreConfig('general/store_information/phone');
0
votes
1answer
295 views
Magento 2 : How to change html/css classes of onepage checkout in custom theme
I'm creating a new theme from scratch, I would like to change the html code of the checkout/#shipping page. However, the template (Magento_Checkout/onpage.phtml) containing the html code that I would ...
0
votes
1answer
200 views
How to change html output of method “getItemHtml” in custom theme
I'm overriding the file Magento_Checkout/templates/cart/form.phtml, I stumbled upon some php code generating html code which I can't find its origin
Here is the code
<?php foreach ($block->...
2
votes
1answer
680 views
Magento 2 email_order_set_template_vars_before observer triggers only when I resend email in the admin
I created a new template var using email_order_set_template_vars_before observer and it works when I send email new order through the Magento admin. But it does not trigger when new order is placed. ...
0
votes
1answer
64 views
Display mini search form in template?
Magento 2.3.3
I want to display the mini search form form.mini.phtml in a template. In Magento 1 I did it like this:
$this->getLayout()->createBlock('core/template')->setTemplate('...
0
votes
2answers
44 views
Invalid template File after installing on Windows
I am just freshly installed Magento 2.3 on Windows 10 . When i load the url for front end , the templates are not loading correctly and there is Dark blank page when loading admin url. I found this ...
0
votes
1answer
29 views
Issue with calling attribute value on product view - Magento 2
I have two custom product attributes that I'm using in my product page template files. One of them doesn't seem to work and I'm wondering if it's something to do with the attribute code.
The ...
0
votes
1answer
146 views
<arguments> approach not overriding the template file
I wanted to override vendor/magento/module-sales/view/adminhtml/templates/items/column/name.phtml template.
And created new layout xml update as:
File: app/code/MagePsycho/CustomInvoice/view/...
2
votes
2answers
2k views
How to add custom template in Admin Order
I am currently creating a button for a single order in Magento(next to invoice, ship, reorder etc.). I would like the button to be inside a template to allow for php variables from that order and ...
0
votes
2answers
171 views
Add static page via custom theme
I created a custom Theme for our shop which works pretty fine.
Just one thing is bothering me: I created some words in the footer and want to link them to custom pages which only have static content. ...
0
votes
1answer
124 views
Override comment history order in backend
I'm trying to override the template for the comment history of a order (the part next to the total of the order).
this is my path to layout .xml :
app/code/Portail/Fournisseur/view/adminhtml/...