How to get simple products from a configurable product in magento 2

In this blog we’ll going to get the simple products in a block and from object manager. First we’re going to fetch child products from a block. <?php namespace Custom\Module\Block\Product\View; use \Magento\Framework\View\Element\Template; class Sample extends Template { protected $_productRepository; public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\ProductRepository $productRepository) { $this->_productRepository = $productRepository; parent::__construct($context); } public function getProductById($id) { $product = $this->_productRepository->getById($id); $_children = $product->getTypeInstance()->getUsedProducts($product); foreach ($_children as $child){     echo “Here are your child Product

Facebook scrape page via api

First thing is get your app token. Check this page on how to get your access token . <?php $access_token = “{your app access token}”; $id = “page-to-scrape-again.html”; $params = array(“id”=>$id,”scrape”=>”true”,”access_token”=>$access_token); $ch = curl_init(“https://graph.facebook.com”); curl_setopt_array($ch, array( CURLOPT_RETURNTRANSFER=>true, CURLOPT_POST=>true, CURLOPT_POSTFIELDS=>$params )); $result = curl_exec($ch); That’s it.

How Install Data Migration Tool In Magento 2

Check your Magento 2 version php <your Magento install dir>/bin/magento –version composer config repositories.magento composer https://repo.magento.com composer require magento/data-migration-tool:<version> where must match the version of the Magento 2 codebase. For example, for version 2.1.2, enter: composer config repositories.magento composer https://repo.magento.com composer require magento/data-migration-tool:2.1.2

Linux Commands

Report file system disk space usage in a human-readable format $  df -H sample outputs: Estimate file space usage in a human-readable format $  du -H sample outputs: How to get the total size of a directory $  du -hs /path/to/directory sample outputs:   List directory contents $  ls -a sample outputs: Find the Ubuntu Linux distribution version and related information $ lsb_release -a sample outputs:  

PHP/cURL

Below is a simple example for GET and POST Request. GET Request // Get cURL resource $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_URL, ‘http://yourtargeturl.com’); // Send the request & save response to $resp $resp = curl_exec($curl); // Close request to clear up some resources curl_close($curl); If you want to send a parameter along in the request, simply append them in the URL. ex: http://yourtargeturl.com/?var1=value1&var2=value2 POST Request Simply set the CURLOPT_POST option to