Questions tagged [magic-getter]
Denotes questions related to magic getter & setter methods.
17 questions
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 ...
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::...
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 (...
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?
. ($...
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?
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 ...
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 ...
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\...
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 ...
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 ...
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-&...
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 =...
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 ...
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)['...
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 ...
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 ...
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=&...