Questions tagged [phtml]

Denotes questions related to template `.phtml` files

Filter by
Sorted by
Tagged with
2
votes
1answer
765 views

How to call cms block of block type into custom header

I've made code of most viewed products which I'm trying to call under custom header. This is what I've done so far. Posted the block code under cms block by name 'most_viewed'. {{block type="...
0
votes
1answer
770 views

How to show embedded google map in magento 2 in phtml file

I am trying to add google map in the frontend. I added embedded google map in phtml. here is my code <?php $contacts_config = $this->getConfig('porto_settings/contacts'); $_enable = $...
0
votes
1answer
29 views

How do I get the language code in the product price amount template file?

How can I get the current language code in Magento_Catalog::product/price/amount/default.phtml?
0
votes
1answer
8 views

Add a module in other module

good afternoon I have the MageWorx multifee module and Id like to add the multifee on the quotes of the Cart2Quote module (emails ect). How can I do this Thank you for the attention Malka Hakuk
0
votes
2answers
895 views

call phtml file in custom email template in magento2

I need to pass the phtml file into email template. but I'm getting error like Error Log : Error filtering template: Invalid template file: 'Vendor_Module::emailproducts.phtml' in module: '' ...
0
votes
2answers
887 views

Search box: which phtml is getChildHtml using

I am using Magento 1.7. I am not sure of how getChildHtml() works. I have a piece of code in header.phtml, echo $this->getChildHtml('topSearch'); used for showing the search box in my page. But I ...
2
votes
3answers
2k views

Why my overriding of the success.phtml is not working?

I have copied and pasted the file from vendor/magento/module-checkout/view/frontend/templates/success.phtml to app/design/frontend/THEME/THEMENAME/Magento_Checkout/templates/success.phtml ...
0
votes
0answers
35 views

How to execute javascript code and pass to it some values after an event is triggered?

