CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

09 March, 2022

Megento 2 menu to make module in one post

 Programing Coderfunda     March 09, 2022     Magento 2     No comments   

 

 

Magento 2

 

 

When you install the Magento 2 then visit 1st Dashboard

 

1st You will see this structure

 

This is landing page.

•      When you will be login admin panel then you visit Dashboard.

•      Then you will run these command then your project is running smoothly.

•       Go to Magento root directory run command.

php bin/magento cache:clean

php bin/magento cache:flush

  3. ENABLE MAGENTO 2 CACHE 

In order to Enable Cache, you need to follow these instructions: 

•     Go to System

•     Access Cache Management 

•     Enable the required cache types

 

After these steps visit next tab option “STORES”

Stores:

        This store has multiple option which is given below.

•        Setting

•        Currency

•        Inventory

•        Attributes

•        Taxes

 

1.Setting: you can set your site by one clicks like which country sell your product, location, store name, url, set base url, default pages, layouts, cookies setting, session validation, currency setup by api, contact, content management, google map api setting, default column grid, product fields auto generation, storefront, product review, product alerts run settings, product image placeholder, video, price, catalog search, search engine optimization, category top navigation, downloadable product option, date time customer option, security customer , sales yotpo ,account ,chart ,services etc.

Setting has main 4 categories.

        1.All Stores 2. Configuration 3. Term & Conditions

        4.Order Status

 

1.All Stores:  if you visit then you will see this dialog box.

       

 

           It is very simple if you want to add your website store different url then you can set your website here.

 

2. Configuration: This is very important part of Magento you can set your website here 60%. So it is very important and multiple tools are here so learn very carefully.

 

You can set your website frontend, seo, price, product listing many more.

We can understand very easily way. Simple steps, don’t take hyperness.

This is Configuration dialog box. You can see this pick.

 

We discuss all steps of configuration because it is very important.

You will see 9 tab in configuration image. We discuss step by step.

General:  General is a tab of configuration. You can understand by this pick.

 

 

       

General has 5 steps

          1.Country Options

          2.State Options

          3.Local Options

          4.Store Information

 

          5.Single-Store Mode

         

We explain all general steps.

•      Country Options: you can set you country according to your product. If you want to sell some country then you can set by country like, USA, India, UAE, Austria, New zee land, etc. if you want to sell all product word wide then you can select all country.

•       State Option: Like country option. You can select you state according to your need.

•       Local Option: you can set your local zone.

•       Store Information: you can save your store information like name, phone number, country, zip-code, address etc.

Don’t use last step because when you have multiple store then you will use.

 

 

Web has 9 steps

          1.Url Options

          2. Search Engine Optimization

          3.Base Urls

          4.Base Url Secure

          5.Default Page

          6.Default Layouts

          7.Default Cookies Setting

          8.Session Validation Settings

9.Browser Capabilities Detection

 

 

We explain all Web steps.

 

 

 

Q. When Category not show in frontend

php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

base url refresh after show the category.

         

 

 

 

Q. Theme Installation & Setup

1. Open xampp & open-shell then copy your theme only two file

    1. App -> root (folder-name)

    2. bin

Open shell and paste it

          php bin/magento setup:upgrade

          php bin/magento setup:static-content:deploy

          php bin/magento cache:clean

 

Q. After installation your css and js not working

 

Use this command then your css & js work…

php bin/magento setup:static-content:deploy -f

Q. The stock item was unable to be saved 

 

1st. you check your elastic search are running or not if not running then your product will not be save and no any updation.

 

 

Magento Add Store Information

 

 

How to create tax rule?

•        If you want to create tax then flow these rule

1. Tax Rate

2. Customer Tax Class

3. Product Tax Class

 

 

Tax rate : according to country or state tax %.

Customer Tax Class: According to Whole Seller or Retailer

Product Tax Class : According to Goods

 

Currency Setup , Rate and Simbols

 

