Questions tagged [phtml]

Denotes questions related to template `.phtml` files

Filter by
Sorted by
Tagged with
0 votes
4 answers
35 views

Magento 2.4.x: How to pass custom variable from controller to phtml file?

Is there a way to pass a variable from controller to a phtml file without using registry? I tried this: Magento 2 pass data from Controller to Block and display in Template but it is not working.
user avatar
0 votes
0 answers
17 views

How to edit html block element to a form element? magento 2

Add FieldSet in Ui Rename category true true true 1 ...
user avatar
0 votes
2 answers
31 views

Field number validation

I need to validate a field in a custom form. The field should be not required, and should validate if the content entered in it are numbers. I added the validation on the form which works. What does ...
user avatar
  • 27
0 votes
1 answer
34 views

Magento 2.4.3 create custom pdf

Hi team i have custom data in table formate like below formate <tbody><tr> <td class='item-info'>BT40CC25120ARRIS<br/></td> ...
user avatar
0 votes
1 answer
138 views

Magento 2 Page builder product attribute cannot render html

In Magento 2.4.3 I have created a page builder product attribute labeled "Before Content" which the admin will populate with html and I want to show in product page. Under child theme I have ...
user avatar
0 votes
0 answers
8 views

Magento 2.4.2 in admin product edit Advanced pricing in Customer Group Price missing how to create this?

Magento 2.4.2 in admin product edit Advanced pricing in Customer Group Price missing how to create this? Please guide me how to add this fields?
user avatar
1 vote
1 answer
89 views

How can i resolve Empty string supplied as input in DOMDocument::loadXML() in magento 2?

when I compile my code I have this kind of error accurse Warning: DOMDocument::loadXML(): Empty string supplied as input in /mnt/data/home/cloudwaysapps.com/ssucdkafzj/public_html/setup/src/Magento/...
user avatar
0 votes
1 answer
110 views

How to Call Controller When hit any URL from website in Magento 2?

I have my custom controller that has my custom code, now I need to run that code when any URL hits from the site. My Controller URL is like common/index/code run can anyone help me how can I archive ...
user avatar
0 votes
1 answer
60 views

Magento 2 - Use knockoutjs and html instead of phtml

How can I use html and knockoutjs on a custom site which is accessible from a custom controller? For example my controller route is threepartment/vault/index If I go to: www.example.com/threepartment/...
user avatar
  • 2,380
0 votes
1 answer
12 views

Magento 2 - Make fields in custom form required

I created a custom controller and model where users can save bank payment data information. I added a form where users can change data from the model. Is there a way to reuse the magento code to ...
user avatar
  • 2,380
0 votes
1 answer
18 views

Magento Module - PHTML

I need some help with a problem I have with a module, I know this is a newbie question but here i go. <div class="field company <?= $block->isrequiered() ? 'required' : '' ?>">...
user avatar
0 votes
0 answers
23 views

How to get current category name in catalog view page(catalog_category_view.xml)?

