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
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 ...
0
votes
1answer
228 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
647 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 ...
0
votes
1answer
242 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
9
votes
3answers
637 views

What (type of) classes are generated in Magento 2?

In Magento 2 there are a set of classes that are generated automatically and stored in var/generation and they are used in the core code. While trying to create a custom module by replicating one of ...
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
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
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(...
0
votes
2answers
2k views

Magento_Db_Adapter_Pdo_Mysql not found in Resource.php

Firstly, I have little knowledge of the workings of Magento as I'm mainly a WordPress developer so please be gentle. I have been tasked with moving an existing Magento install onto a VPS. The VPS is ...
0
votes
1answer
160 views

1.9 Related rewrite being ignored

I'm struggling with the following thing. Because I would like to write my own kind of filter for Related Products, I will have to rewrite the class "Mage_Catalog_Block_Product_List_Related". While ...
1
vote
1answer
35 views

Where do you place common methods that you use throughout your module

I have a method that is going to be called in multiple files in my module: public function getStore(){ $order = Mage::registry('current_order'); $store_id = $order->...
1
vote
2answers
41 views

Help writing an observer the “Magento Way”

Fairly new to objected oriented programming and very new to Magento programming, but trying to learn the "right way". I'm writing a before save observer to update product attributes based on other ...
0
votes
1answer
178 views

Extending Plugin Model - Magento + Wordpress

I haven't created a Magento module before and after a lot of research I attempted to create a module to insert wordpress avatars into blog posts inside Magento (I am using Fishpig). Below I will list ...
4
votes
2answers
3k views

What does Mage:: correspond to?

I just had one of those moments where I realized I don't understand something. What does the Mage part in say Mage::helper or Mage::log represent? There is no class Mage{ .. } in Magento. Thanks ...
0
votes
1answer
85 views

access parent class on class overwrites in magento, from a sibling

It is required to overwrite customer_resource class. I added required config.xml options for resource rewriting, but when overwritten class method calls parent class method from itself, it actually ...
1
vote
3answers
2k views

problems overriding 3rd party extension block class

the extension in question has the following structure: app code local MST Menupro Block Base.php Base.php has: class MST_Menupro_Block_Base extends Mage_Core_Block_Template { my custom ...
0
votes
0answers
147 views

Can't change Customer's Customer Tax Class

I have this weird problem where I can't change a customer's Customer Tax Class through the admin interface. It keeps jumping back to Retail customer. So when I select a different Customer Tax Class ...
0
votes
0answers
451 views

How to Fetch Product child Function Outside External file in Magento

I want to fetch all child function of magento outside of it.I have CORE_PHP with some jquery functionality and php function,In that Files,I need to add Product Children Function of magento into that ...
0
votes
3answers
74 views

Problem modifying core function - class is not called

I apologize in advance for this question has been treated many times, but I think I just need a personal trainer on this! I am trying to modify the function sendPasswordResetConfirmationEmail in Mage/...
3
votes
2answers
690 views

Change $this to different block in related.phtml

I am working in related.phtml in app/design/frontend/[package]/default/template/catalog/product/list/. Here there is a foreach loop: <?php foreach($this->getItems() as $_item): ?> which loops ...
0
votes
1answer
728 views

Add category id to product item class

Is it possible to add the category ids of a product into the html class of the product item itself? For example: let's say I do have 3 categories, catID: 20, ID: 21 and ID: 22. For each product I ...
2
votes
2answers
2k views

How to remove body class from specific page?

I'm using an extension that adds a class name vnecoms-cp to the body of adminhtml pages. This is then used to style the pages using css. My problem is, this affects 1 specific page in a negative way. ...
3
votes
0answers
109 views

Configurable Drop-down options in related products (related.phtml) - error Call to a member function getSortedChildren() on a non-object [duplicate]

I am trying to give the related products on each product page, the ability to show the drop-down options of configurable products; so that the user can select options and add to basket without ...
0
votes
1answer
208 views

Including a custom module model / block into template

I'm trying to follow this guide. But I want to add the template directly into the homepage using cms.xml, something like: <block type="trendingproducts/data" name="trending.products" template="...
1
vote
0answers
24 views

Method is being called from the “wrong” class - undefined method error [duplicate]

I have a CE Magento 1.9 application that is using a custom theme from Trego and a checkout extension from Webtex. The application was functioning but then after installing the checkout extension, I ...
3
votes
2answers
181 views

Why separately placing methods in interface instead of abstract class?

I want to delete Interface Mage_Shipping_Model_Carrier_Interface. interface Mage_Shipping_Model_Carrier_Interface { /** * Check if carrier has shipping tracking option available * ...
0
votes
1answer
701 views

Backend: Form Contains Abstract Method -> Fatal Error

I'm getting following error when I acces my form: Class MP_Search_Block_Adminhtml_Option_Edit_Tab_Form contains 1 abstract method and must therefore be declared abstract or implement the remaining ...
2
votes
2answers
2k views

lib class not found

I am loading a custom class from the lib folder and I'm getting the following error: Fatal error: Class 'NameSpace_MyClass' not found in /dir/to/site/app/code/local/NameSpace/Module/controllers/...
1
vote
1answer
245 views

Unable to call function within class of extension

I currently have some code on a product view page like: <?php $_product = $this->getProduct(); if (Mage::helper('core')->isModuleEnabled('Module_Name')): $exclImg = $_product->...
2
votes
1answer
224 views

Class inheritance question in magento (google analytics)

In a custom module I'm inserting universal analytics so I have to change a few functions from Ga.php file In Ga.php there is: class Mage_GoogleAnalytics_Block_Ga extends Mage_Core_Block_Template { //...
0
votes
2answers
1k views

How do add a class to the Wishlist Link in the Top Menu?

I want to add a class to the wishlist link in the top menu. In my app/design/frontend/default/abcd/layout/wishlist.xml, I have a reference: <reference name="top.links"> <block type="...
0
votes
1answer
656 views

What does this code do in magento? $this->_init('weblog/blogpost');

This is my model Class <?php class Magentotutorial_Weblog_Model_Blogpost extends Mage_Core_Model_Abstract { protected function _construct() { $this->_init('weblog/blogpost'); } } ?> My ...
3
votes
1answer
6k views

Want to rewrite core Helper class (Mage::helper('core'))

i want rewrite magento helper core class Mage_Core_Helper_Data. I have try below code, but it is not working <?xml version="1.0" ?> <config> <global> ... &...
1
vote
1answer
4k views

Magento Including External library

I have tried Joreon Vermeulen's method https://stackoverflow.com/questions/6417394/how-to-add-a-3rd-party-library-to-magento to autoload classes but to no avail. Now in my custom autoloader I get the ...
1
vote
1answer
180 views

model rewrite not working in admin side [closed]

i have rewritten fedex.php model file(collect rates method only). its working in front end cart and checkout pages. But its not working in admin side order creation.Can you help any one? update: ...
2
votes
3answers
20k views

How do you change the number of product columns?

I want to change the number of products that are shown. But I don't want to hard code this into the theme. This: <ul class=​"products-grid products-grid--max-4-col first last odd">​…​</ul&...
1
vote
2answers
39 views

Should custom Magento code always be a module, regardless of size

As a Magento newbie, I'm still trying to learn the good and the bad when it comes to developing for Magento. I need to write a class, that in Yii I would just create a class in the 'vendors' ...
2
votes
0answers
132 views

How to add a class to an attribute group? [closed]

hi this is the js code where magento generates new groups in admin: addGroup : function() { var group_name = prompt("<?php echo Mage::helper('catalog')->__('Please ...
1
vote
1answer
442 views

how do i extend a magento class from core?

I know that it is not safe to modify the core, so i want to extend a class. My need is to add a new button. In the image below you can see where: So, I created a module for that. I think the idea is ...
1
vote
3answers
4k views

Fatal error: Class 'Zend_Cache' not found /app/code/core/Mage/Core/Model/Cache.php

Does anyone know why this kind of messages appear? It seems like my Magento installation does not fully load all Zend classes, although they are there on a proper place with proper file permissions. ...
7
votes
1answer
7k views

Usage of getsingleton() and getModel()

Is there a set of guidelines that I can go by to decide when I should use mage::getModel() and mage::getSingleton() From what I can tell it seems as though getSingleton either gets an existing ...
2
votes
4answers
2k views

How to call Mage_Page_Block_Html_Pager class in list.phtml

I am wanting to include a larger than normal 'next page' type button in the list.phtml template whilst still having the normal pagination from pager.phtml The function I'm wanting to use is found in ...
2
votes
1answer
182 views

Identical Code in Block Class Overload has Different Results

The following code samples are long, but here is the issue: If I create a custom file /app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php and add two new columns to the product grid, it ...
2
votes
1answer
1k views

Fatal error: Class 'Altima_Lookbook_Helper_Data' not found in /home/offerbea/public_html/app/Mage.php on line 547

I have installed it from magento connect, and now in my back-end it displayed as it. Please somebody help me how to fix it. I gues it causing by i was put the compliation mode in on. Thank you
0
votes
2answers
154 views

Model Class Fallthrough

I created a new model class called Company_CatalogSearch_Model_System_Config_ListSort which I used to create a copy of the Product Listing Sort By option from the catalog module, just for the ...
3
votes
1answer
1k views

How are magento lib files loaded - Sage lib class not being accessed by model

On a mage site using sagepay, inside the Sagepaysuite model there is a call to a class file: Ebizmarts/SagePaySuite/Model/Api/Payment.php $xml = new Ebizmarts_Simplexml_Element('<customer />...
4
votes
2answers
1k views

Rewrite single method using local class

I need to override Varien class because I need to change one method. app/code/core/Varien/Data/Collection/Db.php From what I know, the only way is to put it inside local folder. app/code/local/...
0
votes
1answer
6k views

Get best selling or hot selling products list

I am new to PHP. I am trying to get best selling products list using the code which I found in Mage_Adminhtml_Block_Dashboard_Tab_Products_Ordered class from _prepareCollection method. if ($this->...
3
votes
3answers
162 views

Name for Magento 'pseudo' constructor

I understand why and how Magento uses the secondary/pseudo constructor e.g. the constructor that begins with a single underscore. Is there a specific name for this method: pseudo constructor ...