Here two steps currency setup

1st.

Stores:

          Configuration

             ->General

                      ->Web

                                ->Currency page

 

 

2nd

        Stores :

->Currency rate

->Currency Simbol

 

You can set rate of currency for exp.

$USD  = 1   INR = 74  A$ = 1.4

 

If you has not any rate key or you have not buy any rate changer software like fix , yahoo etc.

Then you can change the rate according country,

Let’s start. You have 1 product Rs.300 and you want to sell in USA then how to fix the rate then you will use currency setup.

So like you can fix your rate according to country.

 

 

You can understand by image.

 

Here are two image 1st One dollar is equal to indian Rs. 75.27 and

2nd is $1 = Australian Dollar rate: 53.24

But our product amount is fix INR Rupees.

 

 

                                Or

 

Here you can easily understand $1 rate is Aud = INR = USD .

 

 

Product sell in india

 

 

Product sell in USA with out tax.

 

Product Sell in Australia with tax.

 

 

Here You can calculate by rate 74.8000

                A$ = 1.4

                $ = 1

 

I hope you should be learn very easily.

 

 

 

Setup and Configuration of Payment Method

 

 

Stores:

                Configuration

                   -> Sale

                                  -> Payment Method

                                                   ->Payment page

 

You can set here payment method and priority of which method will be show 1st .

Like : Amazone, Google pay, Razorpay, COD, etc.

 

 

 

Q. Setup and Configuration of Shipping Method

 

 

 

 

Q. Setup Multi Stores?

 

1.   1st We create a category Exmp. “Grocery”

2.  Then visit store menu and click All Stores

 

 

 

 

       

3.  After Open a page of Store

 

 

 

You will see three steps

1. Create Store View

2. Create store

3. Create Website

 

Then you will click create store

And make store according to your category “Grocery”

 

You can understand by this image.

 

After create you store then show this type of page

 

 

 

Then you will create “create store view “ page…

When you will click the button then open a page like this.. you can check image

 

 

 

Here you will select your root category 1st then fill according to your store…

You can check image …

 

 

Then visit store->Configuration

 

Open Configuration page

 

 

Then Go to general tab and click web tab it is very important.

 

 

You will see under url options NO then you should Yes. Here is completed your task.

Your multistore is created…

 

Run command

php bin/magento indexer:reindex

 

Then Open the frontend and reload then you will see in bottom check the images..

 

You will see the grocery in bottom menu.

 

 

 

 

 

 

Q. Change Multistore theme or Set Multi Store Theme

 

 

 

 

 

1.       Create Custom Theme in Magento 2

Theme Development Tutorial Step by Step

 

 

1st. you visit this path app/design/frontend/

 

Then you will create a folder ex. Training

Then you will create new folder “default” name under training with small word

Ex. Default or you can change folder name according to you.

Like this

app/design/frontend/Training/default

 

then you create a theme.xml file

 

So your app/design/frontend/mageplaza/theme.xml file should look something like this:

Then past this code in theme.xml file

 

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">

  <title>Training Default</title>

  <parent>Magento/luma</parent>

</theme>

 

 

 

Theme structure

Theme Folder structure

app/design/frontend/Training/
├── default/
│   ├── etc/
│   │   ├── view.xml
│   ├── web/
│   │   ├── images
│   │   │   ├── logo.svg
│   ├── registration.php
│   ├── theme.xml
│   ├── composer.json

 

<Vendor> is theme vendor. e.g: Training

<theme> is theme name. e.g: default

 

 

Then create registration.php file and paste this code.

 

 

 

<?php

/**

 * Copyright © Magento, Inc. All rights reserved.

 * See COPYING.txt for license details.

 */

 

use Magento\Framework\Component\ComponentRegistrar;

 

ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Training/default', __DIR__);

 

Run Command:

 

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy –f

 

Then check database Table Name “theme”

if your theme name is show means your theme is correctly install

 

