Questions tagged [phtml]

Denotes questions related to template `.phtml` files

Filter by
Sorted by
Tagged with
0
votes
3answers
31 views

How to use for loop in PHTML page

How to use for loop in phtml page i want to use the for loop in phtml page to complete my functionality <php? for(i=1;1<=3;i++): //My code endfor: ?> I used as above code.
1
vote
5answers
788 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
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 ...
0
votes
1answer
16 views

Magento 2.3: How do I retrieve the product price in form.phtml file and assign it to an HTML attribute data-purchase-amount?

How do I retrieve the product price in form.phtml and assign it to an HTML attribute data-purchase-amount ="" as code snippet meant for Klarna tagline placement as seen in the file below. <div ...
2
votes
1answer
2k views

Magento 2 - Get custom attribute within .phtml file using Magento\Catalog\Block\Navigation class?

I am trying to get a custom attribute value within my phtml file but struggling to get this to work? getData() & getCustomAttribute() doesn't seem to work. I believe this is because I am using the ...
0
votes
1answer
49 views

Magento 2: Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid block type: Perfectmirrors\PmmLayout\Block\Head

I am really not sure how to create the block class Pmm\PmmLayout\Block\Head , function of which $block->getAllPagesJSContent() should be called inside my phtml file pmm_head.phtml <...
1
vote
1answer
794 views

Magento 2 get catalog rule product details in final_price.phtml

I will try keep simple and short. e.g I have set a rule in catalogrule table and I am interested in 2 fields value: simple_action: by_percent discount_amount: 40.0000 and in catalogrule_product ...
0
votes
1answer
32 views

Magento 2: How to add a new phtml(template) to a layout file so I can use it in the head section?

I am trying to add a phtml template file to the layout file so that I can use this template in the head section to insert contents from an JS file. Please tell me what is the best way to do this?
0
votes
1answer
44 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 ...
2
votes
2answers
691 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
vote
1answer
29 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
25 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
14 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 ...
2
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 ...
3
votes
1answer
921 views

How to show all cart items in phtml file Magento 2?

What is the best way to show all the items/products that are in checkout/cart in a PHTML page? I have added a custom phtml page that shows some products, and also have a phtml page that want to ...
1
vote
1answer
27 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/...
3
votes
1answer
2k views

Using jquery in phtml got an error: Uncaught ReferenceError: require is not defined

I use jquery in my phtml frontend page like this: <script> require(['jquery', 'jquery/ui'], function($){ var currentUrl = '<?= $itemEditUrl ?>'; $('#link-cusom-campaign')....
1
vote
2answers
51 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 ...
2
votes
1answer
1k 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/...
1
vote
2answers
889 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
33k 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
15 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
15 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
1answer
22 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
55 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
30 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
28 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
160 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
11 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
39 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.
2
votes
1answer
744 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="...
5
votes
3answers
8k 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
1answer
1k views

Linking on button and open custom tab

Need to open custom tab on product view, from link. Magento 1.9.2.4 Custom theme. My tab, which is added just in one category by Custom Design <reference name="product.info.tabs"> <...
0
votes
0answers
12 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 ...
6
votes
1answer
868 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-...
2
votes
2answers
120 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
27 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 ?
16
votes
6answers
29k views

How to call helper method in .phtml file

Trying to develop something in magento 2. But, I didn't find how to call a Helper method in template(.phtml) file. I want a replacement of below code: $this->helper('modulename/helpername')->...
0
votes
0answers
9 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 ...
1
vote
0answers
23 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 ...
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
0answers
32 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
22 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 ...
2
votes
1answer
816 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
2answers
750 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: { ...
2
votes
2answers
1k 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
1answer
66 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
16 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
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
2 3 4 5
13