Magento 2 Migration Extensions Sale

Monthly Archives: January 2018

  1. The Blog Links in SmartWave Porto Mega Menu

    If you have already installed Magento 2 Blog Module v2.6.2 (or later) you can easily add a blog and blog categories links to the SmartWave Mega Menu.

    Blog Link in SmartWave Porto

    Read more »
  2. Get $_GET, $_REQUEST, $_POST in Magento 2

    All PHP programmers are familiar with the superglobal variables such as $_GET, $_REQUEST$_POST, but their direct use is not allowed according to Magento2 code standards. So don't use them in your Magento 2 projects, especially if you want to pass the code Technical Review on the Magento Marketplace.

    So what methods should be used?

    To get data from the query, use the following methods:
    getParam($key, $default = null);
    getParams();
    getPostParam($key, $default = null);
    getPost();

    Read more »
  3. Virtual Types in Magento 2

    In Magento 2, one of the new properties is Magento 2 Virtual Type. What are they for?

    Imagine that you already have a class A available:

    namespace VendorName\ModuleName\Model
    class A
    {
        protected $arg1;
        protected $arg2;
        protected $arg3;

        public function __construct(
            Argument1 $arg1,
            Argument2 $arg2,
            Argument3 $arg3
        ) {
            $this->arg1 = $arg1;
            $this->arg2 = $arg2;
            $this->arg3 = $arg3;
         }
    }

    And you need to create a class B, which will be inherited from A. However, it must take another argument as $arg2. To do this, you will create a new PHP file for class B:

    Read more »
^Top
Chat