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
3
votes
1answer
669 views

Magento 2: How to validate the cart rules?

I need to develop a function in the cart rules. Basically it is to check the amount that is added in the cart and apply a fixed price to the product. I have in mind how to apply the logic. But I ...
0
votes
1answer
108 views

Magento 2.2.2 - Class not found in Factory

Namespace/Modulename/Model/WebService/ClientFactory.php <?php namespace Namespace\Modulename\Model\WebService; use Magento\Framework\ObjectManagerInterface; use Namespace\Modulename\Model\...
1
vote
1answer
292 views

Magento 2.2.4 - Couldn't override block class

I am trying to override the Magento\ConfigurableProduct\Block\Product\View\Type\Configurable class. I have added a preference in app/code/vendor/module/etc/di.xml file. <config xmlns:xsi="http://...
1
vote
0answers
674 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 \...
1
vote
1answer
28 views

Extends Dashboard customer for telephone number

I'm trying to extend Magento\Customer\Block\Account\Dashboard\Info.php file. I created a module, where I have my custom block, Info.php. I want to display the telephone number of the customer after. ...
0
votes
0answers
24 views

How can we apply custom class for landing page and product page?

How can we apply custom class for landing page and product page? Ex: i want 100% width on landing page and custom width on product page
0
votes
1answer
61 views

Extending Adminhtml blocks class _prepareCollection

I am trying to override a adminhtml block and I created all files accordingly. The problem is that it does not have any effect. My files are as follows: app/code/local/Grando/Groupfilter/etc/config....
1
vote
3answers
1k views

Product Page - Add Span Class - Price Symbol

I wish to add a simple span class on the product view page for the price. <span class="price-symbol">$</span> <span class="price">$99.90</span>
0
votes
2answers
68 views

Modify Magento2 module php class

I have to add a work around fix for a payment method by adding a line of code to vendor/magento/module-payment/Helper/Data.php. I've tried my fix by adding it directly to that file and it's working, ...
2
votes
1answer
908 views

500 Internal Server Error in store page

I recently updated my Magento from 1.4 to 1.9 and faced with the issue: it gives HTTP-header 500 Internal Server Error, but all the content is still loading (so just instead 200 OK I have 500 Internal ...
4
votes
0answers
191 views

Problem with block override in Magento 2

Note: Before marking the question as duplicate or off-topic, please read the question carefully. Scenario: I have to show custom column in the admin grid of a custom extension. So I used override ...
0
votes
1answer
110 views

Magento2 extend a class from SalesRule module

I'm using magento 2.2 and I'm trying to extend a class, more exactly this one: \Magento\SalesRule\Model\Utility And I'm facing an error: Declaration of MagePal\CouponCodeExtraValidation\Model\...
2
votes
3answers
542 views

Class 'Ebizmarts_MailChimp_Helper_Data' not found

When I extracted the mailchimp extension in root folder. I came across this error Class 'Ebizmarts_MailChimp_Helper_Data' not found in /home/occasion/public_html/occasionwearforkids.com.au/app/...
0
votes
1answer
148 views

Load custom block content inside class

I have a module in which a protected variable is defined as follows: protected $stores = array('a','b', 'c', 'd'); I want to load define this variable inside a custom block so I am trying to do this:...
1
vote
1answer
139 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::...
2
votes
2answers
2k views

Calling Grandparent Class in magento class inheritance

UPDATE: This issue was finally tracked down as a class inheritance issue. The original code in class becomes invalid, due to fact that the class inheritance has been updated, and the 'parent::parent' ...
1
vote
3answers
73 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....
0
votes
1answer
937 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
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 ...
0
votes
2answers
796 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 ...
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 ...
3
votes
2answers
606 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-...
1
vote
2answers
236 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
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 ...
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?
1
vote
2answers
609 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 ...
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 ...
7
votes
2answers
578 views

Where helper aliases of some of core modules defined?

This confuses me a bit. I wonder why I didn't notice it before. When I look for helper definition of Mage_Sales core module, it surprised me that, I couldn't find helper defintion there. This confuses ...
0
votes
4answers
138 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. ...
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....
3
votes
2answers
3k views

Magento collection classes confusion

I confused by following collection classes $orders = Mage::getResourceModel('sales/order_item_collection'); $orders = Mage::getResourceModel('sales/order'); $orders = Mage::getResourceModel('sales/...
0
votes
2answers
145 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 ...
1
vote
0answers
81 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\...
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
2answers
433 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\...
2
votes
1answer
2k views

Extending an abstract block class

I'm modifying getCountryHtmlSelect() through a custom class that extends another core class that extends Mage_Checkout_Block_Onepage_Abstract. Here's the class with the customized code: local/...
0
votes
1answer
78 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
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 ...
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.
0
votes
1answer
136 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) ? ...
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
218 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
141 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
939 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 ...
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 ...
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> ...