It may well be that our online catalogue is not updated yet. We have a vast network of ingredients, our supply chain team will be happy to entertain any ingrendient enquiry.
can be quite daunting, due to the limited information in the default order grid. Although Magento order gird is missing a lot of things, product image and product information are the most important.
So, to see what was ordered directly from the grid, you need to add products to the sales order grid in Magento. Today you'll learn how.
You can check out this short video of the process or follow the instructions below.
Add Product Images to Order Grid in Magento
1. Navigate to Stores > Configuration > Magefan Extensions > Better Order Grid.
2. Choose the Image on Hover option in the Product Column Template field.
Once you save the Image on Hover option, you'll see the product image in the order grid. All bought product details will be displayed on hover.
Add Product Attributes to Order Grid in Magento
If you want to display product attributes directly in the order grid, go back to the extension configuration. Choose Grid as the Product Column Template and choose if you wantihor
Sales are a great period for your customers to save some money purchasing your products. However, none of them actually knows how much it takes to organize, arrange and manage sales and orders.
Coupon code sometimes doesn't apply or is used multiple times, or becomes invalid. So, to organize your order grid during sales, you can add coupon codes to the order grid in Magento 2 and easily find orders with discounts.
You just need Extension for this. And in this article, you will learn how to add coupon code column in the order grid.
Take these steps to add coupon code to the order grid in Magento 2:
1. Navigate to Sales > Orders and unfold the Columns menu.
2. Find the Coupon Code in the order attributes and check it.
3. Once you add the coupon code, it will appear in the order grid.
And that's it. You don't need to have any technical skills to add a discount to the sales order grid since Magento 2 Better Order Grid module does it for you.
You won't only be able to see the couponihor
Managing orders in Magento 2 can be really time-consuming since it takes quite some time to filter, find and process them. That is why to provide a better customer experience, you need to optimize order management. And that is exactly what extension can help you with.
It allows you to customize Magento 2 order grid as per your needs to find orders you're interested in easier and filter them faster. So, let's find out how to configure Magento 2 Better Order Grid.
Take the following steps to configure the Custom Order Grid extension:
1. Navigate to Stores > Configuration > Magefan Extensions > Better Order Grid and Enable Extension.
2. Choose to Hide Orders With Statuses and display only orders with certain statuses in the grid.
3. Select the Product Column Template. You can choose to display Image on Hover or Grid.
Note: when you choose the grid product column template, you need to choose Product Column Display Info: Thumbnail, Name, SKU, Price, Qty Ordered, etcihor
The newsletter is a great opportunity for you to notify your customers about some special offers or sales running as well as provide them with updates and news on your Magento store.
Email marketing remains a powerful type of marketing, and it is one of the best ways to establish strong relationships with your customers and bring companies higher sales if they developed well-planned strategies.
Magento allows you to manage newsletters directly from the admin and in this article you're going to learn how to configure them.
Article Contents
Step 1: Configure Newsletter Subscription Options
Step 2: Create Newsletter Template
Step 3: Send Newsletter Template
Step 4: Configure Newsletter Subscribers
Follow these steps to configure newsletters in Magento 2:
Step 1: Configure Newsletter Subscription Options
When managing newsletters on your Magento store the very first step you should take is to check the newsletter general configuration. There are some options that define newsletterihor
The out-of-stock situations are not the most welcomed ones. However, you still can turn them to your advantage. Question is, how?
may be one of the options to go for. Yet, Magento 2 product alerts can do the trick much better. By using them, you interact with your customers more, improving their engagement and loyalty at the same time.
In this article, you're going to learn what are Magento product alerts, how to configure them and manage product alerts run settings.
Ready to start?
What are Magento 2 Product Alerts?
Magento 2 product alerts is a system of notifications customers subscribe to on the product page to receive email notifications about any change in the product price or product stock status. Correspondingly, there are 2 types of product alerts in Magento 2: Product Price Alert and Product In-Stock Alert.
Thus, customers can get the product they are interested in for a more suitable price when they want to. Or get a product they want to buy right after it is backihor
Magento 2 being a multifunctional e-commerce platform allows you to create products from the admin panel. There are plenty of options to fill out to , which obviously takes some time.
And what if you have to create a huge amount of products, especially during the development or testing?
The easiest, in this case, would be to create products programmatically. And that is exactly what you're going to learn in this article.
Use the following method to create a simple product in Magento 2 programmatically:
getObjectManager();
$state = $objectManager->get('\Magento\Framework\App\State');
$state->setAreaCode('frontend');
$product = $objectManager->create('Magento\Catalog\Model\Product');
try {
$product->setName('Test Product');
$product->setTypeId('simple');
$product->setAttributeSetId(4);
$product->setSku('test-SKU');
$product->setWebsiteIds(array(1));
$product->setVisibility(4);
$product->setPrice(array(1));
$product->setImage('/testimg/test.jpg');ihor
Every store works hard trying to make their customers happy. However, sometimes it happens that people want their money back. This is an inevitable step in .
In such cases, people request a refund which in Magento is called Credit Memo.
And in this article, you will find out what is it and how to create it. Besides, you will learn about a solution that will help you to get rid of refunded orders.
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.
Offline Credit Memo means the refund will be saved just in the Magento database and the funds won't be transferred to the bank, therefore no money will be actually returned. It is used in case the offline payment method (e.g. money and check) was used while placing an order.
Online Creditihor
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 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) { /* @var string */ imageUrl = imageUrl.trim(); var baseUrl = 'https://mystore.com/'; var imageFormat = imageUrl.split('.').pop(); var mediaBaseUrl = 'https://mystore.com/pub/media/'; var staticBaseUrl = 'https://mystore.com/pub/static/';ihor
In Magento 2 you can create plugins (interceptors) that allow you to extend functionality and execute your own code before, after, or around any PHP class public method.
For example there is a PHP class with public functions "setName", "getName", "save":
<?phpnamespace VendorName\ModuleName\Folder;class SomeModel{ private $name; public function setName($name, $storeId = 0) { $this->name[0] = $name; } public function getName($storeId = 0) { return $this->name[$storeId]; } public function save($fields, $customData) { /* some save logic here */ }}
How to create plugin in Magento 2?
1. Create the etc/di.xml file in 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\Folder\SomeModel"> <plugin name="mycompany_mymodule_plugin_modulename_Folder_somemodel" type="MyCompany\MyModule\Plugin\ModuleName\Folder\SomeModelPlugin"ihor
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:
Go to Stores > Configuration > Catalog > Catalog and find the Downloadable Product Options section.
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.
Set the Default Maximum Number of Downloads available for 1 customer once he purchases the downloadable product.
Choose if you want the downloadable product to be Shareable, which means customers will receive the download link via email and will be able to share it, or No if you want a customer to logihor
One of the primary tasks of any storeowner is to make the shopping experience as diverse and advanced as possible. Magento 2 custom options can help with that. They help you to provide your customers with an opportunity to choose product options as to their needs without relying on the product attributes.
Such functionality allows you to categorize products, create cart price and . Thus, you may configure it for your own store too. And this is exactly what you'll learn today.
How to Configure Magento 2 Custom Options?
1. Navigate to Catalog > Products and choose the product you'd like to configure customizable options for or Add New Product if needed.
Note: you can't configure Magento custom options for simple products that already constitute the .
2. Scroll down to the Customizable Options section and press the Add Option button.
Specify the Option Title and Type.
Check if you want this option to be Required.
Note: once you check the Required option's box, the corresponding custom optionihor
In the 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).
1. Create the Model file:
app/code/VendorName/ModuleName/Model/Somemodel.php
add the following code to it:
<?php
namespace VendorName\ModuleName\Model;
class Somemodel extends \Magento\Framework\Model\AbstractModel{ protected function _construct() { $this->_init('VendorName\ModuleName\Model\ResourceModel\Somemodel'); }}
The _construct initializes the resource model. Pass the name of the resource model class (create it in the next step) to the _init method.
Model is what you will most often work with. This class must be inherited from ihor
When developing an online store based on Magento 2, you might face the problem of extending the standard Magento 2 or functionality.
Editing Magento core files or modules is not allowed because these changes will be overwritten during the .
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 new theme.
Override module view-files in the vendor folder.
Let's say you need to change this file:
vendor/magefan/module-blog/view/frontend/web/css/blog-custom.css
Make its copy inihor
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 file (except *Test.php) and put a and exit function before each throws an exceptionihor
If you want to change 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 = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = "MY_ATTRIBUTE_CODE") AND aov.store_id =ihor
Sometimes, during you need to get the store Information programmatically. You may need to get a current Store ID, Store Code, Name, Website ID, or .
To retrieve this data use the singleton instance of the following class:
\Magento\Store\Model\StoreManagerInterface
For example, you can include it in your class constructor and then call:
<?phpnamespace \MyCompany\ExampleModule\Model;class Example{ private $storeManager;
public function __construct(
...
\Magento\Store\Model\StoreManagerInterface $storeManager,
...
) { ...
$this->storeManager = $storeManager;
...
}
/** * Examples */ public function execute() { /* Get Current Store ID */ $storeId = $this->storeManager->getStore()->getId(); /* Get Current Store Code */ $storeCode = $this->storeManager->getStore()->getCode(); /* Get Current Store Name */ $storeName = $this->storeManager->getStore()->getName(); /* Get Current Storeihor
Get URL in the .phtml template files
1. Get URL of the store homepage (http://domain.com/):
<?= $this->getUrl() ?>
2. Get URL of some page, e.g. "Contact Us" (http://domain.com/contacts/):
<?= $this->getUrl('contacts') ?>
3. Get URL of the theme static file, e.g.:
app/design/frontend/ThemeVendor/theme_name/web/css/custom.cssapp/design/frontend/ThemeVendor/theme_name/Magefan_Blog/web/js/lazyload.jsapp/code/Magefan_Blog/view/frontend/web/js/lazyload.jsvendor/magefan/module-blog/view/frontend/web/js/lazyload.js
use the following code:
<?= $this->getViewFileUrl('css/custom.css') ?><?= $this->getViewFileUrl('Magefan_Blog::js/lazyload.js') ?>
4. Get URL of the static file in pub/media:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();$mediaUrl = $objectManager->get(Magento\Store\Model\StoreManagerInterface::class) ->getStore() ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
<?= $mediaUrl ?>wysiwyg/image.png
Attention! You should not use media files in the themeihor
Hello there, Magento fans!
Hey hey! It's been a while since we last shared the Magefan updates. Are you ready for the January compilation of news?
Then, let's start!
We would like to begin with the new module that has been released recently. With the extension you can forget about a broken website and increased bounce rates during the deployment time.
There is no need for you to lose profits or choose the most inconvenient time to run deployment commands when you can do this harmlessly with this module.
— extension that helps you increase your website loading speed and boost performance — is even more beneficial now. We have improved HTML tags style attribute background parsing and module compatibility with MGS themes. Moreover, we have fixed the following error:
TypeError: strtolower() expects parameter 1 to be string, null given in app/code/Magefan/WebP/Plugin/Magento/Framework/View/Element/AbstractBlock.php:69 .
We encourage those of you who haven’t yet updated to v2.1.1ihor
One of the most unique Magento 2 offers you to create is a virtual product. But what is virtual product in Magento, and why is it so special?
It stands out because you can neither feel it tangibly, set the weight, or download a virtual product in Magento 2. Some of the common examples of this product type are memberships, services, subscriptions, and warranties.
They can be sold individually or as a part of or . The configuration section contains the familiar fields you can fill out easily. Today, you'll learn how to do it in more detail.
What is a Virtual Product in Magento 2?
Magento 2 virtual product is nontangible and doesn't have a physical representation. Thus, it can be neither shipped nor delivered. The only indication that a customer bought such a product is the confirmation email.
Some of the most popular examples of virtual products are subscriptions, warranties, memberships, etc. You can sell virtual products individually or as a part of other product types.
How to Create Virtualihor
The popularity of downloadable products has increased drastically, both globally and in Magento in particular. It is not a surprising fact, though. Such products as eBooks, music, videos, , updates, or instruction manuals are being actively sold. They don’t require additional manufacturing or shipping, which is an advantage.
Together with other , the platform allows you to create downloadable products with free samples. The process doesn’t differ much from that of a simple product. However, you have to configure the before creating a downloadable product.
But let’s sort everything out. Keep reading to learn how to create a downloadable product in Magento 2.
What is a Magento Downloadable Product?
Magento downloadable product is a digital type of Magento product customers can download from your store. As mentioned above, E-books, manuals, and applications are the best examples of this product type.
When creating downloadable products, you have an extensive set of options to set and makeihor
In case you use some Geo IP modules (like our Magento 2 and Extensions) and have the Varnish installed, then you need to make some additional configurations for it.
The simplest configuration is to add the following lines to the varnish config file:
if (req.http.cookie !~ "PHPSESSID=" && req.http.User-Agent !~ "bot" && req.http.User-Agent !~ "loader") { return (pass); }
In this case, the first customer visit will not be cached by varnish, the php Magento will generate the right cookies, switch to the right store view and change the currency.
However, the drawback of this approach is that the store view will be displayed without varnish cache during the first visit. If you want to avoid this you can configure the varnish cache to have different caches for different countries
To achieve that you have to configure the Geo IP with Varnish. Follow this link for step-by-step instructions.