Questions tagged [object]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

Convert Object to Array

I try to convert my custom Object to Array. Here my Object : Namespace\Project\Model\Custom\Object Object ( [attr1:protected] => value1 [attr2:protected] => value2 [attr3:protected]...
0
votes
0answers
16 views

Difference between Magento Collection ,object , array

Please clear the main difference between Magento Collection , object , array and arraylist also ?
0
votes
1answer
24 views

How to move first element of object to first Magento 2

My object is something like this object(Magento\Framework\Data\Collection)[8565] protected '_items' => array (size=3) 15841610 => object(Magento\Framework\DataObject)[8701] ...
0
votes
1answer
30 views

Magento2: How can I access Zend\Stdlib\Parameters Object array?

I have below result: echo "<pre>"; print_r($data); die(); Result Zend\Stdlib\Parameters Object ( [storage:ArrayObject:private] => Array ( [success_url] => ...
0
votes
1answer
25 views

How to see inside $this object in Magento 2 logger

How can I see inside the $this object in my logger file using prs logger? I tried this \Magento\Framework\App\ObjectManager::getInstance()->get(\Psr\Log\LoggerInterface::class)->info("in ...
0
votes
1answer
63 views

How can we check context object list for observer in magento2

I want to know context object list which we can use methods directly from $context object in Observer. Just like in below URl. Magento2 – Use Defined Methods from Context Object URL:- https://webkul....
1
vote
2answers
412 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] ...
2
votes
3answers
147 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
32 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
93 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
399 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
220 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
477 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
24 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 ...
3
votes
1answer
98 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
548 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\...
6
votes
1answer
1k 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
55 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
2answers
830 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
591 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
3answers
6k 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
26 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
67 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 ...
1
vote
1answer
377 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
572 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
4k 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
1k 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
21 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
90 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
650 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
4k 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
67 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
678 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 ...
-1
votes
1answer
3k 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.
13
votes
2answers
9k 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
24k 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
249 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
515 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
559 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
108 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
5k 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
147 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 ...