Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [magic-getter]

Denotes questions related to magic getter & setter methods.

0
votes
1answer
29 views

Recevied Empty array after using getItemsByColumnValue() collection method

I'm trying to retrieve a row from a custom table named 'lmap_shipping_tablerate' using a specific value for a column postcode. An empty array is returned when following line is used in my ...
1
vote
2answers
24 views

Magic Method unsItemName()

I'm trying to use an unset magic method to delete a row from the table. Following is the line of code from execute method of my CLI command. $item->unsEquipmentName($input->getArgument(self::...
20
votes
2answers
503 views

Magento 2 - good practice to use/avoid magic getters?

Magic getters on Varien_Object (M1) and DataObject (M2) are common practice, but with Magento 2 it feels wrong to use it. Good: easy to read/write Bad It causes problems when using digits in keys (...
1
vote
1answer
66 views

Magento 1.9 where is getSkipJsReloadPrice set?

In app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php the getSkipJsReloadPrice method is checked i want to change getSkipJsReloadPrice to return true where is that setting? . ($...
3
votes
3answers
123 views

Get Custom Product attribute using camel case

How can i get custom product attribute custom_attribute_1 using $product->getCustomAttribute1 .Is camel casing works for numbers?
1
vote
1answer
318 views

how can i use the magic methods correctly?

I've thought about magic methods(based on php)in Magento help developers work more easily.Especially, getter method is pretty useful to create own custom module. As far as i know, get methods has ...
8
votes
2answers
1k views

Plugins for magic getters/setters

I'm trying to make the status of a review be approved instead of pending when the user posts it in the frontend in Magento 2. And I took this approach. Create a before plugin, available only in the ...
8
votes
2answers
687 views

Magento 2: different way get field of a collection

I have this helper class in Magento 2: class Data extends \Magento\Framework\App\Helper\AbstractHelper { protected $_countryFactory; public function __construct( \Magento\Directory\...
0
votes
1answer
162 views

How to find out which getter methods are available

Often I'm working on a Magento template or block and while looking for a variable I try to use a getter method. I use xDebug so normally I just go through the debugger and find what I need and guess ...
2
votes
6answers
3k views

How do I get all the fields of an order?

I'm working with Magento, I have orders and I print them like this: echo $order->getId(); echo $order->getCustomerEmail(); My problem is that I don't know all the name of the get methods so ...
3
votes
1answer
419 views

EComDev PHPUnit get and set session data

How do you test setting and getting a session variable in PHPUnit/EComDev? This is what I've so far in my test method: $checkoutSession = $this->getModelMock('checkout/session'); $checkoutSession-&...
0
votes
1answer
90 views

Magento singleton setSubscriptionPlan

I am new to Magento. I am facing problem while using Customweb subscription extension. so there is an error in file causing by this extension. what I want to know is, what is this code doing? $quote =...
2
votes
1answer
3k views

Use Magic Methods in custom module

I want to make use of Magic Methods in my Custom Module. I created a new Model with different member variables (variable1, variable2) and I want to get them like getVariable1. How do I need to ...
1
vote
1answer
111 views

How to set using magic setter child array of Observer object

My observer $observer has the basic format: $observer->_data['result']->_data['booked'][productid][date] I can access this value like: $observer->getResult()->getBooked($productid)['...
1
vote
2answers
117 views

$product->getDisableAddToCart() magic method questions

I've run into an issue where $product->getDisableAddToCart() is returning bool(true) for some products, but I can't find a declaration of that method, nor can I find an attribute ...
5
votes
2answers
3k views

Making PHPStorm recognize magic getter

I got accustomed to using PHPStorm's validation feature, the yellow flags on right of editor showing whenever a method could not be found. I found that it doesn't recognize magic getter methods, for ...