Magento Expert Forum - Improve your Magento experience

Results 1 to 5 of 5

How To Create Sample File On Root And Call Magento 2 Functions?

  1. #1

  2. #2
    Junior Member
    Join Date
    May 2017
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    1.Have to load bootstrap first
    2.Load class and call the method

    Here is an example you can have a look
    PHP Code:
    use Magento\Framework\App\Bootstrap;
    require 
    __DIR__ '/../app/bootstrap.php';

    $bootstrap Bootstrap::create(BP$_SERVER);

    $obj $bootstrap->getObjectManager();

    $state $obj->get('Magento\Framework\App\State');
    $state->setAreaCode('frontend');

    $quote $obj->get('Magento\Checkout\Model\Session')->getQuote()->load(1);
    print_r($quote->getOrigData()); 

  3. #3
    Junior Member
    Join Date
    Apr 2017
    Posts
    132
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Quote Originally Posted by softwarehtec View Post
    1.Have to load bootstrap first
    2.Load class and call the method

    Here is an example you can have a look
    PHP Code:
    use Magento\Framework\App\Bootstrap;
    require 
    __DIR__ '/../app/bootstrap.php';

    $bootstrap Bootstrap::create(BP$_SERVER);

    $obj $bootstrap->getObjectManager();

    $state $obj->get('Magento\Framework\App\State');
    $state->setAreaCode('frontend');

    $quote $obj->get('Magento\Checkout\Model\Session')->getQuote()->load(1);
    print_r($quote->getOrigData()); 
    thanks for sharing

  4. #4
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    156
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    here are worked in debuging highlights in Magento 2 like logging, xdebug .The server is incidentally powerless to support your demand because of It should be determined to Developer mode to create mistake log. You have to rename record local.xml.sample to local.xml under The record can be situated to root/application/and so forth/di.xml.

  5. #5
    Junior Member
    Join Date
    Sep 2018
    Location
    Oman, Muscat
    Posts
    2,084
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    We will make a custom module in Magento 2 named "HelloWorld", that will . We will require three records at foundation of the module to be specific: In our model we have characterized reliance on the module Magento_catalog. Open Command line in organizer foundation of your magento2 and run Jobs and authorizations.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •