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
2 votes
1 answer
62 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?
user avatar
  • 2,413
0 votes
1 answer
47 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.
user avatar
  • 536
0 votes
3 answers
38 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 ...
user avatar
0 votes
1 answer
569 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, ...
user avatar
0 votes
2 answers
540 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, ...
user avatar
0 votes
3 answers
260 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\...
user avatar
0 votes
1 answer
452 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\...
user avatar
  • 367
0 votes
1 answer
89 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: /...
user avatar
  • 383
0 votes
1 answer
37 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
user avatar
0 votes
2 answers
60 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 ...
user avatar
  • 367
0 votes
1 answer
214 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\...
user avatar
  • 95
0 votes
1 answer
72 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 ...
user avatar
0 votes
1 answer
255 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=&...
user avatar
  • 95
0 votes
4 answers
465 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.
user avatar
  • 536
0 votes
1 answer
17 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 ...
user avatar
1 vote
0 answers
737 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\...
user avatar
  • 11
0 votes
1 answer
99 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, ... ) { ...
user avatar
  • 2,413
0 votes
1 answer
209 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\...
user avatar
0 votes
0 answers
337 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 ...
user avatar
0 votes
1 answer
243 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 { ...
user avatar
  • 922
2 votes
0 answers
68 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 ...
user avatar
  • 406
0 votes
1 answer
94 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?
user avatar
  • 1,474
0 votes
2 answers
194 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
user avatar
  • 2,408
0 votes
1 answer
299 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 ...
user avatar
0 votes
1 answer
43 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/...
user avatar
  • 344
0 votes
1 answer
52 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.
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\...
user avatar
  • 2,008
0 votes
3 answers
950 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\...
user avatar
0 votes
2 answers
2k 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> ...
user avatar
0 votes
1 answer
689 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 '...
user avatar
  • 95
4 votes
1 answer
865 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. ...
user avatar
  • 361
2 votes
4 answers
5k 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 ...
user avatar
  • 75
0 votes
1 answer
43 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 ...
user avatar
1 vote
1 answer
169 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. ...
user avatar
  • 11
1 vote
1 answer
97 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 *...
user avatar
1 vote
2 answers
156 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:...
user avatar
  • 1,515
2 votes
1 answer
21 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?
user avatar
0 votes
2 answers
140 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 ...
user avatar
  • 81
2 votes
0 answers
76 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">...
user avatar
1 vote
2 answers
686 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) { $...
user avatar
  • 601
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\...
user avatar
  • 2,749
0 votes
0 answers
41 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:...
user avatar
  • 3,036
2 votes
2 answers
436 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 ...
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 ...
user avatar
  • 109
0 votes
1 answer
1k views

How i can extend more than one class in magento 2? [duplicate]

<?php use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\View\Result\PageFactory; use Magento\Framework\App\RequestInterface; use ...
user avatar
  • 1,047
6 votes
2 answers
536 views

Proper way to call a model constant in Magento 1

I have the class below: class Company_Module_Model_Somemodel extends Mage_Core_Model_Abstract { const SOME_CONST = 'constant_text'; } What is the proper and correct way to call the constant ...
user avatar
  • 527
0 votes
1 answer
458 views

Create custom payment gateway in Magento 2?

Which class we need to extends,implement interface and method use when create a custom payment gateway.
user avatar
  • 1,214
1 vote
3 answers
1k views

How to use require_once in magento 2

I'm trying to include a PHP class in magento 2. I use a require_once and create a folder lib in the root of my module and there I put the folder that contains the class lib/Meli/Meli.php Also try in ...
user avatar
4 votes
0 answers
51 views

Can Magento 2 Proxies be used to handle non existing class

I am building an extension which is dependent on multiple third party payment gateways. So I have created a special service class which gives the respective payment gateway class object depending on ...
user avatar
  • 7,342
0 votes
1 answer
2k views

Getting Fatal error: Class 'IntlDateFormatter' not found in Magento2 [duplicate]

I am getting Fatal error Class 'IntlDateFormatter' not found in /home/sanjeevkahali/public_html/sanjeev/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 111:
user avatar
  • 539