I'm trying to execute some javascript code and pass to it some values after an event (e.g. Add to Cart event) is triggered. To be more specific I'd like to pass: All logged customer details (...
0
votes
0answers
16 views

How can i retrieve order info (sku's of products, price of products, total, etc) from success page in a phtml file to put in a script in <head>

I need to retrive data from an order, on success page, this info is dynamic and i need to create a script for Dynamic Re-marketing Implementation. This is the script that has to be put after tag in ...
0
votes
2answers
23 views

create custom .phtml

HI I want to ask if I create a custom template phtml file. inside the coding do I need to include below 2 tags? <html></html> and <body></body>
0
votes
1answer
25 views

How to extend newcustomer.phtml in Magento 2.3?

I want to change the default text -- Creating an account has many benefits: check out faster, keep more than one address, track orders and more. So how would i extend the path vendor/magento/module-...
0
votes
1answer
21 views

Is it officially reccomened to add a totally new phtml template file in a theme, one which doesn't override an existing template?

Magento's documentation (https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/templates/template-walkthrough.html#template-customization-walkthrough) describes how to customise an existing ...
6
votes
1answer
966 views

How to dynamically load phtml file on a button click in Magento 2

I have a phtml file view.php and its block class View.php. I need to show that phtml on a modal on checkout page and to do that I'm pre-loading phtml file using following code : <div id="modal-...
1
vote
5answers
885 views

Edit .phtml file without have to run setup:upgrade

I'm running on Magento 2 version 2.1.7, but everytime i change my .phtml file content i need to run php bin/magento setup:upgrade to see the change. I already set my magento 2 to developer mode
2
votes
1answer
1k views

How to call a custom template phtml file on home page magento 1.9

How to call blog_slide.phtml on home page or in static block. {{block type="core/template" template="magentothem_blog/blog_slide.phtml"}} i tried this but nothing happens. <?php $enabled_slide = ...
0
votes
2answers
33 views

Get Page Title In PHTML? CE 2.4

I'm struggling with something simple. I'm trying to print the Page Title in the custom block from my custom.phtml and I'm getting nothing. I've removed the Magento original page title block from all ...
0
votes
2answers
60 views

Make Google reCaptcha field mandatory on a custom form (works fine on contact us and login form but not on a custom form)

I have a custom form and need to make recaptcha a mandatory field. It works just fine on a login and contact us page but not a separate custom form. code for a .phtml file is below- <?php $url = $...
0
votes
0answers
21 views

How to call gallery.phtml file in my custom phtml?

I have created a custom widget and now, I am trying to display product images Something like in the Product view page. On catalog_product_view.xml it calls /vagrant/www/vendor/magento/module-catalog/...
2
votes
1answer
902 views

Add phtml to Customer Account Edit in Adminhtml

I tried to add phtml to customer account edit in backend like this: app/code/Namespace/Module/view/adminhtml/layout/customer_index_edit.xml <?xml version="1.0"?> <page xmlns:xsi="http://...
0
votes
0answers
25 views

How to call .phtml file in my CMS page? [duplicate]

In my CMS page, I want to call a few phtml files that are similar to product view page. Basically, I want to create something like this: After enabling template hint, I was able to see the .phtml ...
1
vote
1answer
87 views

How to override the Catalog Widget PHTML file into custom module?

I need to override the widget template file /vendor/magento/module-catalog/view/frontend/templates/product/widget/new/content/new_grid.phtmlbut in xml file the phtml file was not mentioned at any ...
2
votes
1answer
2k views

Slick slider is not working properly in Magento2.3

I would like to use slick slider concept for compare products so I have implemented it on my Magento site. But It's not working as expected though the script has been loaded. I'm not sure where am I ...
6
votes
4answers
23k views

Magento 2: How to get current date, date time with format in .phtml file?

I already referred Magento 2 Get Current Store Date Time But how to use directly in .phtml file? Can able to get Date, DateTime & Also able to set it's format?
0
votes
2answers
837 views

i have added the custom js in the magento 2 module but giving 404 error in static folder!

I've added all thing like require-js and script in custom but not worked.Please show me path with correct example of bootstrap in Magento 2. my require-config.js is var config = { map: { ...
0
votes
0answers
11 views

How to show the static block only for logged in customers globally?

I have created static block in admin panel and want to show that block only for logged in customers. I have tried it via creating the module and in template file I have written a condition to show the ...
1
vote
1answer
15 views

How to open new tab on button click and send post data?

I've been trying to make my button open a new tab, the same way my form is doing but I've discovered that window.open() doesn't work on POST requests. SO, is there any other way I can make my button ...
1
vote
1answer
68 views

M2: Using small PHP script in .html file (or) Changing .html file to .phtml

We are running into an issue where we need to run a little php script within a .html file in Magento 2, namely; /app/design/frontend/CleverSoft/core/Magento_Checkout/web/template/minicart/content.html ...
0
votes
0answers
39 views

Receiving checkbox status as Yes or No on a custom form to an email template

I am new to php and html and trying my hands on the below code where I have a custom form as shown in below SS and once customer submits the form I need to get the checkbox status as 'Yes' if the ...
0
votes
2answers
1k views

Module that adds code snippet to every page on frontend

I'm working on a module for Magento 2, it's my first time writing a Magento module and I feel like there is something very basic I somehow fail to understand, I'm trying to add a code snippet to every ...
1
vote
2answers
103 views

PHTML Uncaught TypeError: $(…).lazy is not a function

After installing this module I get an error sometimes: Images won't load and the next error will show on console: Uncaught TypeError: $(...).lazy is not a function With a link to this section of code ...
0
votes
2answers
923 views

magento get the phtml file in email template with passing variable from email template to phtml file

I am trying to get the phtml file data in email template as well as passing variable from email template to phtml file as like below code. but am not getting the data from phtml file In email ...
0
votes
2answers
2k views

Modify the product price in minicart

I try to change the price from minicart with a custom product attribute, but in C:\xampp\htdocs\myproject\vendor\magento\module-checkout\view\frontend\web\template\minicart\item\default.html the ...
0
votes
1answer
1k views

which phtml file is use for New Order Confirmation Template for Guest/Seller?

i have created and implemented the code to call product thumbnail and product url for "New Order Confirmation Template" thats is use for customers.my code is below $objectManager = \Magento\Framework\...
3
votes
2answers
2k views

Magento 2 create custom block and phtml in Magento_Customer module

I want to create a new custom Block and Block phtml file same as the Customer Index Block for use to the customer, when customer login the customer just click on the left navigation link and access ...
1
vote
1answer
2k views

Media image attribute width, height and alt tag in a phtml - Magento 2

I have a custom .phtml file and I want to show a media image attribute within it. I have the following: $product = $block->getProduct(); $productImageAttr = $product->getCustomAttribute( '...
2
votes
3answers
221 views

Display data from Quote_item error

I have tried to display the data from Quote_item table in the database to file .phtml but it shows this error the code in Magento/MyHistory/Block/View.php <?php namespace Magento\History\Block;...
0
votes
1answer
1k views

How to set layout (phtml) in my widget?

I created my first widget but it's very simple and i want to create my widget with layout(using phtml page). my widget : Code inapp/code/local/AP/AD/Block/AD.php: <?php class AP_AD_Block_AD ...
0
votes
1answer
24 views

Add a custom input from phtml in admin form

I'm using custom phtml to display some data in an admin Ui form tab, and I want to be able to have a custom input that would get sent to the controller when I hit 'save' ui_form.xml <fieldset name=...
0
votes
0answers
24 views

How to pass data as parameter with block function in <script type=“text/x-magento-template”>?

How to pass data as parameter with block function in below script: <div class="col-sm-7 col-md-8 col-xs-9 col-lg-9 tag-content"> <h4><a target="_blank&...
0
votes
1answer
13 views

How to get Html post request value in Controller?

I've been trying to send the SKU of the product from the product page to another page so I can integrate it with an API. Here's my code phtml code: Here's my Controller code: For some reason I can't ...
0
votes
1answer
1k views

Displaying all the Product of a Category in Magento 2

how to display all the products of a category in a phtml file using an external file in Magento 2
1
vote
0answers
25 views

Magento Checkout updateCart.phtml

Can anyone explain how the product qty in the input field in view/frontend/templates/cart/item/configure/updatecart.phtml is being pulled. This phtml file is used when you're trying to edit a product ...
3
votes
2answers
1k views

What is the meaning of triple curly braces {{{ }}} in phtml template files? When and how do we use them?

There is a phtml template file in one of the third party Magento 2 extension which has triple curly braces {{{ }}} in it. When is this notation used, What does it represent?
0
votes
1answer
16 views

Block in reference root not loaded but loaded in reference header

Magento CE 1.9.4.5 I created a module and successfully had it loaded. The xml is below: <?xml version="1.0" encoding="UTF-8"?> <layout> <default> <...
0
votes
1answer
20 views

Override phtml template file

Simple issue : This is one of magento template core file : vendor/magento/module-sales/view/adminhtml/templates/order/totals.phtml How can I overide it ? I tried to create this one but it failed app/...
0
votes
0answers
6 views

pager isLastPage not correct

I have modified Magento_Catalog/templates/product/list.phtml. I added this code: /** @var $pagerBlock Magento\Theme\Block\Html\Pager */ $pagerBlock = $this->getLayout()->createBlock("...
0
votes
1answer
2k views

QuickSearch widget Magento 2. How to make closed search

I read a lot documentation and see code search. But don't understand how make an opening search by clicking on the icon. Mobile version have opening search by clicking on the icon. How make same for ...
14
votes
4answers
18k views

Magento 2 - Override base view file

I'm currently developing a Magento 2.0 theme. I'm trying to change the behaviour of the Tax class on the frontend. The file I need to change is located in app/Code/Magento/Tax/view/base/templates/...
0
votes
1answer
17 views

show all products in one page on magento 2

I want to show all products in one page from a custom cms block. This is the code I tried: {{block class="\Magento\Catalog\Block\Product\ListProduct" template="Magento_Catalog::list....
2
votes
2answers
799 views

Magento 2 : override phtml file issue

I faced problem with overriding a phtml file in Magento 2. I want this:- (1) Core Module of phtml Override By Custom Module called - A (2) Same phtml file of Module - A Override By Some Custom ...

1
2 3 4 5
14