Posts

Showing posts from June, 2019

Connect JSP with mysql

In this example we will show you how to connect to MySQL database from your JSP code. First, you need to create database and then write jsp code to connect jsp to database. 1. Create a database: First create a database named usermaster in mysql. Before running the jsp code you need to paste mySqlConnector.jar in lib directory of jdk. mysql> create database usermaster; (This query create database in my sql command prompt) 2. Connect JSP with mysql: Here is the jsp code. ConnectJspToMysql.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page import="java.sql.*" %> <%@ page import="java.io.*" %> <html> <head> <title>Connection with mysql database</title> </head> <body> <h1>Connection status </h1> <% try { /* Create string of connection url within specified format w

Custom offline payment module with custom validation on checkout page

In this blog session i am going to add an extra custom validation on checkout page which will verify user's email domain with the email domain you provided in store config. If both domain matches then only a success message shown and you can proceed with place order, other wise it will show error message and you are unable to  place order.                                                             This blog is related to my previous blog in which i had created an extra offline payment method on checkout page so please check it  here  . So, at that time we have already these files and folder structure * etc    * adminhtml       * system.xml    * config.xml    * module.xml    * payment.xml * Model    * CustomPayment.php * view     * frontend        * layout           * checkout_index_index.xml        * web           * js              * view                 * payment                    * method-rendered                       * custompayment-method.js      

Creating a new offline payment method module in magento 2

Image
As, we know that magento 2 supports a wide variety of payment method including-- Online payment Cash on delivery Paypal payment Solution Amazon pay Card payment Braintree payment solution Cheque and Money Order If you wish to add any other offline payment method along with these existing one then you are at right place. Store view      Today i am going to show you how to create module which enables us to choose  a custom offline payment method at checkout page in magento 2. Follow these steps in order to achieve this- 1. Create a new folder under app/code/ Excellence / OfflinePaymentMethods     Here Excellence is namespace and OfflinePaymentMethods is module name. 2. Create registration.php file under app/code/Excellence/OfflinePaymentMethods with following          content registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Excellence_OfflinePay

Adding twitter's Bootstrap library into magento 2 for responsive theme design

Since, magento2 doesn't include bootstrap library by default. Instead it has it's own library for responsive layout for all devices.                                                     Peoples like me who are familiar with bootstrap and used to use these library face difficulties while going to design theme without bootstarp. So, here i am going to link bootstrap library into magento 2 theme for responsive theme design.                                  Yes it is true that bootstrap made conflict with existing styling of magento 2, which should be over-rided on your own. You can add Bootstrap this way, follow below steps 1) Place your JS and CSS at below location /app/design/frontend/vendor-name/theme-name/web/css /app/design/frontend/vendor-name/theme-name/web/js 2) Call files in your  default_head_blocks.xml app/design/frontend/vendor-name/theme-name/Magento_Theme/layout/default_head_blocks.xml add these line of code <css src="css/bootstrap.css&qu