Questions tagged [class]

A template for creating new objects that describes the common state(s) and behavior(s). NOT TO BE CONFUSED WITH CSS CLASSES. Use [css] instead.

Filter by
Sorted by
Tagged with
0 votes
2 answers
25 views

Magento 2 - Class doesn't Exists when compiling

I tried to create a simple plugin (magento 2.4.3-p1) : But when I run the compiler, I have the following error : In PluginListGenerator.php line 326: Plugin class Fseb\ModuleA\Plugin\Catalog\Model\...
ILOA's user avatar
  • 3
1 vote
0 answers
23 views

Magento 2 + Add inlineEdit feature in related products grid on admin product edit page

I want to add an inlineEdit feature same as admin customer grid, in related products grid on admin product edit page. For that I extended Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Related ...
Dhara Bhatti's user avatar
0 votes
1 answer
34 views

Syntax error on class name added to property declaration?

I'm using Magento 2.4.2-p1, Apache 2.4.54, php 7.4, and am getting a ParseError: syntax error when a class name is declared with a property declaration - is this expected? is there a work around? From ...
theJoey's user avatar
0 votes
1 answer
22 views

Can a widget extend a class besdides Template?

All widgets I have ever created programmatically extends Template implements BlockInterface and I was curious if you can extend different classes for a widget module's block?
A. Andersen's user avatar
1 vote
2 answers
193 views

Replace body class name attribute in Layout

Is it possible to replace class name value attribute in layout? for example body has 3 classes x y z I want it to be c y z how to replace class x to c I can add class c using <attribute name="...
Mahmoud M. Abdelmalek's user avatar
2 votes
1 answer
137 views

Unable to override \Magento\Directory\Block\Data class-magento2

Can anybody help me to add a class in getCountryHtmlSelect() I have tried to override \Magento\Directory\Block\Data file using plugin but i can't extend that so i go for perference. added code in di....
Ajith's user avatar
  • 66
2 votes
1 answer
667 views

Magento 2: Add class to body from PHP

I need to create a extension which adds a class to the body tag. The class should be defined in the magento 2 backend in the extension settings. How can I do this?
Black's user avatar
  • 3,100
0 votes
1 answer
362 views

How to add Custom class or ID on Magenot 2 Product Admin Grid Columns

How to add the custom class or ID on Magento 2 Product Admin Grid Columns basically I want to add a class or id on ( qty, price, name, SKU ) on these fields. Any help is appreciated.
Prits's user avatar
  • 626
0 votes
3 answers
171 views

Error when extend vendor wishlist cart file

I am using Magento2.3.5-p2 I want to extend instead of overwriting a Magento class The class that I want to extend is vendor/magento/module-wishlist/Controller/Index/Cart.php so to extend this I ...
Mohd Farhan Bin Ramli's user avatar
0 votes
1 answer
3k views

How to override a method in Magento 2

