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
1
vote
1answer
130 views

When to extends Magento Framework Action

I have seen a sample module with a class like following. My question is: 1) Why do it need to extends \Magento\Framework\App\Action\Action since $context is not used in execute? 2) Why parent::...
5
votes
3answers
2k 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
912 views

Magento 2: Override product image JPG quality

Magento 2.2.1 with custom theme which inherits from Magento/blank. Attempting to fix the JPG compression for product images. I know, based on this solution, that I must extend the Image class found ...
1
vote
3answers
70 views

How to load 1587 classes from single file in magento 2?

I'm integrating Magento 2 with NetSuite CRM. I'm following this GitHub doc I want all of the services provided in there There are 3 files 1. NSconfig.php 2. NSPHPClient.php 3. NetSuiteService....
1
vote
0answers
22 views

How should I deal with multiple classes used in the same algorithm in Magento2?

I have a situation where I am building a module for Magento2 with 3 Models that kind of interact with each other depending on the situation. I tried to inject the classes withing them selves but that ...
2
votes
2answers
487 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
2answers
739 views

Magento 2 Module development Class does not exist error

I am trying to develop a Magento 2 module following a number of tutorials and a lot of Google searching. I am also following a couple of Packt Publishing books and I am getting confused with an error ...
0
votes
1answer
1k views

Class not found even exist on Magento 2

I have a custom module and i tried to extend this class in my Image.php file: Magento\Framework\Data\Form\Element\Image namespace Vendor\Namespace\Block\Adminhtml\Form\Element; class Image extends ...
0
votes
4answers
137 views

Magento 2 Class

i'm trying to convert a module from Prestashop to Magento 2 but i have a problem with the class. I'm following several tutorial and my whole module is based on the administration part of the website. ...
5
votes
8answers
11k 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
3answers
11k 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\...
0
votes
1answer
1k views

Include custom module block within phtml file?

I've created a custom module for a distributor search with a php class/block inside. Module Structure: - /Distributor Search - /Block - DistributorSearch.php - /etc - module....
1
vote
0answers
668 views

Compile: Extra parameters passed to parent construct: $context

This has been asked a few times I know and I studied all of them and I also get the ieda what went wrong. However I cannot adapt those solutions to my issue. I have a Class Post which extends \...
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
2answers
142 views

How to define methods inside of Plugin in Magento 2

I try to overwrite get_url() function located in item.php from this path \vendor\magento\module-catalog\Model\Layer\Filter\Item.php For this, i created a PLUGIN, and my code it's this one: <?php ...
2
votes
2answers
595 views

how to override any .phtml or class file in magento2 using custom module?

Well I have an idea to create custom module in magento2 but when it comes to override code functionality I stucks. for example I have to override this file default.phtml in /vendor/magento/module-...
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 ...
1
vote
0answers
80 views

Mangeto 2: How to override core abstract class function? [duplicate]

Magento 2: How to Override Abstract Class for Product Category Indexing Issue? I need to override below files one function only magento\vendor\magento\module-catalog\Model\Indexer\Category\Product\...
0
votes
2answers
427 views

Magento2 - how to know when what parameter i have to pass in controller - _construct function

i was reading a book magento2 tutorial. When learning how to create module. 2 augments was receiving in _construct function of controller. Actually i am talking about this 2 \Magento\Framework\App\...
0
votes
1answer
77 views

Error when trying to ban url with Varnish Cache

I've updated the EcomDev_Varnish module to it's latest version and it seems I've gotten everything properly running, but as a test I tried following command: php ecomdev-varnish.php cache:ban -v ...
2
votes
1answer
1k views

Dynamically instanciate class with arguments

I am actually trying to instanciate a class dynamically with these arguments. Here is the code I use in class A: /** @var string $source */ $source = '\Foo\Bar\My\Class'; // Dynamic value that I ...
1
vote
2answers
600 views

Magento2 - Change “LINKS” CSS class in footer

I would like to change the div class "links" to something like "footerlinks", so if I change the css only the footer links are affected and not all divs with "links" as a class. Below you can see ...
1
vote
2answers
34 views

Class Mage_Facebookilike_Helper_Data not found

When i click magento adminpenal's system>configuration The Error will caused..... Fatal error: Class 'Mage_Facebookilike_Helper_Data' not found in C:\xampp\htdocs\magento\app\Mage.php on line ...
1
vote
2answers
234 views

Extend Mage_Core_Model_Email_Template_Filter

I am trying to extend Mage_Core_Model_Email_Template_Filter class to add translate directive but I can't make it work. Here my module: app/code/local/Company/Module/etc/config.xml <config> ...
0
votes
1answer
135 views

static block (created via admin panel) the same as a php Block class in a module?

Magento 2 related Question. Is a block(CMS Static Block) which I create via the Admin Panl, the same as a block which I created programatically in a module (app/code/Vendor/Module1/Block/Bla.php) ? ...
0
votes
1answer
30 views

Added function to class core not returning anything

I want add a function to the core class. To do this I have added a file to extend the class core but when I call the function it's returning nothing.
1
vote
0answers
39 views

magento 2 : Equivalent class for Adapter Product and Parser abstract

