• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
logo

Tutsplanet

Free Technical and Blogging Resources

  • Home
  • Web Hosting
  • Programming
  • Plugins
  • Write For US
  • News
  • About Us
  • Tools

Magento 2

How to add Index to table column using Magento 2?

Dec 14, 2020 by Editorial Staff Leave a Comment

It will be advisable to add an index to a database field for better performance and quick selection of records from the database table. Use the below snippet to add an index to database field in Magento 2.

Filed Under: Magento Tagged With: Magento 2

How To Redirect To Previous Page in Magento 2?

Oct 7, 2020 by Editorial Staff 1 Comment

Today’s tutorial we are showing how to redirect to previous page from a custom action in magento 2. This will be useful when you have an error message to show after a form submission. namespace Vendor\Module\Controller\Adminhtml\Index; class Fetch extends \Magento\Backend\App\Action { public function execute() { // TODO: Implement execute() method. $this->_redirect($this->_redirect->getRefererUrl()); } }

Filed Under: Programming Tagged With: Magento 2

How to Apply the Magento 2 patch?

Oct 7, 2020 by Editorial Staff Leave a Comment

Change your Magento store to Developer mode php bin/magento deploy:mode:set developer Download the security patch git apply MAGENTO-9090-2020-010-1-10-04-03.patch After the above run below command to apply the patch php bin/magento setup:upgrade

Filed Under: Programming Tagged With: Magento 2

How To Programatically Cancel The Order Using Order Id in Magento 2 ?

Oct 6, 2020 by Editorial Staff Leave a Comment

It’s very common that we need a feature to cancel an order Programatically in Magento 2. Instead of factory method, we use Magento/Sales/Api/OrderManagementInterface as it’s advisable to use service contracts in Magento 2. Below snippet will help you cancel an order programatically in Magento 2. protected $orderManagement; public function __construct( … \Magento\Sales\Api\OrderManagementInterface $orderManagement, …. ) […]

Filed Under: Programming Tagged With: Magento 2

How To Load Stock Item Using product_id In Magento 2?

Sep 28, 2020 by Editorial Staff Leave a Comment

In some cases you have to load stock item using product_id in Magento2. Today’s snippet we are showing how to do that. For illustration purpose we use a model example. namespace Vendor\Module\Model; use Magento\CatalogInventory\Model\Stock\StockItemRepository; class HelloWorld extends extends \Magento\Framework\Model\AbstractModel { protected $stockItemRepository; public function __construct( StockItemRepository $stockItemRepository ) { $this->stockItemRepository = $stockItemRepository; } public function […]

Filed Under: General Tagged With: Magento 2

How to get GMT date time in Magento 2?

Sep 23, 2020 by Editorial Staff Leave a Comment

Magento 2 usually saves the time in GMT in database, but display on admin or frontend will be based on the selected timezone. Use the below code to get the time with GMT timezone from Magento 2 code. Magento comes with DateTime php class, Magento\Framework\Stdlib\DateTime\DateTime is used for Forms GMT date. <?php public function __construct( […]

Filed Under: PHP Tagged With: Magento 2

How To Get The Collection Of Records From A Custom Module In Magento 2?

Sep 23, 2020 by Editorial Staff Leave a Comment

If you are working on a custom Magento 2 module, and wondering how to get the collection of records from your custom database table, this article is for you. This is very common that your Magento 2 website needs more database tables than what Magento shipped with. So in a listing page such as blog […]

Filed Under: PHP Tagged With: Magento 2

Disable versions in Magento 2

Aug 30, 2020 by Editorial Staff Leave a Comment

By default Magento 2 static urls have a version string attached to it. For example, if you take the view source of the page, you will see urls contains the following string -version1490119662.

Filed Under: PHP Tagged With: Magento 2

How to disable or allow guest checkout in Magento 2?

Aug 29, 2020 by Editorial Staff Leave a Comment

Default Magento 2 setup allows users to checkout as guest in your storefront. But one must say gathering max customer information will be advantageous for both customer and shop owner. Today’s tutorial we are showing how to disable or allow guest checkout in Magento 2. Step 1. Log in to Magento 2 admin panel. Step […]

Filed Under: Programming Tagged With: Magento 2

“Your session has expired” On Clicking Add To Cart – Magento 2.3.x Localhost

Aug 25, 2020 by Editorial Staff Leave a Comment

In your Magento 2 journey, you might have greeted with this error message – “Your session has expired”, when clicking on the add to cart button.

Filed Under: Magento Tagged With: Magento 2

How to Use Magento 2 code in external File/Script

Aug 16, 2020 by Editorial Staff Leave a Comment

This script allows you to call Magento 2 functions run outside Magento 2 setup. You can create any PHP file in Magento 2 root folder and run Magento 2 from there.

Filed Under: Magento Tagged With: Magento 2

How to Add Store Codes to the URLs in Magento 2?

Aug 14, 2020 by Editorial Staff Leave a Comment

If you have a multi-language store and want to add Store Codes to this is the tutorial for you. So your example urls will look like this yourdomain.com/en, yourdomain.com/us, yourdomain.com/uk. Follow the below steps. Login to the Magento 2 admin panel Navigate to Stores > Configuration > General > Web and find the Url Options […]

Filed Under: Magento Tagged With: Magento 2

Product Sort By Price: Low to High and High to Low Magento 2.3

Aug 8, 2020 by Editorial Staff Leave a Comment

Today’s tutorial we are showing, how to add a new filter option in the product listing area of Magento 2.3. Here we are adding price sorting options such as Low to High and  High to Low.

Filed Under: Magento Tagged With: Magento 2

Reset “Use Secure in Front End or Admin” in Database – Magento 2

Jul 27, 2020 by Editorial Staff Leave a Comment

If you ran into a problem like you have changed the secure admin URL back to non secure URL and you forgot to change the or Admin to zero -means disable. It’s total mess that you cannot access the admin side again as all the JavaScript and CSS urls will have https prefix and all […]

Filed Under: Magento Tagged With: Magento 2, MySql

How To Change The Magento 2 Admin Session Timeout

Jul 10, 2020 by Editorial Staff Leave a Comment

It’s quite annoying that every time page goes to login page  when we try to refresh a page or saving a product in Magento 2 admin side. So this can be achieved by changing the admin session timeout in Magento 2.

Filed Under: General Tagged With: Magento 2

How to Install Magento 2.3 & Create a Web Server-LAMP

Jun 2, 2020 by Editorial Staff 1 Comment

This tutorial demonstrates how to install Magento 2.3 and build a web server on operating system Ubuntu 16.04 LTS. In this tutorial I have used Digital Ocean droplet (2GB instance), you may please create the same or you can install one in your PC. First we create a user apart from root user, as it […]

Filed Under: Magento, Programming Tagged With: Hosting, Magento 2

Primary Sidebar




Quick Links

  • A Simple YouTube Video Downloader Script in PHP
  • The 50 Most Useful jQuery Plugins for Frontend Development
  • Word Set 01
  • Convert PNG to JPG Online

Subscribe

* indicates required

Share

   

Hot topics

  • A Simple YouTube Video Downloader Script in PHP 13.2k views
  • Open a URL in a new tab using JavaScript 10.6k views
  • Using Third-Party Libraries in Codeigniter 8.3k views
  • Add FTP/SFTP in Visual Studio Code 6k views
  • Manually Install APK Files In Android Studio Emulator 4.6k views
  • Replace “\n” with new line characters, using Notepad++ 4.6k views
  • Upload Multiple Images and Store in Database using PHP and MySQL. 4.4k views
  • How To Install And Use CKEditor In Laravel? 4.2k views
  • Simple PHP Shopping Cart 4k views
  • Spout, an awesome library for reading and writing in Excel. 3.3k views

Categories

  • Design & Development
  • Drupal
  • Facebook
  • General
  • How To
  • ios
  • Javascript
  • Linux
  • Magento
  • Marketing
  • News
  • PHP
  • Plugins
  • Programming
  • Snippets List
  • Social Media
  • Softwares
  • Themes
  • Tips
  • Wordpress
  • YouTube

Copyright © 2021 · TutsPlanet Gene Theme on Genesis Framework · Powered By BunnyCDN