Linked Questions

0 votes
2 answers
117 views

Magento 2.4.7 Bootstrap Script Error PHP Fatal error: Uncaught TypeError: Magento\ApplicationPerformanceMonitor

After upgrading from Magento Open Source 2.4.6 to 2.4.7 custom PHP scripts that Bootstrap Magento 2 are failing to run with the error PHP Fatal error: Uncaught TypeError: Magento\...
20 votes
7 answers
24k views

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 ...
27 votes
5 answers
53k views

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 ?
0 votes
2 answers
898 views

Force start / add sales_clean_quotes to cron job list in Magento 2

We started to have some issues with our quotes not being cleaned correctly. I checked list of cron jobs and could not find sales_clean_quotes in the list. We are currently running Magento 2.3.3. How ...
1 vote
1 answer
961 views

How to create image using Base64EncodedData in magento 2

I want to create images using Base64EncodedData in Magento 2.
0 votes
2 answers
24 views

magento2 build image updater service which run through all created products and add missing images to product

I have some products created, but they do not have images when i see them in frontend or backend. I have these missing images in one folder with the format of productSku.png. I want to build image ...
3 votes
5 answers
8k views

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 */ $...
2 votes
1 answer
2k views

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 ...
1 vote
1 answer
68 views

Type Error occurred when creating object, attempting to use custom model from custom module

Yes I know, another "Type Error occurred when creating object" post... In addition, I'm probably going about this in a way that will make the seasoned M2 dev need a moment before reading ...
0 votes
1 answer
542 views

Load Magento objectmanager via a class

Having a bit of an issue with this one, I managed to get a working interface to Magento by including the following code, which in turn includes the Magento 2 bootstrap.php use Magento\Framework\App\...
0 votes
0 answers
39 views

How to update a cart after adding a product to the cart using an observer?

How to update a cart after adding a product to the cart using an observer ?
1 vote
1 answer
238 views

How to input and return data from bootstrap Magento 2 test.php script?

I need to pull product data out of Magento 2 via an external PHP command line script. I am using the example here: How can I bootstrap Magento 2 in a test.php script? In the run method, I extract my ...
2 votes
2 answers
9k views

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'); $...
4 votes
1 answer
8k views

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 ...
0 votes
2 answers
2k views

How to call root file directly in magento2- i don't want to create class? [duplicate]

I have upload.php file in magento2 root folder. How can i access directly www.example.com/upload.php directly in magento2?

15 30 50 per page