Page 10 - Monthly Archives: 2023
- 2 min read
Even though Magento 2 is a very flexible and easy-to-manage eCommerce platform, operating an online store may be rather challenging sometimes. Same as , getting products by ID is certainly a crucial skill.
Since it is one of the most frequent operation ones comes across when working with Magento, you have to know how to do it. There are a few ways to do so, and in this article, you'll learn how to use each of them.
Get Product by ID Using Factory Method
The most common way to get a product by ID in Magento 2 is to use the factory method. To do that, use the following code:
protected $_productFactory;public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory) { $this->_productFactory = $productFactory;}
After that, get the product by ID, by executing the below command.
$product = $this->_productFactory->create()->load($id);
Get Product by ID Using API Repository
API repository is the other method you can choose. Execute the following code to get product objects:ihor
- 2 min read
Speed optimization is one of the ultimate goals of every store. That's why when trying to , you'll definitely come across lazy loading, one of the best ways to optimise images.
For those of you who don't know , it is a loading technique that helps you to load only images available within users' viewport. This helps to improve page loading and deffer unnecessary resources.
Image lazy load configuration is not that hard but you might sometimes encounter issues with configuring the lazy load of CSS background images. And that's what we'll be working on today.
How Do Lazy Load Extensions Work?
Before moving any further we need to revise the basic principle used in Lazy Load extensions to learn how to apply it to the CSS background images.
By default browser loads an image added in the src attribute of the image tag during page load:
<img src="image.jpg" />
e.g. so if your page has 50 images added the same way, as described above, all of them will be loaded at once during pageihor
- 2 min read
In most cases, invoices in Magento 2 are created automatically. However, depending on the , orders may be invoiced and shipped before the payment is submitted. For such cases, you should know how to create invoices in Magento.
Of course, Magento 2 allows you to . But if you want to avoid complicated programming work or save your precious time, there is a better option. You can easily create an invoice in Magento 2 admin panel. And in this article, you'll find out how to do that.
To create invoices in Magento 2:
1. Go to Sales > Orders and choose an order you'd like to create an invoice for.
Note: you can create invoices only for orders with Pending .
2. Press the Invoice button in the top menu panel.
3. Check the data presented in the Order & Account Information and Address Information sections. If you need, you can tweak the info in some of the fields by pressing Edit.
4. Move to the Payment & Shipping Method section. Here you can create a shipment at the same you createihor
- 4 min read
Hello, Magento fans,
Catch the news and updates that took place this February. The winter is almost over, so get ready for the sunny days and new great things from Magefan.
New features of the !
Saving time while updating Magento catalog is key to effective management. And dynamic category is a perfect tool for improving the creation and updating of categories.
Now, it works even better, since we’ve improved compatibility with Magento Commerce and Commerce on Cloud.
Besides, we’ve fixed an issue with the Idle (backlog items) appearing repeatedly because of the enabled "UPDATE BY SCHEDULE" index mode. The SQL error on the dynamic product attribute value update that appeared on Magento Commerce is fixed as well.
New features of !
If you’ve planned on displaying product attributes in the description, you can now do that with the widget we’ve added.
We’ve also fixed the display issue on the store view level — displaying custom product tabs on different store views is even moreihor
- 2 min read
February 24, 2022.The day when the full-scale war started changed the lives of all Ukrainians and the world. Since 2022, February 24 is not just another day on the calendar. For us, it’s the beginning of a new era.We thought it would last for a few days or just a few weeks. And these few days turned into 365 days of war and it's not over. Every day of this war is hard less or more for each of us.
Although the first days were full of fear, tears and ignorance, we began to act and fight. We united in one strong nation, one big family that could resist anything.We'd like to share how the lives of our team members changed this year.
Viktoria:
"If I say that 2022 was a difficult year, it won't cover even a tiny bit of all the horrors we, Ukrainians, had to face. I consider it to be a turning point in my life that made me sort out my priorities and become much more mature. At the same time, I fell in love with our country, culture and people all over again. This is why I know thatihor
- 10 min read
Although Magento 2 cookies may seem unimportant to users, they are essential for merchants. They help collect customers' personal data for marketing and analytics. But most importantly, they help maintain .
There are some basic Magento 2 cookie settings you can configure by default. They include Magento cookies policy, cookie lifetime, cookie consent bar, cookie restriction mode and others.
This guide teaches you how to configure Magento cookies properly and how to make them compatible with Google Consent Mode v2. There are also details on how to set up the cookie consent bar and add new cookies to track in Magento.
Key takeaways
Magento 2 cookies are used to keep track of customer sessions, analyse their behaviour, and provide personalised web browsing.
Magento cookie settings allow merchants to set up cookie lifetime, domain, cookie restrictions, and consent.
Magento collects essential (session id, customer authentication, customer group, consent, etc.) and non-essential (_ga, _gatihor
- 2 min read
Product page optimization is one task that is never crossed out of the eCommerce TO-DO list. You need to optimize , create more engaging images and update product information regularly to keep people coming to your store.
Product attributes, in particular, are essential on the product page since they hold a quick summary of the product details. However, unfortunately, Magento allows you to add new attributes to the storefront only in the More information product tab.
So, in this guide, you'll learn how to display current product attributes in the product short descriptions or any other place on the product page.
You can do that with the Current Product Attribute Widgets that com with the .
Add Сurrent Product Attributes to Product Description
To display current product attributes on product pages in Magento:
1. Navigate to Catalog > Products and chose a product to which you want to add current product attributes.
2. Scroll down to the product Short Description and press on Widgetsihor
- 1 min read
It is vital to keep track of all products you can sell, especially when managing . Magento provides multiple options for that, the most basic being . It reflects a sum of items from all sources and allows you to see how many products you have left.
However, there is no way to filter products by salable quantity in Magento. At least, there isn't an easy way to do that since most guides show you how to do it programmatically.
Since Extension offers you this feature by default, we want to share how easy it is to filter products from the admin panel.
To filter products by salable quantity in Magento 2:
1. Navigate to Catalog > Products and open the product Filters.
2. Find the Salable Quantity field, type the number you'd like to filter the salable products by and press the Apply Filters button.
Once you apply the filter, you will see the products with the salable quantity you've just entered in a corresponding field.
The next thing to do is to to increase the salable quantityihor
- 3 min read
No matter how hard you try to prevent your store's data from a sudden disappearance, there is always a slight risk of different attacks or system failures. No matter how well-organized your store operation is, anything from and to updating Magento can cause some data to get lost.
To prevent this from happening you need backups. And luckily, you can back up Magento 2 in multiple ways.
Today, you'll learn about each of them in particular, so a copy of all the necessary data is created and can be easily restored.
Pro tip: use to get notified about when there are sensitive backup files in the Magento directory.
Create Magento 2 Backup via Admin Panel
To create and schedule backups in Magento 2:
1. Go to Stores > Configuration > Advanced > System > Backup Settings.
2. Enable the backup by choosing Yes in the corresponding field.
3. Select Yes in the Enable Scheduled Backup field if you want to back up your data regularly.
4. Specify the Scheduled Backup Type. You've got 4 optionsihor
- 2 min read
Since Magento architecture is structured in a way to store data in different database tables, all data have to be reindexed when you make any changes to your store. And while you can or even the , this process is still time-consuming.
In this guide, we want to help you optimize the process.
Since the Catalog Category Product indexer takes the longest to execute we'll take it as an example for this article. So, you can optimize execution time by changing with batch_size of the Catalog Category Product indexer.
However, to get a better picture of how this works, let's define what is a batch size and why you need to modify it.
How Magento Reindex Works?
Batch size is a number of indexes that will be processed at a time, one MySQL query.
Imagine that you have a store with 40k products, and you do some changes, like , to all of your products. This will cause 40K indexes to be invalidated.
Magento splits data for reindexing in the following way:
Number of batches = number of indexesihor
- 2 min read
Providing high-quality service requires you to optimize multiple processes in your store, including order management. That being said, looking for certain order details might take some time, especially with hundreds of products.
Nevertheless, Magento allows you to eliminate the hard work. You can get order data by increment ID in Magento in multiple ways, the same as you can or .
So, in this article, you'll learn how to use each method.
Get Order Data by Increment ID Using Factory Method
The factory method is used the most frequently. Use the following code:
protected $orderFactory;
public function __construct(
\Magento\Sales\Model\OrderFactory $orderFactory
) {
$this->orderFactory = $orderFactory;
}
public function getOrderByIncrementId()
{
$orderIncrementId = 10000003;
$order = $this->orderFactory->create()->loadByIncrementId($orderIncrementId);
}
Get Order Data by Increment ID Using API Repository
Here is one more option. You might as well use the API repository to get order by incrementihor
- 4 min read
With thousands of blog posts appearing on the web monthly, simply writing good content is not enough to lure more readers in. You need to come up with something to set your content apart from others in search results. Fortunately, Google and other search engines have already introduced that "something". It is structured data.
Except for the BlogPosting article schema our already adds to the blog posts by default there is also a HowTo structured data. While the former merely tells Google that your content is a blog post, the latter makes your blog post eligible for rich results.
Today, you'll learn what exactly is HowTo schema markup, why you need it for your blog posts in Magento and how to add them easily with no coding skills.
What is HowTo Structured Data?
HowTo is a special type of structured data that helps you to define your content as a how-to, especially if your blog posts provide a set of steps for completing a task (including text, images and videos).
Marking yourihor
- 1 min read
Customers build some associations with your brand right after they land at your store for the first time. This is why it is important to configure the default page (the one associated with the ) since this is where people land if some page is not accessible.
Thus, having these default pages configured helps to guide your clients through the website and eliminates any confusion that might appear on the way.
This article is exactly what you need if you want to know how to set up default pages in Magento 2.
To configure default pages in Magento 2:
1. Go to Stores > Configuration > General > Web > Default Pages and enter the Default Web URL.
2. Choose what page should be displayed for the CMS Home Page.
3. Specify the Default No-route URL.
4. Select the CMS No Route Page from the available options in the dropdown list.
5. Choose the CMS No Cookie Page to be displayed when cookies are disabled.
6. Specify whether to Show Breadcrumbs for CMS Pages.
Don't forget to press the Save Config buttonihor
- 2 min read
While looking through various , you can't miss downloadable products. As the name suggests, these are digital products that can be downloaded — books, software, videos, etc. This type of content is becoming more and more popular these days. As a result, you can benefit greatly from having them in your store's catalogue.
via the admin panel may be rather challenging since it requires lots of steps. Fortunately, there is a programmatic way to optimize the process.
The following code will help you to create a downloadable product in Magento 2 programmatically:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get(\Magento\Framework\App\State::class);
$state->setAreaCode('frontend');
try {
$product = $objectManager->create(\Magento\Catalog\Api\Data\ProductInterface::class);
$product
->setSku('sku')ihor
- 2 min read
Unlike the other , virtual products don't have a physical representation. These can be gift cards, services, certificates, warranties, etc.
Using the admin panel to is not the only way. You might as well be looking for some alternatives. In this case, you can try to create a virtual product programmatically and in this article, you'll learn how to do that.To create a virtual product in Magento 2 programmatically:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get(\Magento\Framework\App\State::class);
$state->setAreaCode('frontend');
try {
$product = $objectManager->create(\Magento\Catalog\Api\Data\ProductInterface::class);
$product
->setSku('Main Virtual') // Set your sku here
->setName('Virtual Color Product') // Name of Product
->setAttributeSetId(4) // Attribute set id
->setStatus(1)ihor
- 2 min read
Invoices are important elements of efficient . This is a special type of document containing all the order details that are of great importance for both a customer and a store.
In most cases, invoices are created automatically, based on the you have. But when it comes to printing, you have to do it manually. Fortunately, Magento allows you to print invoices in more than one way. You can either print a particular invoice or print several in bulk.
So, don't miss an opportunity to learn how to print invoices in Magento 2 using this guide.
Want to send order-related documents automatically? Attach PDF Invoices and other files to the sales emails using .
How to Print an Invoice in Magento 2?
To print an invoice in Magento 2:
1. Go to Sales > Invoices, choose the order you would like to print the invoice for, and press the View link.
2. Press the Print button on the top menu and the PDF file will be downloaded.
It really couldn't be simpler. However, if you want to print multiple invoicesihor
- 3 min read
Having multiple listed in your store catalog helps to make the customer experience in your store more diverse. One of the many options you can provide is a . Basically, it consists of simple and virtual products that can be customized according to the client's preferences. Customers can choose the size, weight, color, etc. to get the very product they like.
Although, you can create bundle products from the admin panel creating bundle products programmatically is much faster. So in this article, you'll learn how to do that.
Use the below method to create a bundle product in Magento 2 programmatically.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get(\Magento\Framework\App\State::class);
$state->setAreaCode('frontend');
try {
$bundleProduct = $objectManager->create(\Magento\Catalog\Api\Data\ProductInterface::class);ihor
- 6 min read
Being constantly concerned with the Google PageSpeed (GPS) score, many online entrepreneurs often overlook the importance of blogging in their marketing strategy.
Hyvä will help you reach the maximum performance and provide the utmost experience for your website visitors. But after mastering your website speed, you’ll need something else ー drive new traffic to your website. Lots of it.
According to the latest blogging statistic around 60% of people purchase a product after reading a blog post about it. So why isn’t it being talked about more often?
A good blog helps you establish your brand voice, drive more traffic and increase conversions on your store. That being said, if you have any doubts about whether to invest your time and effort into blogging on Hyvä, we’re here to unveil them.
Top 10 Reasons Why Your eCommerce Site Needs a Blog
When asked, many know exactly why they haven’t started a blog on their eCommerce store 一 it takes too much time to see the results, it doesn’tihor
- 1 min read
Grouped products are only one of many . What is special about them is that they consist of simple products that can be purchased separately or as a group. Moreover, grouped products don't have a price, since it's defined by its component products.
Of course, you can using the admin panel. However, you might also be looking for a programmatic way to perform this task.
If you want to know how to create grouped products programmatically, you've landed on the right page.
To create a grouped product in Magento programmatically use the following code:
<?php error_reporting(E_ALL);ini_set('display_errors', 1); use Magento\Framework\App\Bootstrap; require __DIR__ . '/app/bootstrap.php'; $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap->getObjectManager(); $state = $objectManager->get(\Magento\Framework\App\State::class);$state->setAreaCode('frontend'); try { $product = $objectManager->create(\Magento\Catalog\Api\Data\ProductInterface::class); $product->setTypeId(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE)ihor
- 1 min read
Starting from February 1, 2022, all our extensions will go with to the new product releases and lifetime access to the source code.
In order to download the latest version of your extension and receive free support service after the 365-day period since the extension has been ordered, you need to purchase the Extension Renewal.
The Extension Renewal costs 50% of the product price.
Access to all previous versions will be available in your account, however, you will not be able to download the latest version unless the Extension Renewal is purchased.
- 3 min read
Hello, Magento fans,
Eager to learn about the first news and updates digest in 2023?
Here we go.
New features of the !
As you know, a well-structured SEO strategy brings more revenue, the same as choosing the right tools. Our SEO extension is a must-have since it helps Google to discover, index and rank your store which brings more traffic as a result.
So, in the latest release, we’ve improved it for better results.
We’ve extended catalogue category pagination settings for SEO-friendly pagination pages. Besides, we’ve improved the meta title, description, keywords, H1 tag masks and crosslinks processor.
New features of !
Every SEO specialist would confirm that structured data is more than important for improved visibility on Google.
Product, organization, search bar and FAQ snippets are important, same as is the HowTo markup. That’s why we’ve added a new in the latest version of the Rich Snippets extension. With the ‘HowTo’ rich snippet widget you can easily drive moreihor
