Magento: Create Customer Programmatically

This article shows how you can programmatically (through code) create customers in Magento 1.x. In this example code, you can find saving customer general information along with saving customer’s billing address and shipping address. Here are the steps followed in the code below: – The code first loads the customer by email. – If the … Read more

Associated Simple Product Price in Cart: Magento Extension [FREE]

Associated Product Price in Cart is a FREE Magento extension that uses the associated simple product’s price in shopping cart instead of the configurable product’s price. This module is compatible with Magento version 1.5 and later (Magento 1.5, 1.6, 1.7, 1.8, 1.9). Sometime, you have a scenario when a configurable product and its associated simple … Read more

Magento 2: Get Attribute Id, Name, Value from Attribute Code

This article shows how you can get attribute name or label, id, entity_type, etc. by attribute code in Magento 2. If you would like get attribute name and value in Magento 1 then you may refer to this article: Magento: How to get attribute name and value? I will be showing both Dependency Injection (DI) … Read more

Magento 2: Get Payment Methods (All/Active/Used)

This article shows how to get payment methods in Magento 2. We will be fetching 3 types of payment methods. They are: 1) All Payment Methods 2) Active/Enabled Payment Methods 3) Payment Methods that have been used while placing orders I will be showing both ways (Dependency Injection & Object Manager way) to get payment … Read more

Magento: Get Payment Methods (All/Active/Used)

This article shows how to get payment methods in Magento 1. We will be fetching 3 types of payment methods. They are: 1) All Payment Methods 2) Active/Enabled Payment Methods 3) Payment Methods that have been used while placing orders To get all payment methods, we can either use Mage_Payment_Helper_Data or Mage_Payment_Model_Config class. To get … Read more

Magento: Get Customer Groups

This article shows how to get all customer groups name and id in Magento 1. To get all customer groups, we will be using Mage_Customer_Model_Resource_Group_Collection class. Here’s the code: $collection = Mage::getResourceModel('customer/group_collection'); $customerGroups = $collection->toOptionArray(); // adding a new element to the beginning of customerGroups array array_unshift($customerGroups, array('value'=>'', 'label'=>'Any')); Sample Output: print_r($customerGroups); Array ( [0] … 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