Magento 2 : Why the configurations are created as Virtual products 0


If you wonder why the configurations you’ve created for your configurable product are creating as “Virtual Products”: please check the value of “Weight” attribute of your Configurable product.

No matter you created a New > Simple product or New > Configurable product, you can make it a configurable product by adding configurations. But if you haven’t add a value for “Weight” you’ll end up with bunch of virtual products for the configurations and results not having a “Shipping” step on checkout page.

Missing PHP extensions during composer install/update 2


If you get any error saying missing PHP extensions during composer update or install please do followings.

  1. Make sure you have those extensions installed by running
    php -m
  2. If you do not have missing extensions enable it from php.ini or install them. Installation instructions depends on your desto.
  3. If you are still getting the error while you already have installed the extensions your composer need to be updated.
     composer selfupdate

Magento 2 CDN / Static file signing 0


Magento 1 does not come with built in CDN support (version control system). In Magento 2 you can enable version control for static files by setting Store=>Configuration=>Advanced=>Developer=>Static file settings to yes. This will create text file under pub/static/deployed_version.txt with version number. In developer mode it will automatically get updated with time stamp.

CDN, Static, Signing, Magento 2

CDN, Static, Signing, Magento 2

Magento 2 Theming with Grunt / Less Part 2 0


Installing and configuring Grunt

  1. Install node.js to any location on your machine.
  2. Install Grunt CLI tool globally. To do this, run the following command in a command prompt:
    npm install -g grunt-cli
  3. Install Grunt in your Magento directory. To do this, run the following commands in a command prompt:
    cd <your_Magento_instance_directory>
    npm install grunt --save-dev
  4. Install (or refresh) the node.js project dependency for your Magento instance. To do this, run the following commands in a command prompt:
    cd <your_Magento_instance_directory>
    npm install
    npm update
  5. Add your theme to Grunt configuration. To do this, in the dev/tools/grunt/configs/theme.js file
  6. If you want to use Grunt for “watching” changes automatically, without reloading pages in a browser each time, install the LiveReload extension in your browser.
  7. Check the video for complete Magento 2 installation, creating theme, installing and configuring grunt and some debugging. Magento 2 Installation

Magento 2 setup Upgrade scripts 0


  1. Under your Magento 2 module > inside the directory “Setup”
    (Create Magento 2 Module, Magento 2 install scripts)
    Create a new file: “UpgradeData.php” with the below content.

    
    <?php
    namespace Magleaks\Catalog\Setup;
    
    use Magento\Catalog\Model\Product;
    use Magento\Eav\Setup\EavSetupFactory;
    use Magento\Framework\Setup\ModuleContextInterface;
    use Magento\Framework\Setup\ModuleDataSetupInterface;
    use Magento\Framework\Setup\UpgradeDataInterface;
    
    class UpgradeData implements UpgradeDataInterface
    {
        /**
         * EAV setup factory
         *
         * @var EavSetupFactory
         */
        private $eavSetupFactory;
    
        /**
         * Init
         *
         * @param EavSetupFactory $eavSetupFactory
         */
        public function __construct(EavSetupFactory $eavSetupFactory)
        {
            $this->eavSetupFactory = $eavSetupFactory;
        }
    
        /**
         * @param ModuleDataSetupInterface $setup
         * @param ModuleContextInterface   $context
         */
        public function upgrade(
            ModuleDataSetupInterface $setup,
            ModuleContextInterface $context
        ) {
            $dbVersion = $context->getVersion();
            /** @var EavSetup $eavSetup */
            $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
    
            if (version_compare($dbVersion, '2.0.1', '<')) { // update an existing product attribute to add as soring options
                $eavSetup->updateAttribute(
                    Product::ENTITY,
                    'name',
                    'used_for_sort_by',
                    false
                );
            }
        }
    }
    
    
  2. Update the setup_version of your module in “etc/module.xml” file in your Module.

    
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
        <module name="Magleaks_Catalog" setup_version="2.0.1"/>
    </config>
    
    
  3. Go to your Magento 2 root folder from your terminal and run

    
    bin/magento setup:upgrade