Then visit magneto 2 home page and login your portal

 

Visit content->configuration then open a dialog box and click the default theme and change the theme

Thanks

 


Remove sample data modules

php bin/magento sampledata:remove

 

 

 

2.       Create Custom Theme in Magento 2

Theme Development Tutorial Step by Step

 

 

1st create a folder under app/design/frontend

Ex. Coderfunda

Then create next folder under Coderfunda you can choose name

Ex. funda

 

Create two file under funda

1.    registration.php

2.    theme.xml

 

 

Then past under registration file given code down …

 

<?php

/**

 * Copyright © Magento, Inc. All rights reserved.

 * See COPYING.txt for license details.

 */

 

use Magento\Framework\Component\ComponentRegistrar;

 

ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Coderfunda/simple', __DIR__);

 

 

Then past under theme.xml file given code down …

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">

   <title> Coderfunda VS Luma</title> <!-- your theme's name -->

   <parent>Magento/luma</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->

</theme>

 

 

Change the name according your folder name and note the small word or capson word

ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Training/default', __DIR__);

 

 

Training/default' change according to your project name means

Coderfunda is your Training name

Funda is default name

 

Then run this command

Php bin/magento setup:upgrade

 

In Admin panel (login fast and clear your cache;)

Then check your theme in content->config-> default theme and change the theme name

 

 

 

Two ways to override a template in Magento 2

 

override product list magento 2 tutorial

https://www.youtube.com/watch?v=VF3I7RiBVEM

 

 

 

https://www.rakeshjesadiya.com/how-to-override-template-phtml-files-in-magento-2/

 

        Module part -> like as blog

        Front->backend->db->show all setup.

 

Create New Module In Magento 2

 

 

Backend (Admin)

 

                Menu

                System Configuration

Grid (Listing/Add/Edit/Delete)

ACL (Access Control List)

Create Tables and Insert Sample News in Database

 

Frontend

                Add News Links in Footer

News Listing

News Details

Use Events and Observers

 

 

 

Code Structure of module Magento 2

            Block

            Controller

etc

            adminhtml

                        menu.xml

                        routes.xml

                        system.xml

            frontend

                        routes.xml   

ac.xml

            config.xml,

di.xml,

module.xml

events.xml

                Helper

i18n model

Setup

view

Plugin

composer.json

registration.php

 

 

           

Description of Module all steps

composer.json

            You can install module by composer and set another meta data.

registration.php

            This file register the module.

Block

            This is part of MVC. It’s Content view classes

Controller

            It’s content php controller. It’s part of mvc pattern

etc

All configuration file is here like as module.xml, menu.xml, system.xml, route.xml etc.

            These file describe here which is under etc folder.

etc/module.xml

            In this file under show module version or module name and any dependency.

etc/acl.xml

ACL file define the access control list for a given module. it defines available set of permission to access the resources.

etc/config.xml

            It’s system configuration

etc/di.xml

We write the dependency in this file.

etc/event.xml

   When we create observe class or we use observe class then use the event.xml file.

etc/adminhtml/menu.xml

            This XML file adds new menu items to the Magento admin panel.

etc/adminhtml/route.xml

What will be the front name of the module. The contents of this XML file tells Magento to route requests that use the front Name of this module.

 

etc/adminhtml/system.xml

This is a configuration file which is used to create configuration fields in 2 system configuration

 

            I18n

                        It’s containing localization file.

            Model

                        It’s containing php model classes as part of MVC.

Setup

                        You can crate table by this setup

            View

                        Design Template , email template and layout files.

Plugin

            You can change orginal class behavior by plugin.

It's contains plugin class. A class that modifies the behavior of original, public methods for any class or interface 

 

Helper

The helper class c ontains the methods. Methods can be called from any template file, block, model, controller class or even from another helper.

 

 

 

               

 

Basic Required files for Module

registration.php    

etc/module.xml

composer.json

 

