Questions tagged [phtml]
Denotes questions related to template `.phtml` files
679
questions
0
votes
1answer
60 views
Magento 2: How to insert a custom JS file in the header of custom theme. This custom JS file is placed in pub/media/pmm-custom directory?
I'm looking for a way to add a custom js file in the header.phtml file. I don't place custom JS file under theme_directory for a obvious reason. Could anyone please tell me how to override header ...
1
vote
1answer
30 views
Magento 2: Why do I see an extra IMG tag beside the actual IMG intended for logo on the home screen?
as seen in the image below, my Magento site displays an IMG tag before the IMG tag meant for displaying logo on the homepage. Please tell me how to eliminate the first unwanted IMG tag logo-white.svg. ...
0
votes
1answer
48 views
Magento 2: How to get only the file name of Home Page Logo?
is there a way to only get the filename of an Homepage logo in the logo.phtml template file? $block->getLogoSrc() in logo.phtml returns the URL to the logo, but I need only the filename like someimage....
0
votes
1answer
22 views
Magento 2.3.4 - Call phtml file within CMS block
I'm trying to call the following phtml file into a CMS block.
Phtml file location
app/design/frontend/{Package}/{theme}/Magento_Newsletter/templates/subscribe_footer.phtml
I tried using
{{block ...
1
vote
1answer
91 views
Calling ReferenceContainer or ReferenceBlock into phtml file
I am trying to call Template into list.phtml, this file is categories list file, here is the ReferenceBlock and ReferenceContainer code in xml file.
<page xmlns:xsi="http://www.w3.org/2001/...
1
vote
2answers
367 views
Magento 2: Custom module to override the logo.phtml file of the custom theme
Naming the custom module to override the logo.phtml file found at the path seen in the screenshot below a bit confusing to me as the module name is too long to decide on the naming. The vendor of the ...
1
vote
2answers
1k views
Magento 2 - Override info.phtml from Module Sales
I have a custom module and I want to override a .phtml file.
This is what I want to override:
magento/vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml
My module.xml:
&...
19
votes
4answers
39k views
How do I get the current product?
I'm trying to retrieve the current product's attributes in a block in Magento 2.
I can get a product, like ID 1:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $...
0
votes
0answers
16 views
Redirecting when submitting a Contact Form
I have a Contact page on Magento 2. After I try submitting the Contact Form, it redirects me to the page website.com/contact/index/index/ saying the Captcha is incorrect. Then when I submit it there, ...
0
votes
0answers
17 views
How to pass data from model file to phtml file?
I want to pass collection from model file and then, get HTML into model file.
How to do that?
Please help me.
Thanks.
0
votes
0answers
26 views
How do I correctly move products and categories between stores in magento1?
I currently have a magento 1.9 installation which uses two stores. I'm at the moment trying to move a category (as well as the subcategories and products) from one store to the other but I'm running ...
0
votes
4answers
271 views
How to get Magento 2 customer group ID
How to get Magento 2 customer group ID if user is logged in, in a .phtml file?
I have already tried with:
protected $_customerSession;
public function __construct(
\Magento\Customer\Model\...
0
votes
1answer
48 views
Magento 2 Add Anchor link in Notice, Error or Success Message
The link shows exactly how it is typed instead of an actual link. What am I missing?
<div class="message notice">
<div>
<?= $block->escapeHtml($block->getNoResultText(...
0
votes
1answer
55 views
How to add button at top of Layered navigation Filter from custom module?
I have a phtml that contain button like this in my custom module :
app/code/Vendor/Module/view/templates/button.phtml
<button> <span> <?= __('New Button') ?> </span> </...
0
votes
2answers
377 views
call phtml file in page builder in magento 2.3 enterprise
I want to call phtml file in static block that uses page builder in Magento 2 EE.
0
votes
0answers
16 views
Add autocomplete=“on” to e-mail field at Checkout
For some reason, we need to add the tag
autocomplete="off"
to the e-mail field at checkout (/checkout/).
So the current code:
<input class="input-text mage-error" type="email" data-bind="...
0
votes
1answer
158 views
Magento 2: How to pass object as a argument from phtml
I want to pass object as a argument from phtml file how can I do this? As I've checked we can pass string using $block->setData('var','test') but didn't found for object.
5
votes
3answers
9k views
How to call widget with products of specific category in “.phtml” file?
How can I call a widget that displays product from a specific category in a phtml file?
Currently I can only display "all_products" in my phtml file like that:
echo $this->getLayout()->...
0
votes
0answers
13 views
How to trigger an event that selects all the select attribute entries with the same value
magento 1.9
I want to do a function (maybe it is possible with js, but I'm not good at it yet) that after a customer selects an entry - IN THE FIRST MOMENT - in the select field "UNIDADE" all the ...
2
votes
2answers
138 views
Product 'new' tag/overlay with selection attribute in backend
So I am trying to create an option where I can select yes or no in the backend, and when it's set to yes, it adds an product overlay image with a 'new' tag. Here's what I have so far:
Created an ...
0
votes
1answer
92 views
Magento 2 override product list.phtml
I want to override product list.phtml and in my layout file catalog_category_veiw.xml i tried many methods but still not able to call my templates file
<referenceBlock name="category.products.list"...
0
votes
0answers
19 views
In checkout page while I'm switching the address the shipping method is not get updated Is there any way to fix the issue?
In checkout page while I'm switching the address the shipping method is not get updated Is there any way to fix the issue ?
0
votes
0answers
13 views
Magento 2 Shipping Form Fields Column Layout
Default Porto Theme Magento Layout for Shipping Page
We need to make it look like this:
Make fields 3 column instead of 1 column.
Bring Phone filed above and next to the Email field.
I have tried ...
2
votes
0answers
26 views
Save product-attribute value
How to save attribute value into DB from a phtml ?
ie, Phtml contains a custom input field which is rendered in the admin product edit page under a custom tab.
The value entered in the input field ...
0
votes
0answers
34 views
Magento2 - Category filter is not working for all product list
Magento2 - Category filter is not working for all product list
Issues page
0
votes
0answers
24 views
No output from catalog/view/frontend/templates/category/description.phtml in M 2.3.4
We don't get any category descriptions on category pages in Magento 2.3.4.
The /vendor/magento/module-catalog/view/frontend/templates/category/description.phtml
file is loading in frontend (see ...
0
votes
1answer
365 views
Error filtering template: Invalid template file in module
I have this issue and I don't know how to solve it.
My phtml file is under:
app/design/frontend/rwd/josefsteiner/template/home.phtml
and i tried to include this phtml file into my CMS site like ...
1
vote
0answers
18 views
Template notations in magento
I was working with the Algolia search module in Magento 2 and foud something like below in the template files. Can anybody let me know what this notation is called and where can I learn more about ...
0
votes
0answers
33 views
Use Magento UI Form Component Outside Of Form? (Product Category Selector)
I need to use the Product Category Chooser:
But not inside of a usual UI Component form. Is this possible? Basically I want to call it from a .phtml file for a custom admin page I'm building.
0
votes
1answer
114 views
Magento 2 How to call template file in block file
My block file form.php and I want to call phtml file in this block to display table in this custom admin form, I have no created a layout for this phtml file, if is there any other way to display the ...
1
vote
3answers
114 views
Can't get media image in the phtml file
I have a module that has a phtml file. I want to add an image from pub/media in that phtml file, but my attempts have been unsuccessful.
pub / media / catalog / category / shutterstock_259609874 ...
0
votes
3answers
61 views
How can i get phtml file in helper magento 2?
I have tried this solution but it is not working
$this->_layout->createBlock('Vendor\Module\Block\Productdesigner');
$response = $layout->setData(array("customer_data" => $result))...
0
votes
1answer
42 views
Modification to .phtml does not render
In content/page homepage I insert a widget from the porto theme:
{{block class="Smartwave\Filterproducts\Block\Home\LatestList" name="latest_product"
product_type="4" product_count="50" category_id="...
4
votes
2answers
2k views
Move/Push page.main.title block into Breadcrumbs Magento2
I want to move page.main.title block to my breadcrumbs container, not before or after it, I want to push it inside breadcrumbs template and remove other wheres.
So this is my ~/Magento_Theme/...
1
vote
1answer
408 views
How to get current page number from url in Magento 2
I want to check the page number which appears in a URL in a phtml file.
For example, if the URL is:
http://localhost/magento/index.php/shop.html?p=4
How can I get the value 4 in the .phtml file?
...
0
votes
1answer
44 views
Convert Magento 1 PHTML Code to Magento 2
I have a template from a customer's Magento 1 theme that I need to move to M2. The theme isn't the same but the template does what I need it to on M1 and I need this in Magento 2.
<ul class="...
0
votes
1answer
40 views
magento 2.2.3 how to add a new cms block or new phtml to product page
I want to add a new cms block or PHTML to the product page.
I have the following files composer.json, etc/module.xml, and registration.php
I have view/frontend/layout/catalog_product_view.xml
&...
3
votes
1answer
55 views
How to override .phtml file in module?
I am trying to change sign in or create an account message which is called by block named product.review.form in catalog_product_view.xml.
/vendor/magento/module-review/view/frontend/layout/...
0
votes
1answer
47 views
Changing phtml file via /app
In a previous question i asked where to find items.phtml file.
I found it and did the configuration and it worked. But when i did this it was via this path: vendor/magento/module-shipping/view/...
0
votes
1answer
74 views
Where to find Magento Configuration files
I'm trying to change a default setting in Magento, and I have found the solution how to change it.
The issue is I can't find the file, I need to modify items.phtml.
The path is app/design/adminhtml/...
1
vote
2answers
52 views
How can i translate custom elements in .phtml file according to store view
I have added a tag in form.phtml file which shows on view Cart Page.
<h1>Custom Cart Information</h1>
which effects as
Hence my store is multi-lingual when i change store view to ...
0
votes
0answers
22 views
How do I get the value of a property in my product on my phtml file?
Im looking at my
theme/Magento_Catalog/templates/product/price/final_price.phtml
and I am trying to set up a conditional so that when a custom field that another developer built in as a dropdown is ==...
1
vote
1answer
85 views
Can I change the extension from .HTML to .phtml?
I've got a custom payment module. I've .HTML checkout button page in this path.
\app\code\vendorName\moduleName\view\frontend\web\template\payment\vendor.html
Can i change .phtml instead of .HTML
0
votes
1answer
110 views
$block is not working in override phtml file
I override totals.phtml, but when I am calling my custom block in it, its not working.
File path:
Magento/vendor/magento/module-sales/view/adminhtml/templates/order/totals.phtml
Override File ...
0
votes
1answer
41 views
How not to use ObjectManager in phtml from template
First a bit of context, and at the end, my question
I added an EAV attribute to my customer. It's an attribute with multiple values, and I want to add it to the account information (for reasons).
I'...
0
votes
1answer
38 views
how to add custom js to end of footer on every page
I want to add a custom js file to all pages before the footer
i want to pass script through phtml
Is it possible to do this?
0
votes
3answers
44 views
i want to show a template before tabs
I want to show a template just before all tabs but it's not showing.
my code on file catalog_product_view.xml :
<referenceContainer name="product.info.detailed">
<block ...
8
votes
2answers
144 views
Magento 2 - Call phtml in helper
I have found multiple threads related to calling helper function in .phtml.
But I have a case where I need to call phtml file in helper and return HTML.
I have used this code:
//Where $this->...
0
votes
2answers
378 views
getIsResizeEnabled() is not working on Magento Backend
On Magento 2.3.2 version isResizeEnabled() is not working properly. It is throwing fetal error in the admin panel while I am going to the slider editing page.
<div id="...
0
votes
0answers
75 views
Display Product More Information In product Category Listing Page
i want to display product "More information" in catalog category page.
I copy that code from
/magento/module-catalog/view/frontend/templates/product/view/attributes.phtml
<?php $...