Magento 2

Magento 2: When should I run setup:upgrade

Magento 2: When should I run setup:upgrade

  up vote down voteaccepted You only need to run setup:upgrade command 1. When you made changes in Setup script(InstallData, InstallSchema, UpgradeData, UpgradeSchema,...

Read more

fix error of css path including version

fix error of css path including version

Run if not exsting dev/static/sign in path column insert core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);  Otherwise open phpmyadmin search "dev/static/sign" in core_config_data change value to 0

Read more

Topcart doesn't update when changing, CartUpdate Mini Cart Magento2

Topcart doesn't update when changing, CartUpdate Mini Cart Magento2

Sometime you changed something in cart but it does not reflects in mini cart. It happens when you try to change and update cart items in you code programmatically.     Magento provides a way to update minicart if you are submitting a form. First of all create sections.xml file in ‘etc/frontend’...

Read more

Magento 2: How to add Configurable products to cart from category view with selected options

Magento 2: How to add Configurable products to cart from category view with selected options

you have to override your default list.phtml file with your module. replace your if else conditonal block, <?php if ($_product->isSaleable()): ?> <?php $postParams = $block->getAddToCartPostParams($_product); ?> <form data-role="tocart-form" action="<?php echo $this->getBaseUrl().'checkout/cart/add/product/'.$postParams['data']['product']//echo...

Read more

Convert from quote item to order item using fieldset

Convert from quote item to order item using fieldset

  There is custom field in quote_item table same as sales_order_item both column name and type are same.   I want to convert quote_item table to sales_order_item table. so I have used fieldset.xml to convert those data,   1) create etc/fieldset.xml file    <?xml version="1.0"?> <config...

Read more

How to Convert Custom Field From Quote Item to Order Item in Magento 2

How to Convert Custom Field From Quote Item to Order Item in Magento 2

Today, we will learn about the way to convert custom field from quote item to order item in Magento 2, through the below instructions. Overview of converting a custom feild from quote item to order item in Magento 2 Step 1: Add a di.xml file Step 2: Identify a code, a plugin Step 3: Add a class to your...

Read more

Add log magento 2

Add log magento 2

protected $logger; public function __construct(\Psr\Log\LoggerInterface $logger) {     $this->logger = $logger; } You use debug, exception, system for psr logger for example   $this->logger->info($message); $this->logger->debug($message);    OR   In magento2, You...

Read more

HOW TO FIX THE MOST COMMON ISSUES IN MAGENTO 2

HOW TO FIX THE MOST COMMON ISSUES IN MAGENTO 2

 The new version of Magento i.e. Magento 2 has come new challenges. When you are planning to upgrade your older versions to the new one, you may face some of these issues. In the current blog post, we will discuss the common issues in Magento 2 version and their solutions.   MOST COMMON MAGENTO 2 PROBLEMS AND...

Read more

How to add custom javascript in Magento 2 with requireJS

How to add custom javascript in Magento 2 with requireJS

Magento 2 brings some new features in javascript. One of them is “requireJS” (javascript file loader) and second is “jQuery“, a very popular js library. One of the biggest benefits is using requireJS which means that Magento 2 is ready for the upcoming HTTP2 protocol. In the next few steps we will explain how...

Read more

Different between Plugin and Observer in magento 2

Different between Plugin and Observer in magento 2

+ Plugins are omnipresent since it is possible to modify/replace behavior of any public method in the system. (before, After, Arround +  functionName)   +Observer is legacy of magento 1

Read more

What's the difference between a module and a component?

What's the difference between a module and a component?

