Stack Exchange Network

Stack Exchange network consists of 174 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 [object]

The tag has no usage guidance.

0
votes
2answers
33 views

How to convert this object data into array?

I have this Data Object value. Magento\Customer\Model\Data\AttributeMetadata Object ( [_data:protected] => Array ( [frontend_input] => boolean [input_filter] ...
1
vote
2answers
103 views

Difference between load() and get() methods

While going through the Magento code I have been seeing a lot of instances of: $objectName->load($foo) or $objectName->get($foo) and I was wondering, what is the difference between the 'load'...
0
votes
2answers
26 views

How to replace direct use of Object Manager?

in the success.phtml file I currently have a direct use of the object manager, which I am now reading is not best practice. I was wondering how to make a constructor to replace the following code in ...
4
votes
0answers
55 views

HELP - How to convert Default SOAP-v2 API Magento Objects into XML Values?

By Default return values as Magento Objects using soap v2, how can i change into XML, <?php ini_set('display_errors','On'); $proxy = new SoapClient('abc.com/api/v2_soap/?wsdl', array('trace' => ...
1
vote
1answer
199 views

Magento 1 - Convert Object into an array value

I was trying to get the information of tracking in the UPS. I got on of the method from the core (app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php => method name getTracking($trackings)) that ...
2
votes
0answers
132 views

Magento2 - How to return string as object in webapi response?

Can anyone let me know how to return success message with object like this same as magento does for the exception in REST webapi: { "message": "A customer with the same email already exists in an ...
0
votes
0answers
35 views

Magento 2 : How Link Properties of Nested Objects?

I have an object : defaults:{ isSSNSelected: ko.observable(false), company: { value: ko.observable('') }, listens: { ...
0
votes
0answers
338 views

Magento 2 - Update product collection price and reset collection

I want to update product price from the collection and use that collection again. I have written a code for that as per below: $price = 23; foreach ($this->_collection as $key => $value) { ...
1
vote
0answers
21 views

Magento magento_default_pages_tmp objectID(10) too big?

I'm trying to use Algolia in Magento for autocomplete search. It tell me that this object is too big.. Now I'm not interested to algolia working or not. My interest is to understand what is this ...
4
votes
1answer
68 views

Script error while uploading category image in Magento 2.1.9 using IE11

I have a Magento 2.1.9 installed. When I try to upload an image for a category from backend in the IE11 browser it shows a script error SCRIPT438: Object doesn't support property or method 'set' ...
4
votes
2answers
399 views

Magento 2, How to get Payment infoInterface from order?

I am working on a custom payment method. I am stuck in between where one of my methods required Payment object of \Magento\Payment\Model\InfoInterface But I am getting Magento\Sales\Model\Order\...
5
votes
1answer
868 views

Magento2 plugin around method different between callable and Closure paramters on param $proceed

I have checked magento2 ,There are two types of parameters can be send to around method \Closure $proceed example aroundSave(\Magento\Catalog\Model\Product $subject, \callable $proceed) ...
1
vote
0answers
19 views

Class instatiation with data

I have created custom Factory class for my custom model class. Of course basically you can instantiate it by calling $this->objectManager->create(Someobject::class);. But, ObjectManage has also ...
1
vote
0answers
53 views

Can't able to set value for nested object param

Below one is my custom observer object, I need to get/set value of processor object { ["_quality":protected]=> int(10) /* 1st quality param.*/ ["_processor":protected]=> object(...
0
votes
1answer
666 views

Get all gallery images

I'm trying to pull through the gallery images on the product page because customizing the gallery with code: <?php $_product = $block->getProduct(); ?> <?php $gallery = $_product->...
1
vote
1answer
511 views

Magento 1.9 - Order object passed to event observer is empty

I am trying to get data from a new order placed on our website to use it for integration with our ERP/CRM system. I use the event sales_order_place_after and my observer function fires as expected, ...
2
votes
2answers
4k views

Magento2: How to convert JSON to Array of nested objects

I am wanting to understand if there are some functions in Magento Framework which will assist me in mapping an array of nested objects from JSON (such as what would happen when the REST API is ...
1
vote
1answer
25 views

Magento 2 - Prohibits depends directly the ObjectManager, but all object can use factory object

As Magento prohibits depending on and directly using the ObjectManager, whether all object can use factory object to instantiate?
1
vote
1answer
60 views

Duplicate codes sent to user - SELECT FOR UPDATE

Hi guys I am working an a site that sells electronic codes, the issue I am having is if two people order in the same few seconds they are BOTH sent the SAME codes. I need a way editing it so when the ...
0
votes
1answer
298 views

How to store value in object Magento 2

How do you change price in the frontend without affecting database. I have found the following code for it, but now I want to set my custom price in object. Magento\Framework\Pricing\Amount\Base ...
7
votes
2answers
408 views

Plugins - is it bad habit to inherit from modified class in order to use protected properties

If I make plugin it is not neccessary to inherit from class I override. But, sometimes method I change uses properties that has protected access and they can't be used by plugin class. But if I ...
1
vote
1answer
3k views

Magento2: Convert DataObject/Array into magento2 Collection?

How to convert the Data object into Magento2 Collection ? In Mage1 we could do as below.. Mage1: $collection = new Varien_Data_Collection(); foreach ($items as $item) { $...
0
votes
1answer
1k views

Magento : how to get certain element value from array - object

below you can see the value genrate through print_r when i am trying get value of $post->PostContent() - return value is "post 1111111111111111Read More" but i want to get second value that is - "...
2
votes
1answer
990 views

magento 2: where are methods ($_product->getResource()->getAttribute($_code)->getFrontend()->getValue($_product)) declared?

lets say in my catalog_product_view.xml I have this additional Block: <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.demo" template="product/view/warranty.phtml" ...
1
vote
1answer
1k views

magento 2 how to get object from selected product (then get attributes)

When a product gets clicked on -> the product details page opens and shows detailed information and images of the product. I want to display (programmatically) some custom product attributes(which I ...
1
vote
0answers
19 views

Proxy object - when should I use them in fact

I have yesterday read great tutorial about Proxy objects: http://alanstorm.com/magento_2_object_manager_proxy_objects/ I understand that I should use them to lazy load object which have can be slowly ...
3
votes
1answer
83 views

How to learn about Magento objects

I recently started developing on magento2 and I'm finding a habitual problem always. When I start creating new extension or something, it's normal I will need M2 objects on my controller's ...
3
votes
3answers
615 views

Magento 2 Images from one .phtml to another .phtml

In a module I have installed I am trying to create a phtml page but can't work out how to pull through information(Like an image) to my new custom .phtml File containing information: view.phtml <...
2
votes
2answers
3k views

Magento 2 get gallery images

I'm trying to pull through the gallery images on the product page as I'm re doing the gallery. The code I'm using is: <?php $_product = $block->getProduct(); ?> <?php $gallery = $_product-...
0
votes
1answer
62 views

How to know what to write to pull through a product attribute Magento 2

Please excuse my ignorance as PHP 7 is completely new to me. The more and more I work with Magento 2 the more I'm understanding objects. But my question is: You have objects the their contents such ...
2
votes
1answer
1k views

i need set flag in model save before event and get in model save after event in magento 2

I have Create two event model save before and after i get specific object and set flag in before model and get in after model. for example in before model public function execute(\Magento\...
4
votes
2answers
578 views

How does Magento model distinguish column names in its get/set Model methods?

Let's say I have a Model associated to a table with a column called title. I understand that I can do a $model->setTitle("Hello"); to set a value to this field. I can probably do the same for ...
-2
votes
1answer
2k views

What is the difference between Mage::getSingleton() and Mage::getModel() in Magento [duplicate]

Mage::getSingleton() always finds for an existing object if not then create that a new object but Mage::getModel() always creates a new object.
12
votes
2answers
7k views

How to create varien object in magento 2?

In magento 1 we can create varien object like this $collection = new Varien_Data_Collection(); $varienObject = new Varien_Object(); $varienObject->setData($data); $varienObject->setItem($item);...
16
votes
2answers
19k views

Magento 2: Diagram of database tables, such as Orders, Products, etc. and their relationships

I'm looking for a diagram or schema of all Magento 2 database tables, such as Orders, Products, etc. and their relationships with each other.
0
votes
1answer
232 views

Sorting a collection by an attribute of an object

I am trying to add menu items in Magento using an observer and I have managed that but now I need to sort the order of the menu items by an attribute inside of each menuelement object (the attribute ...
4
votes
2answers
2k 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 ...
1
vote
1answer
475 views

$productAttribute->getSource() is throwing an error in admin grid

The line $productAttribute->getSource() in app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php throws an error: Call to a member function getSource() on a non-object ...
2
votes
2answers
510 views

increasing magento efficiency by loading outside of looping strctures

Is there a good method for me to work around needing to load these products within the foreach loops? This is found in so many places within my codebase. Any suggestions would be appreciated. ...
3
votes
0answers
107 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 ...
2
votes
1answer
4k views

Properly convert Magento's returned object to JSON

I made a customer log-in to the site programmatically... I am properly returned the session values in form of an object. Now i want this data carried over and returned from the function in JSON ...
4
votes
1answer
129 views

What are immutable data objects (with examples) in Magento-2?

According to dev document there are no setter methods in data interfaces. but in application almost every data interface contain setters also. There is no clarity on data interfaces. According ...
15
votes
3answers
2k views

Efficient Collection Calling, Filtering, and Loading

Right now im reusing a lot of collections that are nested within foreach loops. Is it possible to move these things up a few levels? Currently Im forced to reload collections that have 51k + entities ...
0
votes
1answer
148 views

Which [varien] object is required to successfully run getCompilerStatus()?

I'm attempting to programmatically determine if Magento's compilation status is enabled or disabled. I found the function getCompilerStatus() in app/design/adminhtml/default/default/template/compiler/...
1
vote
1answer
2k views

Fatal error: Call to a member function getId() on a non-object [closed]

how to solve this problem Fatal error: Call to a member function getId() on a non-object in F:\wamp\www\magento\app\code\local\company\module\Block\Customer\Sales\Order\View\block.php on line 18 my ...
1
vote
1answer
108 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
1answer
112 views

Is setIdFieldName dangerous for db objects?

Varien_Objects and their descendents provide a way to refer to objects by ids by another name. /** * set name of object id field * ...
1
vote
1answer
365 views

Sorting a collection by an attribute of an object inside it

I am trying to sort a collection of objects by an attribute of an object inside each object (terminology there may not be correct(!)). I have a collection of topic objects from the Simple Forum ...
0
votes
1answer
591 views

Prevent fatal error of non object ($o->getShippingAddress()) - only sometimes not available

I want to prevent a fatal error if object is not available. Background: I wrote an observer to catch data from the shipping object. $o = Mage::getModel('sales/order')->load($observer->...
0
votes
2answers
826 views

Convert Mage_Customer_Model_Customer Object to an array and convert again to object

I had encrypted customer's firstname ,lastname and email and need to decrypt data to show in front end. I will be Overriding public function getCustomer() located at app/code/core/Mage/Model/Session....