Monthly Archives: February 2021

  1. How to Pass Magento 2 Certification [Useful Tips]

    Magento has developed several certificates for Magento 2, one of which is — Magento 2 Certified Professional Developer.

    To get this certificate, you need to take an exam to test your knowledge and skills required to modify Magento 2 in the following areas: user interface, databases, admin panel, ordering process, catalog and extensions functionality.

    The Magento 2 Developer Exam is for those who have a deep understanding of the Magento concepts and experience of developing Magento 2. It is recommended that you have not less than 1.5 years of experience in customizing Magento 2 before applying for the exam.

    The exam consists of 60 single and multiple choices questions in English. The duration time is 90 minutes (1.5 hour). To successfully pass the exam you need to receive 64% or higher.

    In this article, we will walk you through the low-cost options to prepare for the Magento 2 Certification without courses such as, for example, Magento U for $ 950.

    Read more »
  2. How to Create CMS Page in Magento 2?

    Magento 2 CMS Pages are the set of your Magento 2 website pages used for distributing content. Magento 2 enables you to create CMS pages for different purposes or translate CMS pages for different locales. You can even restrict some CMS pages visibility for a certain group of customers. 

    Wonder how to do that? Find the answer later in this article.

    Follow these steps to create CMS page in Magento 2:

    1. Navigate to Content > Elements > Pages and press the Add New Page button.

    Magento

    Read more »
  3. How to Create Credit Memo (Refund) in Magento 2?

    Every store works hard trying to make their customers happy. However, sometimes it happens that people want their money back. In such cases, people request a refund which in Magento is called Credit Memo.

    And in this article, you will learn what is it and how to create it.

    What is Credit Memo in Magento 2?

    Magento 2 Credit Memo is a document that defines how much money will be returned to the customer. How you create credit memos in Magento 2 generally depends on the payment method used while placing the order.

    Based on this there are 2 types of credit memos: Online and Offline.

    Read more »
  4. How to Create Multiple Stores in Magento 2?

    Instead of creating different websites on your Magento 2 instance, you can simply create multiple stores with the different product catalogs and manage them easily from the admin panel.

    The system of multiple websites, stores and store views provide you with the opportunity of effective and simple Magento 2 store management.

    So, in this article, you'll learn how to create multiple stores in Magento 2.

    In order to create multiple stores in Magento 2 follow these steps:

    1. Go to Stores > All Stores and press the Create Store button.

    Magento 2 All Stores

    Read more »
  5. How to Change Default Store View in Magento 2?

    Magento 2 default store view is the store view customers are directed to from the search results. Magento naturally has the store switcher feature that allows your customers to change the store view and move to the one they like.

    You can have as many store views on your Magento 2 as you want within a single store. However, customers will be still guided to the default one. 

    So, sometimes you need to change the default store view.

    Follow these steps to change the default store view in Magento 2:

    1. Go to Stores > All Stores and choose the Store you want to change the default store view for.

    Read more »
  6. MGS_ClaueTheme Main Product Image Missing When Enabling WebP

    If you use Magento 2 WebP Images extension and have the MGS_ClaueTheme you can face the issue with the product gallery on the configurable product page, the main product image can be missing/brocken.

    To fix this issue add the following code:

    item['zoom'] = $(this).attr('data-zoom');
    if ($(this).find('[srcset].img-responsive').length) {
    item['full'] = $(this).find('[srcset].img-responsive').attr('srcset');
    item['thumb'] = $(this).find('[srcset].img-responsive').attr('srcset');
    item['caption'] = $(this).find('[srcset].img-responsive').attr('alt');
    } else {
    item['full'] = $(this).find('.img-responsive').attr('src');
    item['thumb'] = $(this).find('.img-responsive').attr('src');
    item['caption'] = $(this).find('.img-responsive').attr('alt');
    }

    to the file:

    app/code/MGS/ClaueTheme/view/frontend/web/js/configurable.js
    Read more »
  7. Uninstalling PWA Add-On for Magento 2 Alternate Hreflang

    If you decided to remove PWA Add-On for Magento 2 Alternate Hreflang by Magefan, please follow the steps below, also you can contact our team for a free consultation in case you have any issues with Magefan's extension.

    Remove Extension Files

    Removing files instruction depends on a way PWA Add-On for Alternate Hreflang Tags has been installed.

    1. If you can find the extension files in the folder

    app/code/Magefan/AlternateHreflangGraphQl

    then remove this folder.

    2. If the Add-On  was installed via the composer and its files located in the folder

    vendor/magefan/module-alternate-hreflang-graph-ql

    then run composer CLI command to remove it

    composer remove magefan/module-alternate-hreflang-graph-ql

    Read more »
  8. Updating PWA Add-On for Magento 2 Alternate Hreflang

    If you need to update PWA Add-On for Magento 2 Alternate Hreflang by Magefan, please follow the steps below. Note that the update instructions depend on the method PWA Add-On for Alternate Hreflang Tags was installed with.

    Update using composer (Method 1)

    If the PWA Add-On for Alternate Hreflang Tags was installed via the composer (check if vendor/magefan/module-alternate-hreflang-graph-ql folder exists), then you need to run these simple CLI commands in Magento 2 directory:

    composer remove magefan/module-alternate-hreflang-graph-ql
    composer require magefan/module-alternate-hreflang-graph-ql ^x.x.x
    # replace x.x.x with the version you want to use
    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    php bin/magento setup:static-content:deploy

     

    Read more »
  9. PWA Add-On for Magento 2 Alternate Hreflang Installation

    Do you want us to install PWA Add-On for Alternate Tags for you?

    Let our technical engineers do it – check out our Installation Service.

    To install PWA Add-On for Magento 2 Alternate Hreflang Tags by Magefan, please use one of these installation methods.

    Note: please make sure you have the Magento 2 Hreflang Tags extension installed before you install the PWA Add-On.

    Installation Method 1 - Installing via Composer (recommended)

    Please navigate to your Magefan Account > My Downloads > Install via Composer to get the composer installation instructions.

    Read more »
  10. How to get Magento 2 WebP Image in the Third-Party Application?

    WebP — is a modern image file format many websites use in order to reduce image size and improve website performance. But let's not forget that big-size images can slow down your application loading too.

    Consider using WebP images in your application for Magento 2?

    Here is how.

    If you have a third-party application (e.g. application for iOS, Android, etc.) and use it for your Magento 2 store, you can display images in WebP format there, even if you only have the PNG, JPG, or other format images.

    The only thing you need is our Magento 2 WebP Images extension installed on your Magento 2 store.

    So, to display WebP images in third-party applications you have to define the getWebPUrl function in the aplication code. Find the example below:

    function getWebUrl(imageUrl) {
    Read more »
  11. How to Create Custom Cron Job in Magento 2?

    Magento 2 is a complex unity of features that help you to build a successful, easily-manageable store. There are a lot of processes to be handled in Magento 2 admin that require automation and scheduling. And that is exactly where cron job comes in handy. So...

    Let's find out what exactly is it, why you need it and how to create custom cron job in Magento 2.

    What is Magento cron job?

    Magento cron job — is one of the most important Magento 2 features. It helps to configure commands or script that systematically runs and performs the tasks you intend it to.

    With the cron job you don't need to manually reindex, generate google sitemaps, send Magento emails, update currency rates etc. The cron job does it all for you automatically, on a specific date and time if you configure it correctly. 

    Read more »
  12. How to Run Magento 2 Code in External File/Script?

    Sometimes you need to run Magento 2 code externally, in the following cases:

    • Magento 2 integration with other frameworks or platforms that are installed on the same web server,
    • quick test execution of some method, for example, cron job.

    Read more »
  13. How to Create Plugin (Interceptor) in Magento 2?

    Now, Magento 2 has the plugins, interceptors, which allow you to execute your own code before/after calling the public class method.

    Following steps to create plugin in Magento 2:

    1. Create the etc/di.xml file in your module folder and add the following code there:

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
        <type name="VendorName\ModuleName\Foder\SomeModel">
            <plugin name="mycompany_mymodule_plugin_modulename_foder_somemodel"
                    type="MyCompany\MyModule\Plugin\ModuleName\Foder\SomeModelPlugin" sortOrder="10" />
        </type>
    </config>
    Read more »
  14. Configure Downloadable Product Options in Magento 2

    Downloadable products in Magento 2 have no physical form and require practically nothing to manage. You don't need to cover manufacturing, publishing, shipping or delivery, etc. And that is what makes downloadable products so popular. 

    In Magento 2, except for creating a downloadable product, you have to configure the general Downloadable Product Options.

    These steps to configure Downloadable Products Options in Magento 2:

    1. Go to Stores > Configuration > Catalog > Catalog and find the Downloadable Product Options section.
    2. Choose the Order Item Status to Enable Downloads which defines if the order needs to be Invoiced or Pending for a customer to be able to download the product.
    3. Set the Default Maximum Number of Downloads available for 1 customer once he purchases the downloadable product.
    Read more »
  15. How to Configure Product Custom Options in Magento 2?

    When you add custom options to a product in Magento 2, you give your customers the opportunity to choose product options as to their needs without relying on the product attributes.

    Customizable options allow you to categorize products, create cart price rules and dynamic categories rules.

    To configure product custom options in Magento 2:

    1. Navigate to Catalog > Products and choose the product you'd like to configure customizable options for or Add New Product.

    Read more »
  16. How to Create Cart Price Rule in Magento 2?

    Magento shopping cart price rules are the rules with conditions you set up in the Magento 2 admin panel during the sales, special offers, and any other promotional occasions to provide a discount.

    So, creating the cart price rules in Magento 2 is a useful practice since it encourages customers to make more purchases in your store.

    Follow these steps to create Cart Price Rules in Magento 2:

    Step 1: Add New Cart Price Rule

    Step 2: Set the Cart Price Conditions

    Step 3: Set the Cart Price Actions

    Step 4: Set the Cart Price Labels

    Step 5: Manage Coupon Codes

    Read more »
  17. Load Data from Magento 2 Database

    In the previous article you learned how to create new tables in Magento 2 database. In this one, you will learn more about the models used to work with the Magento 2 database which allows you to read, edit and delete the data. 

    Magento 2 and Magento 1 uses the Model/ResourceModel/Collection ORM (Object-relational mapping) for these purposes. To implement this concept you need to create 3 files (model, resource model, collection).

    Read more »
  18. Override Magento 2 Storefront View Files in Theme

    When developing an online store based on Magento 2, you might face the problem of extending the standard Magento 2 or Magento 2 modules functionality.

    Editing Magento core files or modules is not allowed because these changes will be overwritten during the upgrade.

    So, how to make changes to the storefront (frontend) template file, css, js?

    WARNING! The following instructions cannot be used to override the layout files.

    Override module view-files in the app/code folder.

    Let's say you need to change this file:

    app/code/Magefan/Blog/view/frontend/templates/post/view.phtml

    Make its copy in the theme folder with the following path:

    app/design/frontend/ThemeVendor/themename/Magefan_Blog/templates/post/view.phtml

    Make the necessary changes to the newly created theme file.

    If your own theme is missing from your Magento installation, create one.

    Read more »
  19. Magento 2 An element with a "root" ID already exists - Fix

    If you get an error "An element with a “root” ID already exists" in your Magento 2, it is, most likely, related to a third-party extension that calls methods to re-render a page.

    To fix the "An element with a “root” ID already exists" error:

    1. Find a PHP file and a line that throws an exception.

    2. Open CLI (terminal), navigate to the Magento root directory, and run the following commands to find the proper file:

    grep vendor/ -re ' ID already exists'
    grep app/ -re ' ID already exists'

    As a result, you will get an output similar to this:

    vendor/magento/framework/Data/Form.php: 'An element with a "' . $elementId . '" ID already exists.'
    vendor/magento/framework/Data/Test/Unit/FormTest.php: $this->expectExceptionMessage('An element with a "1" ID already exists.');
    vendor/magento/framework/Data/Structure.php: new \Magento\Framework\Phrase('An element with a "%1" ID already exists.', [$elementId])

    3. Then open each fi

    Read more »
  20. Change Attribute from DROPDOWN to TEXT in Magento 2

    If you want to change product attribute type from dropdown to text in Magento 2, all you need to do is to run the following SQL queries (please make a Database backup before execution):

    1. This query will change the attribute settings and convert it to a text attribute.

    UPDATE eav_attribute SET
    backend_type = "varchar",
    frontend_input = "text",
    source_model = ""
    WHERE attribute_code = "MY_ATTRIBUTE_CODE";

    2. This query will copy dropdown attribute data to the text attribute value table and replace the option IDs with their actual labels (text).

    INSERT INTO catalog_product_entity_varchar
    SELECT null as value_id, pei.attribute_id, pei.store_id, pei.entity_id, aov.value as value
    FROM catalog_product_entity_int pei
    LEFT JOIN eav_attribute_option ao ON pei.attribute_id = ao.attribute_id
    LEFT JOIN eav_attribute_option_value aov ON ao.option_id = aov.option_id
    WHERE
    pei.value IS NOT NULL
    AND pei.attribute_id
    Read more »
Posts loader
^Top
Chat