Where is live Custom Modules? or

      Live Custom Modules or

      where live Modules file show

     

If you install module by composer then module goes to under root

"vendor/VendorName/ModuleName"

 

If you install module by manual then module goes to under

"app/code/VendorName/ModuleName"

 

 

 

We create news blog or news model

      Start Here step by step

 

1.       Create Admin Menu Item and Page View

 

               

 

We understand this image that we crate this menu in admin panel. These steps are given blow in down…|

When you want to create menu in admin panel then some directory structure here you flow only and after complete the steps then your menu will be created

1.      This is directory structure

App/code/StreamMkt/News   in this folder all file & folder will be create.

Vendor Name : StreamMkt

Module Name : News

 

 

 

 

1st steps:

       

1.       app/code/StreamMket/News

composer.json

registration.php

etc/module.xml

app/code/StreamMket/News

composer.json

{

  "name": "streammkt/news",

  "description": "A module that creates for news",

  "type": "magento2-module",

  "version": "1.0.0",

  "license": [

  "OSL-3.0",

  "AFL-3.0"

  ],

  "require": {

  "php": "~5.6.0|7.0.2|7.0.4|~7.0.6|~7.4.27"

  },

  "autoload": {

  "files": [ "registration.php" ],

  "psr-4": {

    "Rsgitech\\News\\": ""

  }

  }

}

 

 

This is very important, you can change according your vender or module name

Vender Name : streammkt  ||  you can change name like “Training”

Module Name : news  ||  you can change name like “test”

 

"name": "streammkt/news",

 

2nd Step

 

app/code/StreamMket/News

registration.php

 

Vender Name : StreamMkt  ||  Remember ! here vendor name according to “case sensitive word”

Module Name : News  || 

 

'StreamMkt_News'

<?php

\Magento\Framework\Component\ComponentRegistrar::register(

    \Magento\Framework\Component\ComponentRegistrar::MODULE,

    'StreamMkt_News',

    __DIR__

);

?>

 

 

3rd Step

app/code/StreamMket/News/etc

module.xml

 

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">

    <module name="StreamMkt_News" setup_version="1.0.0">

       

    </module>

</config>

4th Step

app/code/StreamMket/News/etc/adminhtml/

1.       menu.xml

2.       routes.xml

1.menu.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">

    <menu>

      <add id="StreamMkt_News::streammkt" title="StreamMkt" translate="title" module="StreamMkt_News" sortOrder="90" dependsOnModule="StreamMkt_News" resource="StreamMkt_News::streammkt"/>

 

      <add id="StreamMkt_News::news" title="News" translate="title" module="StreamMkt_News" parent="StreamMkt_News::streammkt" sortOrder="50" dependsOnModule="StreamMkt_News" resource="StreamMkt_News::news"/>

     

      <add id="StreamMkt_News::news_allnews" title="All News" translate="title" module="StreamMkt_News" parent="StreamMkt_News::news" sortOrder="10" dependsOnModule="StreamMkt_News" action="news/allnews" resource="StreamMkt_News::news_allnews"/>

    </menu>

</config>

Note: 1st  id="StreamMkt_News::streammkt"  here you can change streammkt change

Last : action="news/allnews : this is route url your file open here or index file auto load.

 

2.route.xml

 

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">

   <!--Use router 'standard' for frontend route-->

   <router id="admin">

        <!--Define a custom route with id and frontName-->

        <route frontName="news" id="news">

            <!--The module which this route match to-->

            <module name="StreamMkt_News"/>

        </route>

   </router>

</config>




 

 

 

 

5th Step

app/code/StreamMket/News/Controller/Adminhtml/AllNews

                index.php

This is action function. When Menu.xml file create and we give action name  

