Linked Questions

15 votes
3 answers

Magento 2 : How to load quote by quote id

How can I load quote in magento 2 by quote id ?
23 votes
2 answers

Magento 2.1.1 How to load Order with Increment ID using OrderRepository object

What would be the latest best practice to load Order using increment ID (instead of Order ID) using OrderRepository
5 votes
3 answers

Save is deprecated when try to create attributes set

I try to create programmatically some attributes set. I find this code : $setup = $this->moduleDataSetup->getConnection(); $setup->startSetup(); $categorySetup = $this->...
0 votes
0 answers

Magento 2 : The proper way to read/save entities [duplicate]

I have been only for a few days in the Magento universe, starting with Magento 2, and I am currently a bit lost regarding the proper way to read and save entities (Model). At the very begginning, I ...
4 votes
5 answers

Magento 2 - Create product programmatically with different store view values

I have created this custom import module that will create products and set different values for each store view. The problem is, when I save a single attribute for the product on a store view, all the ...
2 votes
3 answers

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'...
55 votes
3 answers

How to implement service contract for a custom module in Magento 2?

As seen in this post : Deprecated save and load methods in Abstract Model the save and load methods are deprecated in the Magento 2 develop branch. Thus, the good practice is now to be implement ...
6 votes
3 answers

programatically cancel the order using order id - Magento 2

My requirement is programatically change the order status to Canceled by using order id. How to achieve this?
20 votes
1 answer

Magento2 : Best way to load Customer by customer Id

What is the best way to load Customer by Id? using customer interface or customer factory or another way ? In most of solutions I found, it is done by directly using objectManager (which should be ...
19 votes
2 answers

Best Way to Load a Custom Model in Magento 2

Because it was hard for me to find the right way, below you could find the best practice I made mine. Enjoy, correct my English if needed and say me I'm wrong if I am. :) Edit : ... and I found out I ...
1 vote
2 answers

Saving a Quote Since Save() is Deprecated

I have created a new attribute for quotes and orders in Magento 2.1.5. I have an observer that sets the value for this attribute based on a session variable (indentOrder). The code I have is working:...
4 votes
2 answers

Magento 2 - what functions can I use?

Recently I've went through the "Fundamentals of Magento 2 development" course and there was such statement that we SHOULD NOT use functions from other modules that are not defined in the API ...
4 votes
1 answer

Reference for Magento2 best practices

First of all this might not be the right place to ask this question, if this is the case please let me know where the right place is? Currently there is the module best practice reference on http://...
2 votes
2 answers

How to save an EAV entity from controller?

I'm trying to build a custom module that contains an EAV entity in Magento 2 for learning purposes. I have troubles performing a proper save from an admin controller. I'm trying to avoid code like: $...
0 votes
2 answers

how to use model in magento 2

<?php $price_rules = Mage::getModel('startupready_priceRules/quantitybreaks'); $price_rules->load($priceRuleList); $price_rules->getPricingTables(); ?> Is there any way to use ...

15 30 50 per page