In Magento 2, the layout file responsible for rendering CMS pages is cms_page_view.xml. This layout file is typically located in: This layout file determines the structure and contents of the CMS pages, such as which blocks are included and their positions. If you need to customize the layout of CMS pages, you can create or…Continue Reading
Programming
Create a Guest Order using REST Api in Magento 2
Today’s tutorial discusses how to create a guest order using the REST API in Magento 2. Oftentimes, we have to integrate our store into mobile applications, and mobile application needs the data in the form of APIs. Following are the steps to create a guest order using Rest API in Magento 2 Step 1: Create…Continue Reading
Magento 2: How to send data using Ajax form in custom form?
In Magento 2, we can use jQuery to perform some ajax requests such as sending an email from the catalog product, or a custom contact form with user details. The following easy script will help you to implement ajax with jQuery in a phtml file of your choice. Inspiration
How to assign a Guest Order to a Customer in Magento 2?
We are seeing this a lot as the customer places order with out logged in and later create and account and view their orders from the dashboard. We can solve this issue by directly running SQL queries or just creating a small script to do it. SQL Method Using PHP Script Source
How to get product collection based on custom attribute (drop down attribute value)
Magento 2 is well known for it’s capacity to extending the features. Today’s article we will be discussing how to get product collection based on custom attribute (drop down attribute value). For dropdown attribute, We can filter using dropdown option ID instead of Label. So your code is like below. The above 20 is the…Continue Reading
How Get Current URL from a PHTML – Magento 2
Today’s post we are discussing how to get the current URL in phtml file in Magento 2. As we know we have access to object in the phtml, we can utilize that for this purpose. Let’s print methods for the class It produces the output like this From this we can use the method get…Continue Reading
How to programmatically update name of category in specific store – Magento 2
Follow the below code to programatically update name of category in a specific store in Magento 2.
How to write to a file, but overwrite existing data in a bash script?
To write to a file and overwrite any existing data, you can use the > operator. For example, to write “Hello, world!” to a file called hello.txt, you can run the following command: This redirection >> helps to append, but you can use a single arrow syntax to overwrite existing data. If the file hello.txt…Continue Reading
How to get category id by category name in Magento 2
In today’s blog, we are illustrating how to get a category id by category name in Magento 2. Call the collection factory in the constructor of the class and using addAttributeToFilter filter the collection by name. You should make sure your category names are unique, or you have to add the level field in the…Continue Reading
TypeError: PhpMyAdmin\Export::getFilenameAndMimetype(): Argument #5 ($filenameTemplate) must be of type string, null given, called in /libraries/classes/Controllers/Export/ExportController.php on line 397
TypeError: PhpMyAdmin\Export::getFilenameAndMimetype(): Argument #5 ($filenameTemplate) must be of type string, null given, called in /libraries/classes/Controllers/Export/ExportController.php on line 397 The above error was coming when exporting the MySql with a fresh installation of phpMyAdmin. Solution Go to php.ini and change the max_input_vars to a higher value as the default would be 1000.
Magento 2: How to add option values to product attributes programmatically
In today’s blog, we are showing how to add option values to product attributes programmatically in Magento 2.
Magento 2: Get the product attribute’s select option value from option_id without loading the product
In today’s blog, we are showing how to get an option value based on the option id in Magento 2, without loading the product. First of all load the AttributeRepositoryInterface via constructor wherever you require this feature.
How to display images from theme folder in in phtml- Magento 2
You can use below two methods to display images from theme folder in phtml file in Magento 2. Often times it’s very convenient to keep the theme related images to theme images folders.
You need to configure Two-Factor Authorization in order to proceed to your store’s admin area – Magento 2
After installing Magento 2 you might encounter this screen, that says You need to configure Two-Factor Authorization in order to proceed to your store’s admin area.
How to Get Product Stock Quantity and Other Stock Information – Magento 2
In today’s tutorial, I am showing how to get the product stock quantity and information in Magento 2. In this article, I will illustrate mainly two methods to get product stock information in Magento 2, and both methods are tested and confirmed it’s working. #Method 1 This method will be using \Magento\CatalogInventory\Model\Stock\Item class to get…Continue Reading
What is getOrPut in Laravel?
getOrPut feature was introduced in Laravel 8.81 and it’s a pretty amazing oneliner. getOrPut helps you to get an existing key or put the value if it doesn’t exist and return the value on a collection. As of now you want to have three lines of code to achieve this, but getOrPut changes everything. if…Continue Reading
What is the opposite of has() method in Laravel?
We all know the has() method helps list a number of records with at least a related record in Laravel Eloquent. For example, below we can get all posts that have at least one comment. $posts = App\Models\Post::has(‘comments’)->get(); But what would be the opposite of this? How do we get a post that has zero…Continue Reading
Laravel: Download files to storage from SFTP
This post will discuss using Laravel to read and download files from a remote server via SFTP. For this purpose, we use a third-party package to connect to sftp and download the files to the storage folder in Laravel. The first and most important step is to install and configure the league/flysystem-sftp in the Laravel…Continue Reading
Why You Should Use Node Js For Enterprise Software?
Enterprise software is developed to manage complicated tasks, such as monitoring and controlling essential business operations, gathering and analyzing data, and enforcing security policies. These programs tend to be complex, requiring much user input and a wide variety of separate but related components. The optimization of these applications is another potential obstacle. Additionally, enterprise apps…Continue Reading
How to get the total memory and free memory of a system using Node.js?
In today’s article, we will discuss how to get the total memory and available memory of the system using NodeJS. To get the total memory of the operating system using NodeJS, you can use method from the module in Node.js. Note that this method returns total memory in bytes. // import os module const os…Continue Reading
What is the difference between shuffle() and array_rand() in PHP?
What exactly is the difference between shuffle and array_rand functions in PHP? void shuffle ( array input) mixed array_rand ( array input [, int num_req]) takes an array and completely randomizes the array. You may have noticed that uses its parameter by reference and returns true. The downside of this function is it changes the…Continue Reading
Laravel Eloquent- Where Condition with Two Columns
Did you ever think about how to write where condition with two columns(fields) in Laravel Eloquent? In the first place, this is possible in Laravel using the function . For example, you have two fields named sub_total and grand_total, and you need to find all the orders have the same sub_total as grand_total. So you…Continue Reading
How to Add Foreign Key in Laravel Migration?
This tutorial shows how to add a foreign key constraint to a field in Laravel in the migration file. As we know already a foreign key is a field that is used to establish the relationship between two tables via the primary key. This example starts with creating a migration file in Laravel and shows…Continue Reading
What is Str::finish() in Laravel ?
In this article, you will learn about Str::finish() in Laravel. The next question is how to incorporate Str::finish() into your project. If a string does not already end with the given value, the Str::finish method adds a single instance of that value to it:
How to organize email testing in PHP?
What is PHPMailer and how do you use it to send test emails via SMTP in PHP? Find out this and more on email testing in PHP here. How to organize email testing in PHP PHP is one of the most popular languages for web development, so it’s no wonder that email sending and testing…Continue Reading
How to Substract and Add Hours in Laravel Using Carbon?
In today’s article we will illustrate how to use the Carbon library to add and subtract from a given time in Laravel. As you know already, Laravel is capable of doing pretty much anything. This is tested with Laravel7, 8,9 versions. Here you need to take note of Carbon – Well known PHP API for…Continue Reading
How to Get Last Week Data in Laravel using Carbon?
In today’s tutorial, we are showing how to get last week’s data in Laravel using Carbon. In other words, you need to pull all the orders received in the last week. In this case, last week does not mean the last 7 days, but it’s a full week starting from Monday to Sunday. For example,…Continue Reading
Differences between query() and input() in Laravel?
You may be wondering what’s the difference between method and method in Laravel. It’s mentioned straight away in the laravel docs. While the input method retrieves values from the entire request payload (including the query string), the query method will only retrieve values from the query string: The important aspects and the real difference between…Continue Reading
Raw Queries in Laravel
Eloquent is the answer for all kinds of database operations in Laravel. As a matter of fact, which is a great solution for interacting with databases. But if we have complicated business logic/ complex MySQL queries, oftentimes we need to write raw queries in Laravel. A key concern about the usage of raw queries in…Continue Reading
Laravel Eloquent Select Column as Alias
Did you ever think about using an alias in the select columns while using Laravel Eloquent?. We cannot say it’s very Laravel specific, rather a MySql feature. Basically, when you join two or more tables in MySql, chances are very high that you will have the same column names multiple times in the result. This…Continue Reading