What’s the difference between a module and a component?   A module is a type of component. A component can be:   A module (code that extends Magento behavior) A theme (changes the look and feel of your Magento Admin or storefront) Language package (used to translate text and messages in the Magento...

Read more

What is a Factory Design Pattern in PHP?

What is a Factory Design Pattern in PHP?

A factory creates an object. So, if you wanted to build    class A{     public $classb;     public $classc;     public function __construct($classb, $classc)     {          $this->classb = $classb;          $this->classc...

Read more

Error of the new module no existing

Error of the new module no existing

 Check if existing registration.php and make sure the file name is lowercase (all characters)

Read more

How to Change Order Buttons in Magento 2

How to Change Order Buttons in Magento 2

In the article I am going to answer how to add, remove and modify buttons on the Order view page in Magento 2   Order view page in the Magento administration panel allows you to perform certain actions for a specific Order. Sometimes these actions have to be adjusted based on Merchant's needs and business expectations....

Read more

Magento 2: How to add grid to the tab in customer_index_edit

Magento 2: How to add grid to the tab in customer_index_edit

Please follow below steps   admin layout xml app\code\Sugarcode\Test\view\adminhtml\layout\test_lists_edit.xml   <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">  ...

Read more

CREATE A GRID IN BACKEND ADMIN MAGENTO 2

CREATE A GRID IN BACKEND ADMIN MAGENTO 2

In magento 1x, it is so easy to create a grid show data in backend and magento 2 is so similar. Only with some part you can create a grid to show data from a table easily. However magento 2 gives you two ways to create a grid in backend. Today I will help you create a grid with simple way, so similar with magento...

Read more

Call helper from template magento 2

Call helper from template magento 2

$this->helper('[Vendor]\[Module]\Helper\[Helper Name]'); or    Roll your own factory: $objectManager = \Magento\Core\Model\ObjectManager::getInstance(); $helperFactory = $objectManager->get('\Magento\Core\Model\Factory\Helper'); $helper = $helperFactory->get('\PulseStorm\Commercebug\Helper\Data'); Or...

Read more

How to Create a Template Block in Magento 2

How to Create a Template Block in Magento 2

Block class and Layout XML   Magento 2 is now aware of our module, so let's create our block class. We'll do this by extending the \Magento\Framework\View\Element\Template class, and create a custom getName function:   Create a file Baz.php in new folder Foo/Bar/Block <?php namespace Foo\Bar\Block;   /** *...

Read more

Create a helper in a module in Magento 2

Create a helper in a module in Magento 2

Create: app/code/Company1/Module1/composer.json   {     "name": "company1/module-module1",     "description": "",     "require": {         "php": "~5.5.0|~5.6.0|~7.0.0",      ...

Read more

How to create Model and Collection in Magento 2

How to create Model and Collection in Magento 2

1. Insert some sample data on the custom database table Because we installed Tutorial_SimpleNews module via last post, we need to upgrade this module to insert the sample data. The directory structure in last post:   Step 1: Create the upgrade data file - Create file: app/code/Tutorial/SimpleNews/Setup/UpgradeData.php...

Read more

Magento 2.0 - List of all dispatched events

Magento 2.0 - List of all dispatched events

This ongoing updated post, lists all dispatched events in Magento 2.0. An event cheat sheet. Current version: 2.0.7 / May 19, 2016 For Magento 2.1 see here. This page lists three different groups of events occurring in: app and lib folders and global Varien JavaScript Events. Clicking on the file name brings you directly...

Read more

Install sample data in magento 2 by composer

Install sample data in magento 2 by composer

To install sample data using the command line, enter the following command as the Magento file system owner: 1) To install sample data using the command line   php <your Magento install dir>/bin/magento sampledata:deploy   Then enter username(Private Key) and password (Private key).   2) Complete...

Read more

Fixed: Invalid credentials for 'https://repo.magento.com/packages.json', aborting.

Fixed: Invalid credentials for 'https://repo.magento.com/packages.json', aborting.

You have to use a public / private keys pair, not email or screenname from your account in https://www.magentocommerce.com/products/downloads/token/ User name = Public Key Password = Private Key

Read more

How to reset admin password in Magento 2

How to reset admin password in Magento 2

You can create a new admin user able to change your forgotten password. Use the following command, to generate a new user:                 <path_to_magento>/bin/magento admin:user:create [--admin-user="..."] [--admin-password="..."] [--admin-email="..."]...

Read more

Error when upgrade to magento 2.1

Error when upgrade to magento 2.1

Problem 1     - magento/module-wishlist-sample-data 100.0.5 requires magento/module-wishlist 100.0.* -> satisfiable by magento/module-wishlist[100.0.5, 100.0.2, 100.0.3, 100.0.4].     - magento/module-wishlist-sample-data 100.0.2 requires magento/module-wishlist 100.0.* -> satisfiable by magento/module-wishlist[100.0.5,...

Read more

How to update magento with composer?

How to update magento with composer?

There are two way to upgrade magento2, choose one of them in following ways :   1) Only changes are inside composer.json file,   Replace "version": "2.0.2", to "version": "2.1.0", at line no.5 and Replace "magento/product-community-edition": "2.0.2",...

Read more

WorkFlow in Magento 2

WorkFlow in Magento 2

Initiation Phase in Magento 2 Index.php Bootstrap Bootstrap::run() App App:launch() Routing FrontController::dispatch() Router::match() Controller Processing Controller::execute() ...

Read more

How to use Model and Collection in Magento 2

How to use Model and Collection in Magento 2

You have to do follow lession first before continure Create a module with custom database table in Magento 2 In this post, we will go deeper into the usage of Module and Collection in Magento 2. After this post, you can insert some sample data on the custom database table and display them on frontend. Let’s start!   I...

Read more

MAGENTO 2 DATABASE STRUCTURE

MAGENTO 2 DATABASE STRUCTURE

    The difference of the database structure between Magento 2 and Magento 1.x.   Number of Table and Attribute     Module register table   In Magento 1.x, we all know that the module register table is core_resource. But this table can’t find in Magento 2, it was removed....

Read more

Create a module with custom database table in Magento 2

Create a module with custom database table in Magento 2

 Today, we will continue with our Magento 2 tutorial series. In this second blog post, I will introduce you how to create a module with custom database table in Magento 2. Let’s do it!   Hi guys, It is Nicolas Bui here and today, we will continue with our Magento 2 tutorial series. After the first...

Read more

HOW TO CREATE MENU IN MAGENTO 2 ADMIN

HOW TO CREATE MENU IN MAGENTO 2 ADMIN

magento-2-admin- menu My previous tutorial show you how to create a simple module in Magento 2, learn more here: http://www.venustheme.com/how-to-create-magento-2-module/. Today, we continue discuss about Magento 2 admin menu.   In Magento 1, menu configuration are located inside etc/adminhtml.xml but in Magento...

Read more

Magento plug-ins

Magento plug-ins

Magento2 gave very good concept called Plugin   we can do what ever after and before core function and also we have one more called around which will do both before and after below is code which will cover all info   Create a file di.xml in Mymodule/etc/di.xml   <?xml version="1.0"?> <!-- /**  *...

Read more

How to Override Core Block, Model and controller in Magento2

How to Override Core Block, Model and controller in Magento2

I follow below steps to override Block, Controller and Model I took Exmaple of Product Model and Product View Block and View Controller/Action   Create a file called di.xml in your /etc/di.xml   <?xml version="1.0"?> <!-- /**  * Copyright © 2015 Magento. All rights reserved.  *...

Read more

HOW TO CREATE A SIMPLE MODULE IN MAGENTO 2

HOW TO CREATE A SIMPLE MODULE IN MAGENTO 2

As you may know, we have just released Magento 2 Brand module a few days ago. This is our first module upgraded from Magento 1.9.x to Magento 2. You can find more detail, features of Brand Magento2: http://www.venustheme.com/theme/ves-brand-2-0/. Today, we will guide you how to create a simple magento 2 module step by step....

Read more

Hướng dẫn cài đặt extension cho Magento 2 bằng Composer

Hướng dẫn cài đặt extension cho Magento 2 bằng Composer

  Hiện giờ chỉ có 2 thư viện Composer giúp bạn cài đặt extension đó là: Magento 2 Composer Repository (Thư viện chính thức của Magento) Packagist  (Thư viện chính thức của Composer) Để thêm thư viện vào Composer, sử dụng câu...

Read more

Sử dụng Magento 2 CLI để quản trị trang web Magento

Sử dụng Magento 2 CLI để quản trị trang web Magento

Magento 2 vừa mới ra mắt mang theo một công cụ rất hay đó là Magento 2 CLI, ưu việt hơn Magento 1 CLI như dễ dùng hơn và nhiều chức năng hơn. Bạn nào chưa biết Magento CLI là gì thì đây là công cụ quản lý trang web chạy Magento của bạn thông qua dòng lệnh được...

Read more

Magento 2 installation: PHP Fatal error Allowed memory size exhausted

Magento 2 installation: PHP Fatal error Allowed memory size exhausted

A frequent problem during Magento 2 installation (using php bin/magento setup:install ) is a site running out of memory and generating an error like this – “PHP Fatal error: Allowed memory size of NNN bytes exhausted”. This fatal error means that your hosting or local machine is not able to provide enough...

Read more