How to get the order status information on Magento2?

Currently we are working on Magento-2.2.6 website and on Porto theme.

I want to create one form to get the order details by entering the user email is and order id.

For this, we want to create one cms page and will be used as Track order.

We want to track the order without using any third party extensions.

Magento 1.9.2 – I do not want to show username, password, host and port in PHPMailer using SMTP

At the moment we have this code to send emails with phpmailer via smtp. How can I make it work without showing username, password, host and port? I do not want to show my credentials in the file :

require_once "Mail.php";
$from = "";
$to = "";

$subject = "Test";
$body = "Hello";
$host = "";
$port = "myport";
$username = "";
$password = "my_password";
$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
 } else {

Thanks !

Custom REST API endpoint – Consumer is not authorized to access %resources – Magento_Indexer::Indexer

I’m trying to expose the getLatestUpdated() method of the Indexer class through the REST API. The endpoint is getting an auth token and all that – I can use protected endpoints no problem. What resources should I have requested or how can I give my extension permission to use the resource?

Here is what my webapi.xml looks like:


Custom mail form on Magento 2.2.x

I’m trying to create a custom mail form on Magento 2.2.x. I have looked at several instructions for Magento 2.0.x and/or Magento 2.1.x but they dont seem to work anymore for Magento 2.2.x. Perhaps someone can shed some light on this. The code of my controller in /app/code/Vendor/Module/controller/index/post.php looks like this:

namespace VendorModuleControllerIndex;

use MagentoFrameworkAppActionContext;
use MagentoFrameworkMailTemplateTransportBuilder;

class Post extends MagentoFrameworkAppActionAction
     * @var TransportBuilder
    private $transportBuilder;

     * @param Context $context
     * @param TransportBuilder $transportBuilder
    public function __construct(
        Context $context,
        TransportBuilder $transportBuilder
    ) {
        $this->transportBuilder = $transportBuilder;

     * Post user question.
     * @return void
    public function execute()
        $post = $this->getRequest()->getPostValue();
        if (!$post) {

        try {
            $postObject = new MagentoFrameworkDataObject();

            $error = false;

            if (!Zend_Validate::is(trim($post['name']), 'NotEmpty')) {
                $error = true;
            if (!Zend_Validate::is(trim($post['comment']), 'NotEmpty')) {
                $error = true;
            if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
                $error = true;
            if (Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {
                $error = true;
            if ($error) {
                throw new Exception();

            $storeScope = MagentoStoreModelScopeInterface::SCOPE_STORE;
            $transport = $this->transportBuilder
                ->setTemplateIdentifier($this->scopeConfig->getValue(self::XML_PATH_EMAIL_TEMPLATE, $storeScope))
                        'area' => MagentoBackendAppAreaFrontNameResolver::AREA_CODE,
                        'store' => MagentoStoreModelStore::DEFAULT_STORE_ID,
                ->setTemplateVars(['data' => $postObject])
                ->setFrom($this->scopeConfig->getValue(self::XML_PATH_EMAIL_SENDER, $storeScope))
                ->addTo($this->scopeConfig->getValue(self::XML_PATH_EMAIL_RECIPIENT, $storeScope))


                __('Thanks for contacting us with your feedback or questions. We'll respond to you very soon.')
        } catch (Exception $e) {
                __('We can't process your request right now. Sorry, that's all we know.')


This generates the error:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function VendorModuleControllerIndexFeedback::__construct(), 1 passed in generatedcodeVendorModuleControllerIndexFeedbackInterceptor.php on line 14 and exactly 2 expected in appcodeVendorModuleControllerIndexPost.php:29 Stack trace: #0 generatedcodeVendorModuleControllerIndexFeedbackInterceptor.php(14): VendorModuleControllerIndexFeedback->__construct(Object(MagentoFrameworkAppActionContext)) #1 libinternalMagentoFrameworkObjectManagerFactoryAbstractFactory.php(111): VendorModuleControllerIndexFeedbackInterceptor->__construct(Object(MagentoFrameworkAppActionContext)) #2 libinternalMagentoFrameworkObjectMa in appcodeVendorModuleControllerIndexPost.php on line 29

Leaving TransportBuilder out of the constructor gives the following error:

Notice: Undefined property: VendorModuleControllerIndexPostInterceptor::$transportBuilder in E:Localhostwwwmagento2versie22appcodeVendorModuleControllerIndexPost.php on line 68

Any help to get a custom email form on Magento 2.2.x working is appreciated.

Tenses in sentences with more than two verbs

  1. I´ve spent a fortune on swimming lessons. Next month I will have been training for three years and I don´t think I _______________(can) dive successfully when I go to Mexico this summer.

  2. If I thought that somebody was in my house, I would call the police and I _________ (not confront) the intruder.

What tenses should be used in the blank spaces above? I know conditionals and future perfect pretty well but I always have a problem when there are more than two verbs in a sentence. So my question is what tense should be used in any conditional or a future perfect sentence when there are more than two verbs just as in the examples above?

Displaying Labels from Shapefile outside ArcMap using ArcPy? [on hold]

When I type the below code (from an answer to Turning on labels of layer using ArcPy?) within a ArcGIS python console, I can display the labels(i.e. Region_name) from a Shapefile, but I cannot run this code in python script.

Is there any other ArcPy code?

I am open to any methods using python to display the labels from a Shapefile.

mxd= arcpy.mapping.MapDocument("CURRENT")  
layer = arcpy.mapping.ListLayers(mxd,"layer")[0]  
layer.showLabels = True  

How to get a mixed json result from 2 custom tables by using REST-API?

I have 2 custom tables in my database, named family and child.
I want to display them in a json result by using rest-api, such as

There are 3 columns in family table: family_id, family_name, family_key.
And there are 4 columns in child table: child_id, child_name, child_family_key, is_selected.

As you guess, family_id and child_id columns are auto-increment numbers.
And the family_key and child_family_key columns provide the relationship between families and children.
And the is_selected values must be 1 or 0. It means only 1 child selected in each family and this child has “1” value.

I want the json result to show like this when someone enter

    "family_id": 1,
    "family_name": "Brown"
    "children": {
        "child_0": "John",
        "child_1": "Barbara",
        "child_2": "Jack",
        "child_3": "Daniel",
        "child_4": "George",
        "selected_child_index": 3
    "family_id": 2,
    "family_name": "Maruto"
    "children": {
        "child_0": "Hiroshi",
        "child_1": "Haruki",
        "child_2": "Murakami"
        "selected_child_index": 1

In this example above, Brown family has 5 children and Daniel is the selected child..
And in the second family, Maruto family has 3 children and Haruki is the selected child.

I’ve written some codes that display list of families, but I have no idea to connect 2 tables, create an array and walk further more…
How can I achieve this?

Here are my php codes:

function add_families_rest_json($server){
    $server->register_route( 'families', '/families', array(
        'methods'  => 'GET',
        'callback' => 'family_cb',
    ) );
add_action( 'rest_api_init', 'add_families_rest_json' );

function family_cb(){
    global $wpdb;
    $family_query = "SELECT family_name FROM `family`";
    $family_list = $wpdb->get_results($family_query);
    return $family_list;