Linked Questions

27 votes
5 answers

Programmatically create a simple product in magento 2

I'd like to create simple product programmatically in magento 2. Is there any way to create ?
Amit Maurya's user avatar
  • 2,871
20 votes
7 answers

Magento 2 run a specific Cron without cron:run CLI command?

To make a long story short xdebug will not reliably stop on the breakpoints in my cron files when using the typical: php bin/magento cron:run Xdebug is all setup properly and sometimes it will work ...
Kevin Chavez's user avatar
4 votes
1 answer

Magento 2.1 Update Product Stock in Cron Job

I need to be able to programmatically update product stock in my Cron job. I have an array that contains both the SKU of the product needing updating and the Stock value of that product. How can I ...
opqr549's user avatar
  • 125
3 votes
5 answers

Programatically delete custom attribute options

I'm trying to delete all custom attribute options not contained within a specific options array as follows: /** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */ $...
Sophie Baxter's user avatar
3 votes
3 answers

How to load the Magento 2 core (external file) [duplicate]

I'm creating a file outside of the public_html folder. In Magento 1.x I could access Magento Core functionality be doing this: require_once('./app/Mage.php'); Mage::app(); Does anybody know the ...
Liam McArthur's user avatar
3 votes
1 answer

How to get product collection outside of Magento2 [duplicate]

In Magento 1 I can use require_once '../app/Mage.php'; $products = Mage::getModel('catalog/product')->getCollection(); Where is the new "/app/Mage.php" in Magento 2? What file I have to include ...
mmmgigi's user avatar
  • 151
2 votes
2 answers

Magento2 Base,Small & Thumbnail image is not setting by Programmatically

I am using below code to set the image as base,small and thumbnail, but it is not working. $productRepository = $this->_objectManager->create('Magento\Catalog\Api\ProductRepositoryInterface'); $...
user avatar
2 votes
1 answer

Magento 2.1: how to create category Attribute programmatically?

The custom extension in which I am working is working correctly till 2.0.7, but not in 2.1. So my question is, how to create category attribute programmatically? Below code was working in 2.0.7, but ...
Gaurav Jain's user avatar
2 votes
6 answers

How to load Product or order collection outside project in magento2

I need to load product or order collection outside the magento, i need to play around the data so i need to call collection in magento1.x we use require_once '../app/Mage.php'; $products = Mage::...
Pradeep Kumar's user avatar
2 votes
2 answers

How to use magento2 function in root file [duplicate]

create test.php file in magento2 root, i want require baseUrl also i try to require __DIR__ . '/app/bootstrap.php'; but it's not work
Nikhil Vaghela's user avatar
2 votes
1 answer

Use Magento 2 Web API to pull product data

I'd like to be able to recreate sections of my magento site outside of the magento root folder. I have a Wordpress based site, and I'd like to have template files in the Wordpress theme be able to ...
mike-source's user avatar
2 votes
4 answers

Create Dirty Playground In Magento 2.1.6

The method outlined here to create a dirty playground doesn't work in magento 2.1.6: It generates the error: Uncaught TypeError: Argument 2 passed ...
Guerrilla's user avatar
  • 187
1 vote
2 answers

Magento 2 Database Connection And Getting Info

I am new to Magento 2, it is normal to use the usual way $servername = "localhost"; $username = "username"; $password = "password"; // Create connection $conn = mysqli_connect($servername, $username,...
Compu Scie's user avatar
1 vote
1 answer

How to create image using Base64EncodedData in magento 2

I want to create images using Base64EncodedData in Magento 2.
Pavan U's user avatar
  • 51
1 vote
2 answers

Magento 2 not able to save order data in custom table using observer.php with sales_order_place_after

I am trying to save order details in a custom table with sales_order_place_after observer, but its not working. public function execute(\Magento\Framework\Event\Observer $observer) { ...
Ramesh's user avatar
  • 986

15 30 50 per page