Skip to main content

Questions tagged [magic-getter]

Denotes questions related to magic getter & setter methods.

Filter by
Sorted by
Tagged with
1 vote
1 answer
409 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 ...
PhantomS's user avatar
  • 503
1 vote
2 answers
646 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::...
PhantomS's user avatar
  • 503
21 votes
2 answers
3k 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 (...
sv3n's user avatar
  • 11.7k
1 vote
1 answer
98 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? . ($...
Yehuda Schwartz's user avatar
3 votes
3 answers
312 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?
HARI's user avatar
  • 133
1 vote
1 answer
1k 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 ...
3CE's user avatar
  • 594
11 votes
2 answers
3k 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 ...
Marius's user avatar
  • 199k
8 votes
2 answers
2k 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\...
Giuseppe Morelli's user avatar
0 votes
1 answer
273 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 ...
Holly's user avatar
  • 4,923
3 votes
6 answers
4k 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 ...
Luca Caldari's user avatar
3 votes
1 answer
609 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-&...
David Tay's user avatar
  • 548
0 votes
1 answer
102 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 =...
Dariel Pratama's user avatar
2 votes
1 answer
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 ...
kilsen's user avatar
  • 185
1 vote
1 answer
174 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)['...
Kevin Chavez's user avatar
1 vote
2 answers
246 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 ...
Tyler V.'s user avatar
  • 2,987
6 votes
3 answers
5k 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 ...
Niloct's user avatar
  • 822
4 votes
1 answer
116 views

Could Not Resolve the Method "hasElementId"

I am confused about this method declaration. In this class Wrapper.php (Mage/Page/Block/Html/) under _toHtml() method, there is a line coded as below. $id = $this->hasElementId() ? sprintf(' id=&...
Leongelis's user avatar
  • 585