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
1answer
45 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\...
0
votes
1answer
8 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 ...
0
votes
1answer
24 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=&...
0
votes
0answers
82 views

Fatal error: Cannot declare class since because the name is already in use

I have read the other articles but they still don't help. I have a PHP page. The PHP page has a public function that is calling a private function. On the public function it has a line that says ...
3
votes
1answer
1k views

Magento2 rewrite: product resource collection class does not effect on functions

I have rewrite catalog product resource collection Magento\Catalog\Model\ResourceModel\Product\Collection. Class override successfully but functions override is not working. Suppose, i want ...
0
votes
3answers
54 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.
1
vote
1answer
946 views

Magento model extension experiment, return: “class does not exist”

trying to create a new model class to be used as a source model for the admin configuration setting of a new module, I got the following message: Class Makke\GroupOrders\Model\Config\Source\Sort ...
0
votes
1answer
20 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, ... ) { ...
0
votes
1answer
16 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 ...
1
vote
0answers
160 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\...
0
votes
0answers
11 views

Unable to extend class extends AbstractCollection in Grid/Collection Magento 2

Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, Magento\Framework\Event\ManagerInterface $eventManager, $mainTable, $eventPrefix, $eventObject, $resourceModel, $model = '...
0
votes
1answer
46 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\...
0
votes
0answers
69 views

Magento 2 - Use multiple block classes in template

I try to show a block in the header which shows different content, depending on whether the user is logged in or not. If the user is logged in, then I show: If the user is NOT logged in, then I like ...
0
votes
0answers
100 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 ...
0
votes
1answer
65 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 { ...
1
vote
0answers
19 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 ...
1
vote
1answer
156 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. ...
0
votes
1answer
27 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?
0
votes
2answers
98 views
7
votes
8answers
14k views

Magento 2 custom layout add body class

I create custom page layout. In admin area select this layout: Amin -> Products -> Categories -> MyCategory -> Design -> Layout Q: How add css class to body tag? My file: app/design/frontend/...
2
votes
2answers
673 views

What should we use instead of the Magento\Checkout\Model\Cart model?

The Magento\Checkout\Model\Cart class was marked as deprecated a long time ago (since 2.1 ver.). What should I use instead of it to work with a customers cart? I know that I can work directly with a ...
0
votes
1answer
198 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 ...
0
votes
1answer
22 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/...
0
votes
1answer
25 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.
6
votes
2answers
3k views

Magento 2 : add custom class on checkout page shipping address field

I am using magento 2.1.7. I want to add one class in country select box on checkout page shipping address. If anyone knows please help to add class.
0
votes
1answer
27 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\...
0
votes
2answers
496 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\...
0
votes
2answers
1k 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> ...
0
votes
1answer
417 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 '...
4
votes
1answer
464 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. ...
15
votes
1answer
10k views

DI & Extending a Block on Magento 2

I seem to be struggling to grasp Magento 2 dependency injection with blocks, every time I try to extend a block that isn't \Magento\Framework\View\Element\Template I end up with errors. I want to ...
4
votes
1answer
12k views

Fatal error: Cannot declare class , because the name is already in use

Fatal error: Cannot declare class Vendor\Modelname\ResourceModel\Doccount, because the name is already in use in /var/www/html/readyresale/app/code/Vendor\Modelname/Model/ResourceModel/Doccount.php on ...
2
votes
4answers
2k 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 ...
0
votes
1answer
41 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 ...
1
vote
1answer
48 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 *...
1
vote
2answers
85 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:...
2
votes
1answer
19 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?
0
votes
2answers
99 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 ...
2
votes
0answers
48 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">...
1
vote
2answers
367 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) { $...
0
votes
1answer
462 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\...
0
votes
1answer
2k views

Magento 2 Class Catalog\Model\Product\Attribute\Backend\Media does not exist

When trying to edit or add a new product on the backend I receive the following error Class Magento\Catalog\Model\Product\Attribute\Backend\Media does not exist. It stops me from editing or adding ...
0
votes
0answers
34 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:...
3
votes
3answers
12k views

Fatal error: Class Helper_Data' not found in app\Mage.php

Please help me guys to fix it : Fatal error: Class 'Mage_Parcelamento_Helper_Data' not found in C:\wamp64\www\magento\app\Mage.php on line 547 Error log Warning: include(Mage\Parcelamento\...
2
votes
1answer
147 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 ...
1
vote
0answers
40 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 ...
0
votes
1answer
705 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 ...
6
votes
2answers
390 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 ...
0
votes
2answers
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 ...
0
votes
1answer
355 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.