action="news/allnews" or action="news/allnews/index" both are same

 

 

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">

   <!--Use router 'standard' for frontend route-->

   <router id="admin">

        <!--Define a custom route with id and frontName-->

        <route frontName="news" id="news">

            <!--The module which this route match to-->

            <module name="StreamMkt_News"/>

        </route>

       <!-- <route id="customer">

           <module name="Mageplaza_HelloWorld" before="Magento_Customer" />

       </route> -->

   </router>

</config>




 

 

6th Step

app/code/StreamMket/News/view/adminhtml

                foder : 1st : layout or 2nd templates

 

 

app/code/StreamMket/News/view/adminhtml/layout

news_allnews_index.xml

 

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

    <head>

        <title>News</title>

    </head>

    <body>

        <referenceContainer name="content">

            <block class="Magento\Backend\Block\Template" template="StreamMkt_News::allnews.phtml"/>

        </referenceContainer>

    </body>

</page>

 

 

app/code/StreamMket/News/view/adminhtml/templates

allnews.phtml

 

<p> HELLO fR. tHIS IS MY 1ST MAGENTO NEWS BLOG</p>

 

 

Completed the menu module in admin

 

 

 

 

 

               

 

 

 

 

 

 

 

 

 

 

 

 

                               

 

 

  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook

Related Posts:

  • How to rewrite controller in Magento 2 How to rewrite controller in Magento 2To rewrite controller, you can do it by using preference. It mean that you need to put a rule in your … Read More
  • Magento 2 Create API with samples - Snippet Magento 2 Create API with samples - SnippetMagento 2 Create API means helping online retailers generate an Application Programming Interfac… Read More
  • Magento 2 Add Category Attributes Programmatically Magento 2 Add Category Attributes ProgrammaticallyDefault Magento 2 category attributes are good but sometimes it’s necessary to add new ones. T… Read More
  • Magento 2 Cache and Page Cache Overview Magento 2 Cache and Page Cache OverviewAlong with Magento\Cache library, Magento also uses Zend_Cache to interact with the c… Read More
  • Magento 2 Create Events - Observer in Magento 2 Magento 2 Create Events - Observer in Magento 2In this example we will should you How to create a event in Magento 2, we only catch the eve… Read More
Newer Post Older Post Home

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • Spring boot app (error: method getFirst()) failed to run at local machine, but can run on server
    The Spring boot app can run on the online server. Now, we want to replicate the same app at the local machine but the Spring boot jar file f...
  • Log activity in a Laravel app with Spatie/Laravel-Activitylog
      Requirements This package needs PHP 8.1+ and Laravel 9.0 or higher. The latest version of this package needs PHP 8.2+ and Laravel 8 or hig...
  • Vue3 :style backgroundImage not working with require
    I'm trying to migrate a Vue 2 project to Vue 3. In Vue 2 I used v-bind style as follow: In Vue 3 this doesn't work... I tried a...
  • Laravel auth login with phone or email
          <?php     Laravel auth login with phone or email     <? php     namespace App \ Http \ Controllers \ Auth ;         use ...
  • Enabling authentication in swagger
    I created a asp.net core empty project running on .net6. I am coming across an issue when I am trying to enable authentication in swagger. S...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

  • Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh - 9/21/2024
  • pyspark XPath Query Returns Lists Omitting Missing Values Instead of Including None - 9/20/2024
  • SQL REPL from within Python/Sqlalchemy/Psychopg2 - 9/20/2024
  • MySql Explain with Tobias Petry - 9/20/2024
  • How to combine information from different devices into one common abstract virtual disk? [closed] - 9/20/2024

Laravel News

  • Sublime Text Releases Update With Support for Right Sidebar - 5/22/2025
  • Enhance Email Validation with Laravel's Fluent Email Rule Object - 5/18/2025
  • Locale-aware Number Parsing in Laravel 12.15 - 5/21/2025
  • Handle Fluent Values as Arrays with Laravel's array() Method - 5/18/2025
  • Chargebee Starter Kit for Billing in Laravel - 5/20/2025

Copyright © 2025 CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda