Linked Questions

3
votes
3answers
6k views

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

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
1
vote
1answer
4k views

Magento2 Getting cart content programatically outside of magento itself [duplicate]

I'm working on several cart displays and to do this i usually (in magento 1) make a small script outside of Magento load up the magento app and fetch a collection with the data. In magento2 this ...
3
votes
1answer
2k views

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 ...
0
votes
1answer
817 views

How to create an independent script run on Magento 2? [duplicate]

I'd like to create a file in the root folder (e.g. test.php) that I'll be able to do functions programmatically like update product attributes or something like that. Can you show me some sample? ...
0
votes
2answers
961 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?
1
vote
0answers
488 views

Magento 2 - mage.php equivalent [duplicate]

I am trying to figure out what the equivalent of the following piece of Magento 1 code would be in Magento 2. I am trying to include magento 2 into a external file as follows: Magento 1 Code: $...
0
votes
0answers
124 views

how to create or call block programmatically in magento2 [duplicate]

i need to call top menu or header out ide the magento project in that case how to call it in magento2 in magento1.x we use <?php require_once(dirname(__FILE__).'/store/app/Mage.php'); $app = ...
23
votes
4answers
39k 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 ?
17
votes
3answers
14k 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 ...
2
votes
6answers
5k views

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::...
4
votes
1answer
6k 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 ...
2
votes
2answers
7k 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'); $...
2
votes
4answers
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 ...

15 30 50 per page