Laravel: Simple/Easy Installation Guide

This tutorial shows step-by-step guide to install Laravel. Here, I will show two ways for installation. One is installing directly by composer create-project command and the other is by cloning or downloading Laravel from GitHub and then running the composer install command. 1) Method 1 Go to your web server root In Ubuntu, it’s /var/www/. … Read more

PHP: CRUD (Add, Edit, Delete, View) Application using OOP (Object Oriented Programming)

This article shows how to create a CRUD (Create, Read, Update, Delete) application system with PHP & MySQL using Object Oriented Programming (OOP) technique. I had written an article before about creating Simple CRUD application with PHP & MySQL but that has been programmed with procedural way. In this article, we create the same kind … Read more

Magento 2: Install via Composer and Command Line (CLI)

This article/tutorial show how to download and install Magento 2 through command line interface (CLI). We will be using Composer to download Magento 2 from Magento’s repository. Here is the step-by-step guide on installing Magento 2 via command line: 1) Check & Verify System Requirements Before, downloading and installing Magento 2, we need to make … Read more

Magento 2: Get Product’s Custom Option Value from Cart & Order

This article shows how to get custom option values of products/items added to cart or products of any order in Magento 2. I will simply be using ObjectManager for this example. Get custom options of products present in shopping cart $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $cart = $objectManager->get('\Magento\Checkout\Model\Cart'); // get cart items $items = $cart->getItems(); // get … Read more

Magento 2: Get all Categories of any/current Product

This article shows how we can get list of all categories from current product or any particular product as well. Both ways (Dependency Injection & Object Manager way) are shown below: Using Dependency Injection (DI) Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory, \Magento\Catalog\Model\ProductRepository and \Magento\Framework\Registry classes … Read more

Magento 2: Upgrade/Update using Command Line & Composer

This article shows how you can upgrade/update your Magento 2 version through command line using composer. Upgrading to Magento 2.3.x is a bit different than that of Magento 2.2.x or 2.1.x. At first, I will show the commands that need to be run to upgrade Magento2 to version 2.1.x or 2.2.x. Upgrading Magento to 2.2.x … Read more

Magento 2: Get all shopping cart items, subtotal, grand total, billing & shipping address

This article shows how to get shopping cart items/products, subtotal and grand total of cart, and shipping and billing address entered while doing checkout in Magento 2. I will be using both Dependency Injection (DI) and Object Manager in the below example code. Using Object Manager – Get products id, name, price, quantity, etc. present … Read more

Magento 2: Run Custom SQL Query

This article shows how to write/run/execute custom SQL queries in Magento 2. We need to instantiate class Magento\Framework\App\ResourceConnection for this. You have to inject this resource class in your module’s Block/Model/Controller class constructor. After that, you can use that object to run custom sql queries. In this example, I will simply be using object manager … Read more