What is the equivalent class for the same in Magento2 Mage_Catalog_Model_Convert_Adapter_Product Mage_Eav_Model_Convert_Parser_Abstract
1
vote
1answer
53 views

Equivalent class for /Mage/CatalogSearch/Model/Layer.php in Magento2

What is the equivalent class for /Mage/CatalogSearch/Model/Layer.php in magento2
1
vote
1answer
2k views

Use custom classes in Magento 2 controller

I'm migrating my module from Magento 1 to Magento 2, some code is no longer working. Instantiating the class doesn't work anymore, is there a different way to do it in Magento 2? include("...
1
vote
2answers
210 views

how to get Agreement in my custom class

I am trying to recover the termes and conditions in my class but without success. Here is my class : class Bvr extends \Magento\Framework\Model\AbstractModel{ public function __construct( \...
2
votes
1answer
8k views

Magento 2 class does not exist error backend

I'm trying to add another field to the customer create form. The following code troughs an error in the backend. The error is: Class Magento\Customer\Model\Metadata\Form\String does not exist or ...
1
vote
1answer
137 views

Mage.php unable to find module class files

We have a Magento 1.9.2.4 site that works perfectly on our development server, but when deployed to production, throws errors that it can't find custom module classes (Mage_Ultimo_Helper_Cssgen is one ...
2
votes
1answer
917 views

Magento 2: Custom function – best place to put it?

I've created a little function for one of my template (.phtml) files which I'd like to re-use in a few other template files. All the function does is concatenate a couple of strings together and trim ...
0
votes
0answers
229 views

Overriding a class : Mage_Catalog_Block_Product_View_Type_Configurable

I want to override Mage_Catalog_Block_Product_View_Type_Configurableclass. I have created one module : Ved_Catalog Here are my module files: Code from config.xml : <config> <global> ...
3
votes
1answer
4k views

Magento 2 Class does not exist error

I am trying to create a custom grid in admin, based on customer collection using ui-component. The problem that I am facing is that I am getting Class does not exist error and magento does not tell ...
1
vote
0answers
46 views

Changes to a .php file not getting compiled

I made some changes to the file app/code/core/Mage/Checkout/Model/Observer.php. However those changes are not reflecting in includes/src/__checkout.php in the Mage_Checkout_Model_Observer class.(After ...
2
votes
1answer
3k views

Magento 2: Update the CSS class name of #maincontent

Is there a way for me to remove the class name 'page-main' from the 'maincontent' div and add a new class name?
6
votes
1answer
5k views

Magento 2: Overriding Block class – not generating output

I'm trying to override the module-catalog/Block/Product/View/Options/Type/Select.php class with a new version which includes a few other bits of custom php (adding HTML classes and IDs to the ...
0
votes
1answer
225 views

Magento 2: New module causing crash

I'm trying to override the module-catalog/Block/Product/View/Options/Type/Select.php class with a new version which includes a few other bits of custom php. I have done the below and then run the php ...
1
vote
1answer
641 views

Magento 2: Updated file not working

I want to update the class Select and its getValuesHTML() method which is saved here: module-catalog/Block/Product/View/Options/Type/Select.php I have made a copy of this file and placed it in my ...
6
votes
2answers
5k views

\Magento\Framework\Registry already exists in context object on compile

when I do compile I do get the following error which is referencing my custom module Blocks, class Incorrect dependency in class ... \Magento\Framework\Registry already exists in context ...
0
votes
1answer
239 views

Extending class not working unless you copy all methods

In my module I want to overwrite the method public function collect(Mage_Sales_Model_Quote_Address $address) in Mage_Sales_Model_Quote_Address_Total_Abstract. If I copy only that method in my class: ...
1
vote
1answer
87 views

How to inject dependencies on class extend

can somebody explain when I extend another Block what is the way to inject dependencies? For example my Block is extending ListProduct
1
vote
0answers
88 views

How to instantiate my new class and methods

I'm looking to trigger anything on a /admin/customer/edit just to know it's working.. an echo or print.. I have this code below. app/code/community/YourModule/etc/config.xml <global> <...
1
vote
1answer
861 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 ...
3
votes
1answer
6k views

Where are class constructor parameters defined in Magento2?

If you see AbstractExpress class for PayPal payment method, you could see: /** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @...
1
vote
1answer
210 views

Class 'Mage_Catalog_Block_Product_Mostviewed' not found

i am trying to display most viewed products on homepage. getting following error. class Mage_Catalog_Block_Product_Mostviewed extends Mage_Catalog_Block_Product_Abstract { public function __construct(...
2
votes
2answers
2k views

Update Const template at Magento 2 Class

I need to update a template defined in a Constant at Configurable Class(Magento/Swatches/Block/Product/Renderer/Configurable.php). I tried with a Plugin, but how the function which gets the constant ...
21
votes
2answers
7k views

What is __construct and _construct in magento2?

In Magento 2, most of classes have these two constructs (__construct and _construct) methods. What is the difference between them?
2
votes
1answer
134 views

Magento Top Links Login class disappears randomly!

So I have slightly modified the customer.xml file to add classes to the top links, so I could add font awesome icons to them. The issue I am having is for some reason the login class disappears if I ...