I have a view model with a method for returning the category names from the current_product (Works in product view page). However it returns null when being used in the catalog view page (...
user avatar
0 votes
3 answers
39 views

How to add block for Specific category's products in Magento 2 by layout/catalog_product_view_attribute_set_id_[id]?

I am trying to the make block visible only in Category 3. The block renders fine in catalog_product_view.xml. However when I change the file to catalog_product_view_attribute_set_id_3.xml, it doesn't ...
user avatar
0 votes
1 answer
35 views

Unable to retrieve value from Block

I am using Magento 2.3.5-p2 I am adding a Google Tag Manager integration code at the Catalog Search, thus this requires me to modify the catalogsearch_result_index.xml and add a new .phtml file which ...
user avatar
0 votes
1 answer
33 views

How to change a phtml file in the vendor/ folder?

I am trying to make changes to the code in a phtml file at vendor/magento/module-newsletter/view/frontend/templates. I have made a new directory and placed the new phtml file to the app/design/...
user avatar
  • 21
0 votes
2 answers
196 views

Magento 2 Passing parameters to Content Blocks

I'm new to Magento I want to create a block in the admin panel (Content > Elements > Blocks) which contains HTML code, CSS style, and some dynamic parameters under its content box. Example: <...
user avatar
0 votes
1 answer
60 views

Magento2.4 How to add product to cart with a customizable option?

I am trying to add a product to cart with a customizable option. I can add simple products, but I have not successfully been able to add a product with an option. The product will eventually be added ...
user avatar
0 votes
3 answers
58 views

Magento 2, How to call Controller custom function?

I have a controller with custom function getPost(). I want to call this function from my phtml My phtml code: <form id="my-form" method="POST" action="<?php echo $block-...
user avatar
0 votes
0 answers
119 views

How do I pass in a viewModel to a core block that has been overridden?

I am rewritting the /vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml file. The file MyCompany_MyApp::product/default.phtml works fine, but I want to pass a ...
user avatar
0 votes
3 answers
127 views

Magento 2: Log Error message on phtml

how can I print the log error message in the phtml file? the error can be shown to the user on the page
user avatar
0 votes
1 answer
59 views

Magento 2.4 How to get category of current product from within ViewModel without using objectManager?

This works but uses objectManager namespace Myvendor\Myprogram\ViewModel; class CatLogic extends \Magento\Framework\View\Element\Template implements \Magento\Framework\View\Element\Block\...
user avatar
0 votes
0 answers
24 views

How To Add Product Tab For Specific Product Type In Your Custom Module Magento 2.4?

I create my custom product type name "rental" that create successfully now I need to add a custom tab in that specific product type I create catalog_product_rental.xml but the /run/user/1005/...
user avatar
0 votes
0 answers
44 views

How can I use Magento2 GraphQL in pure JavaScript?

I see that Magento GraphQL was used to build Progressive Web App. Can I use GraphQL for my simple web application? For example, I need to get all items of the user wishlist on the user dashboard page. ...
user avatar
0 votes
1 answer
99 views

Pass variable from template (phtml) to CMS page

I have this code, which is rendering a static block in a template file (phtml). $_html = $this->getLayout() ->createBlock('Magento\Cms\Block\Block') ->setBlockId('test-block') ...
user avatar
  • 359
0 votes
0 answers
7 views

i added a blog widget in homepage and i want to find the file that have the widget HTML code

I added a widget in my home page content and I want to find the files and HTML code of this widget where is placed in my Magento 2.3.6 files, because I want to edit on it
user avatar
0 votes
1 answer
98 views

Magento 2 : How to Override Core Template Magento_Review::helper/summary.phtml

How to change the template in a custom module. Original path = vendor/magento/module-review/view/frontend/templates/helper/summary.phtml I want to change this template to my own when my module is ...
user avatar
  • 45
0 votes
1 answer
22 views

What function do I use to replace the depreciated escapeJs()?

I am using Magento2.4. In my phtml template, I am trying to escape an a argument that is being passed into a javascript file via requireJS, but PhpStorm is warning me that escapeJs() is depreciated. ...
user avatar
0 votes
1 answer
45 views

Can't get file in Post-Controller from input in Phtml

I have a file-input field in my pthml and would like to use it to upload picture files. [...] <div class="field file"> <label class="label&...
user avatar
0 votes
2 answers
81 views

.phtml file changes won't show, even though my static files and cache are cleared

So this is driving me a little nuts, I'm working on a child theme of Luma and the design requires me to modify some of the catalog blocks, so I've copied over a .phtml file into my theme folder. The ...
user avatar
0 votes
2 answers
148 views

How to add view model to existing phtml and block

Is there any possibility to add ViewModel to the existing block and PHTMl file? I'm trying to add ViewModel to the file below. sales_email_order_renderers Code: <?xml version="1.0"?> &...
user avatar
  • 828
-1 votes
2 answers
296 views

How can i override module_backend file in app/design folder in magento 2?

i need to need to change admin copyright content they comes from this vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml so how can i override this in my app/design folder ...
user avatar
1 vote
1 answer
181 views

How to call php block function with parameters from a js file?

I'm new to Magento, and I'm not sure how to make this work. I tried searching a lot but could not find anything related. I have a block function in my custom module which takes 2 parameter public ...
user avatar
  • 11
0 votes
1 answer
192 views

Error: Call to a member function getCategoryId() on null when trying to get Category from \Magento\Catalog\Block\Product\View

so I'm trying to check if the category ID is 6 to change the text that appears in delivery time, but when I try to call the $_product, it says that it's null, and I can't figure out why. Any help ...
user avatar
  • 127
0 votes
0 answers
30 views

Importing Magento\Catalog\Block\Product\View to theme phtml file

so I'm trying to overwrite the title.phtml in my Magento_Theme file, and its working, but now I want to get product data from Magento\Catalog\Block\Product\View, but it says that the variable in ...
user avatar
  • 127
0 votes
0 answers
25 views

Magento 2 extend errorPlacement in knockout

I need to extend errorPlacement from validation.js in Magento_Checkout/web/.../email.html I want to append error's (in checkout login section) in a custom div created by me in email.html. I tried 2 ...
user avatar
0 votes
3 answers
105 views

I want to delete marker from my html, css. Its showing on store view

I have marker showing in my slider on store view how can I remove it, I can't find this code in html. [
user avatar
0 votes
0 answers
19 views

Success screen stuck in luma theme Magento 2.3.5 Community Edition

everything good? I'm trying a problem that I've never caught in these 2 years of magento, I would like to know if you've been through this for tips on how to get out. On the success screen, the layout ...
user avatar
0 votes
2 answers
57 views

I want to call phtml file from Magento_Theme to static block. but it is giving some error

PHTML file is located in Magento_Theme/templates/html/breadcrumbs.phtml. I tried with the code {{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html\...
user avatar
0 votes
0 answers
17 views

I want to add swatch images from product page to home page product list

I want to add swatch images from product page to home page product list. swatch images from here to to here, replace the text"THIS is a custom" to swatch images How can I do this.
user avatar
0 votes
1 answer
283 views

How to display CMS static blocks based on store in Magento 2

I have created two stores english and german and created static blocks with different contents based on the store in admin.Block Id(test) for both stores are the same but both blocks assigned to ...
user avatar
0 votes
0 answers
37 views

How to call javascript function in magento 2

<div class="block social-login-authentication-channel account-social-login"> <div class="block-content"> <div class="actions-...
user avatar
0 votes
1 answer
102 views

Override product bundle select.phtml file in Magento 2

I'm trying to override the select.phtml used on the bundle product view page I've put it here: app/design/frontend/[vendor]/[theme]/Magento_Bundle/templates/catalog/product/view/type/bundle/option/...
user avatar
0 votes
1 answer
99 views

Get order product item count in order success page - Magento 2

I want get number of product order in order success page. This found solution magento 1.9 visit Get ordered product count in magento <?php $_order = $this->getOrder() ?> <?php echo $_order-...
user avatar
0 votes
2 answers
150 views

Magento 2 Can i call two phtml file into one?

I have two phtml files, I want to use one for just the heading title and content. then the second phtml file I want to use it to call a table with a simple form submission. is this possible, if anyone ...
user avatar
  • 45
0 votes
1 answer
84 views

How to share one phtml file variable output to another phtml file

In custom modules, I want to share my module A output variable $value = "one" to module B, print like $value How to share this?
user avatar
  • 103
0 votes
1 answer
78 views

Magento 2 Override admin phtml

I've made a new module and I would like to override the vendor/magento/module-config/view/adminhtml/templates/system/config/form/field/array.phtml I've copied the file in app/code/myVendor/myModule/...
user avatar
0 votes
1 answer
57 views

Override Extension (/vendor) in app/frontend

I'm trying to override a layout .phtml file for a 3rd party extension which is located in /var/vendor_name/extension. As I understand, I should not be modifying the /vendor files, but this extension ...
user avatar
  • 3
0 votes
2 answers
38 views

How to used same code in helper data in magento 2?

Here is my object manager code can any one guide me how can i used same code in my helper data $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customOptions = $objectManager ...
user avatar
0 votes
3 answers
504 views

Magento 2 - Get name of templates block from .phtml file

Is it possible to get the block name of the current template? For example I added a block to catalog_product_view.xml: <block class="Magento\Contact\Block\ContactForm" name="...
user avatar
  • 2,380
0 votes
1 answer
37 views

Magento 2: How to insert a custom phtml file in a static block

I need to insert a phtml file in a static block. The Location of the file is app/design/frontend/Pearl/weltpixel_custom/edu/custom.phtml I use "weltpixel_custom" as my child theme This is ...
user avatar

1
2 3 4 5
15