I would like to override a method of a class, but it does not work. The changes added to the method are not used. File \Magento\Sales\Model\Order\Email\Sender.php <?php /** * Copyright © Magento, ...
Reshad Zazai's user avatar
0 votes
2 answers
2k views

Cannot use 'parent' in a class with no parent

I am trying to extend the \Magento\Framework\App\Action\HttpPostActionInterface class and my construct looks like this: public function __construct( \Magento\Framework\App\Action\Context $context, ...
user2813308004's user avatar
0 votes
3 answers
867 views

magento 2 - class error on backend after remover facebook-for-magento

I'm Newbie, after remove facebook for magento now encounter error. magento backend catalog-products unable to load. There has been an error processing your request Class Facebook\BusinessExtension\...
murugan's user avatar
0 votes
2 answers
972 views

Magento 2 : Override Magento\SalesRule\Model\RulesApplier class

How to override Magento\SalesRule\Model\RulesApplier class in custom module ? i have tried etc/di.xml <preference for="Magento\SalesRule\Model\RulesApplier" type="Myvendor\SalesRule\...
devhs's user avatar
  • 477
0 votes
1 answer
236 views

Override Model from third party vendor in custom theme

I am trying to override a Model from a third Party vendor in a custom-theme. The original file was: /vendor/3rdpartyompany/3rdpartymodule/Model/Formatter/BaseImage.php I copied that file over to: /...
Mario's user avatar
  • 433
0 votes
1 answer
50 views

How to add new class form-control input field to billing address section in magento 2.4

How to add new class form-control input field to billing address section in magento2.4
Ravindrasinh Zala's user avatar
0 votes
2 answers
193 views

Magento 2 error - Class 'Vendor\Sales\Model\Order\Email\ScopeInterface' not found in

use Vendor\Sales\Helper\Data; use Magento\Framework\DataObject; use Magento\Framework\Event\ManagerInterface; use Magento\Payment\Helper\Data as PaymentHelper; use Magento\Sales\Model\Order; use ...
devhs's user avatar
  • 477
0 votes
1 answer
325 views

Ajax call not working on Magento_Wishlist

I have created a controller for products added wishlist or not, if available include class name, Controller: <?php namespace Vendor\Mymodule\Controller\Index; class Wishlist extends \Magento\...
zus's user avatar
  • 145
0 votes
1 answer
292 views

Reflection alternative for dynamic loading classes

I'm currently writing a module that allows wordpress style shortcodes to be used inside the Magento 2 categories, blogs and pages. I'm at the point where the shortcode class and key => value pairs ...
Duncan Wardlaw's user avatar
0 votes
1 answer
792 views

How to add class for Reference Block Arguments in xml file?

I have created custom in link header, <referenceBlock name="header.links"> <block class="Magento\Framework\view\Element\Html\Link" name="custom-link" before=&...
zus's user avatar
  • 145
0 votes
4 answers
1k views

How to add custom class in Magento 2 Category page?

I want to add custom class in Magento 2 category page like in column main and sidebar sidebar-main How to add custom class with these class ? Any help is appreciated.
Prits's user avatar
  • 626
0 votes
1 answer
30 views

I added a Curl.php file in another location. Now I have a Fatal Error when accessing the backend of my store

I added a Curl.php file in another location. Now I have a Fatal Error when accessing the backend of my store. (Yes, I deleted the other location already, but I still receive the error) Does anyone ...
Mike.Bean's user avatar
1 vote
0 answers
959 views

Magento 2.4 Magento\CatalogSearch\Model\Adapter\Mysql\Filter\AliasResolver does not exist

After upgrading to magento 2.4 from 2.3.5-p1 and running setup:di:compile, the following error occurs: In ClassReader.php line 43: Class Magento\CatalogSearch\Model\Adapter\Mysql\Filter\...
A Q's user avatar
  • 11
0 votes
1 answer
280 views

Magento 2 - How to find out which data is available for an object?

I have a quote item: /** * @var \Magento\Quote\Model\QuoteFactory */ protected $_cartFactory; public function __construct( ... \Magento\Checkout\Model\CartFactory $cartFactory, ... ) { ...
Black's user avatar
  • 3,100
0 votes
1 answer
312 views

How use preference for core widget block class?

How override core block class for core Catalog Category Link widget? I try: <preference for="Magento\Catalog\Block\Widget\Link" type="Vendor\ModuleName\Rewrites\Block\...
David Young's user avatar
0 votes
0 answers
394 views

Magento 2 - php fatal error class not found

Whatever I try to run on my SSH-Server it displays the same error: $ php bin/magento cron:install [--force] PHP Fatal error: Uncaught Error: Class 'Magento\Setup\Mvc\Bootstrap\InitParamListener' not ...
user91013's user avatar
0 votes
1 answer
477 views

Magento 2 hide sidebar only in category view for mobile

I am trying to hide sidebar in my magento 2 instance with css only for mobile view and only in category view pages. I tried: @media (max-width: 767px) { .category-view .sidebar .sidebar-main { ...
G. G.'s user avatar
  • 1,078
2 votes
0 answers
121 views

What real world items do ShippingAssignment objects correspond to

I've been looking at the class \Magento\Sales\Model\Order\ShippingAssignment and I have absolutely no idea what it represents. The OrderInterface has a shippingAssignments attribute set through ...
Dom's user avatar
  • 468
0 votes
1 answer
132 views

Magento 2.3 add body class to product page if custom options

I want to add a body class "custom-options" to the product page, when the product got some custom options. How can I achieve that?
JGeer's user avatar
  • 1,420
0 votes
2 answers
332 views

How to add custom html class to "Sign Out" button in magento 2

How to add custom HTML class to "Sign Out" button in magento2
Jaisa's user avatar
  • 2,522
0 votes
1 answer
360 views

magento 2.3 overide date calendar class

I am trying to override a date calendar class in Magento. But when I try doing it the date input from the product page disappears. Basic I want to override the date calendar script to add custom ...
Lasse Bang's user avatar
0 votes
1 answer
151 views

Extending third party extension but Class does not exist when compiling

I'm extending a third party extension, and it looks like this, with registration and module I know their right. di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...
Rui Silva's user avatar
  • 374
0 votes
1 answer
143 views

Magento 2 - Injecting a model into a class? How to?

I have a class where I'd like to inject a model into it, to use the code already created in the model. How would I go about doing this in my class? Thank you.
James's user avatar
  • 281
0 votes
1 answer
29 views

What is the difference between usage of '/' and '\'?

<block class="Magento\Framework\View\Element\Template" name="test" template="test/example.phtml" /> In above example for class used '\' and template '/' use Magento\Framework\...
Nitesh's user avatar
  • 2,088
0 votes
3 answers
1k views

Magento 2 - Adding Class to individual Navigation Items on Account Page

I need to add a class to each of these navigation items on the Account page. The file containing the navigation wrapper can be found at (vendor\magento\module-customer\view\frontend\templates\account\...
Developer's user avatar
0 votes
2 answers
3k views

Magento 2 - Add Class to ReferenceBlock

I need to add a new class to a referenceBlock, specifically the nav items in the Account Page. <referenceBlock name="customer-account-navigation-account-link"> <arguments> ...
Developer's user avatar
0 votes
1 answer
830 views

How to solve class not found error in magento 1.9?

I have try to install stamped.io extension, after install back-end showing following error if i click stamped.io setting. Fatal error: Uncaught Error: Class '...
zus's user avatar
  • 145
4 votes
1 answer
1k views

Magento 2: Add active class on selected shipping method

I want to add active class When I select a shipping method on the checkout page. For example: If I select free shipping then active class should be added on radio button which is free shipping. ...
Ronak's user avatar
  • 436
2 votes
4 answers
7k views

Get product details by product id in Magento 2

Hi i have a product id 22 . I want to get the product details by this id . in this page default/Magento_Catalog/templates/category/Products.phtml Example : $product=get_product_details(22); I ...
John's user avatar
  • 75
0 votes
1 answer
46 views

Error in magento 2.3 Class Does Not Exist in backend and frontend

I upload my magento 2.3 on my server, so when i navigate in the frontend the navbar is disappeared see the photo so when change the mode to developer, to see the error in backend output print this ...
Emmanuel Ortega's user avatar
1 vote
1 answer
173 views

Magento 2.2.8 : Class Magento\Ui\Block\Wysiwyg\ActiveEditor does not exist

I have updated from version 2.2.7 to 2.2.8 now I have this error Class Magento\Ui\Block\Wysiwyg\ActiveEditor does not exist in the back-end when I try to access for example to Categories page. ...
VP13's user avatar
  • 11
1 vote
1 answer
121 views

Class function not working

I tried to call the class using construct method. <?php namespace Vendor\Module\Helper; class Data extends AbstractHelper { /** * @var \Magento\Framework\App\Config\ScopeConfigInterface *...
Moin Malek's user avatar
1 vote
2 answers
233 views

How zend libs file(Rewrite Zend_Pdf_Resource_ImageFactory) class in Magento 2

i am trying to override Zend libs class like magento2 using preference My di.xml code is <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
HaFiz Umer's user avatar
  • 1,620
2 votes
1 answer
38 views

Conceptually speaking, management interfaces are used for what?

For example Magento\Catalog\Api\ProductManagementInterface Magento\Catalog\Api\ProductLinkManagementInterface They are used for very specific tasks?
Gianni Di Falco's user avatar
0 votes
2 answers
184 views

Why does magento 2 use hard coded "Factory" class?

As I've checked in Magento 2.3.1 Sales module there is one hardcoded Factory file in below path: vendor/magento/module-sales/Model/ResourceModel/Order/CollectionFactory.php And in Cms module there ...
Dj3's user avatar
  • 101
2 votes
0 answers
113 views

Add css class to item on checkout xml

how can i add a css class eg.: class="myClass" to an item on checkout xml? for example <item name="after-place-agreements" xsi:type="array"> <item name="component" xsi:type="string">...
Altravista's user avatar
1 vote
2 answers
862 views

Declaration of overridden method should be compatible with parent class

This is my custom class: class Collection extends \Magento\CatalogSearch\Model\ResourceModel\Search\Collection { public function _getSelectCountSql($select = null, $resetLeftJoins = true) { $...
Rufus's user avatar
  • 621
0 votes
1 answer
1k views

How to disable a single 3rd party module plugin class in Magento 2?

3rd party module has a file in the following location: Amasty/Xsearch/Plugin/Framework/View/Page/Config.php. This file contains a class like this: <?php namespace Amasty\Xsearch\Plugin\...
Greg's user avatar
  • 2,899
0 votes
0 answers
42 views

Unable to override model class, only this file has problem

I am overriding Worldpay Model class that create xml request file. <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Charlie's user avatar
  • 3,116
2 votes
2 answers
755 views

How to pass data from UI Form to PHP Class

I have created a form using UI component, This form has a select dropdown which displays option related to current entity id if form is in edit mode and all options if a new entity is being added by ...
Kapil Dev Singh's user avatar
1 vote
0 answers
48 views

Magento 2.3.0 - Class MailCampaigns\Connector\Helper\MailCampaigns_API does not exist [closed]

I installed the module (https://github.com/mailcampaigns/Magento2Connector) On my Magento (2.3.0 version) application. It installed successfully but when I try to add a product to the cart. It's ...
Mr. Nanhe's user avatar
  • 129