Linked Questions

2
votes
5answers
6k 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
1answer
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
1answer
37 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 ...
18
votes
3answers
15k 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 ...
0
votes
1answer
49 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
0answers
18 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
1answer
127 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
2answers
8k 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
1answer
7k 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 ...
1
vote
1answer
773 views

How to create image using Base64EncodedData in magento 2

I want to create images using Base64EncodedData in Magento 2.
0
votes
2answers
1k 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?
24
votes
4answers
41k 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 ?
1
vote
2answers
2k views

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,...
1
vote
2answers
3k views

How to safly upgrade Magento version 1.7 to Magento 2.0

We are planning to upgrade Magento version 1.7 to 2.0, As we have a very custom build Magento 1.7 version. We have developed many custom scripts and many plugins for our store. We have a large ...
0
votes
1answer
403 views

Magento 2 Not able to override \Magento\Directory\Block\Data Class

I am trying to override Block \Magento\Directory\Block\Data with following method getCountryHtmlSelect() with following script, but it's not executing. di.xml <?xml version="1.0"?> <...

15 30 50 per page