Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: bejoy balan
Added: Jul 16, 2020 6:21 AM
Views: 103
  1. <?php
  2. use Magento\Framework\App\Bootstrap;
  3.  
  4. require __DIR__ . '/app/bootstrap.php';
  5.  
  6. $params = $_SERVER;
  7.  
  8. $bootstrap = Bootstrap::create(BP, $params);
  9.  
  10. $obj = $bootstrap->getObjectManager();
  11.  
  12. $state = $obj->get('Magento\Framework\App\State');
  13. $state->setAreaCode('frontend');
  14.  
  15. $quoteId = 1;
  16. $quote = $obj->get('Magento\Checkout\Model\Session')
  17.     ->getQuote()
  18.     ->load($quoteId);
  19.  
  20. echo '<pre>';
  21. print_r($quote->getOrigData());
  22. echo '</pre>';
  23.  
  24. $productId = 1;
  25. $product = $obj->get('Magento\Catalog\Model\ProductRepository')
  26.     ->getById($productId);
  27.  
  28. echo '<pre>';
  29. print_r($product->getData());
  30. echo '</pre>';
  31. ?>
  32.