Tag Archives: web development tutorials

Datepicker in ionic Framework


Datepicker in ionic Framework : Datepicker is common plugin which is used mostly in many applications. You can use Datepicker in ionic by adding cordova-plugin-datepicker available at – https://github.com/VitaliiBlagodir/cordova-plugin-datepicker. We are going to explain the steps to add datepicker in ionic framework.


Installing plugin for Datepicker in ionic Framework

Here are steps to install the datepicker cordova-plugin-datepicker –

First Install Datepicker from Ionic CLI

Install Datepicker from Ionic CLI

cordova plugin add cordova-plugin-datepicker

Run the above command to install the plugin.

Create function to call datepicker –

Install Datepicker from Ionic CLI

 $scope.MyDatePicker = function($event) {
        var options = {
            date: new Date(),
            mode: 'date'
        };
        datePicker.show(options, function(date){
            if(date != 'Invalid Date') {
                console.log("Date came" + date);
            } else {
                console.log(date);
            }
        });
        $event.stopPropagation();  
    };

Magento Exclude Out Of Stock From Front Page


Magento Exclude Out Of Stock From Front Page: In you are working with magento you often need to exclude the out of stock products from front page. Many times we want to show the in stock items. It depends upon our need. Here we are going to explain the syntax and method to exclude the items from the front page that are out of stock.


Magento Exclude Out Of Stock From Front Page

Here is syntax to exclude out of stock products and show only in stock items.

Magento Exclude Out Of Stock From Front Page



getProductCollection()) && $products->getSize()){
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
}
?>

The above method will filter the in stock items and exclude the out of stock items.

Magento get quote details


Magento get quote details : Magento quote is basically an offer for user if it is accepted by user it converts to order. If you are working with magento quote you need various thing to work on such as quote items, quote total, shipping method etc. We are going to explain the quote details with example.


Magento get quote details

Here are details about the magento get quote details.

First of all let us get quote session. Here you have to option whether you want to get quote session on front or on magento admin. We will go through both in this tutorial.

Get magento Quote Session

If you are working with magento front end use the following method to get Quote Session.

Get magento Quote Session

$quote = Mage::getSingleton('checkout/session')->getQuote();

If you are working with magento admin Quote. Use the below method to get the quote session-

Get magento admin Quote Session

Get magento admin Quote Session

$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();

Once the quote is retrieved either from front end or admin we will access other attributes in the same way.

Magento get quote id

You can get Quote Id as below –

magento get quote id from session

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
// use Mage::getSingleton('adminhtml/session_quote') for admin quote
$quoteId = $quote->getId();

Magento Get Quote Items

You can get quote items on both frontend and backend as below-

Get magento Quote Session

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); //use for admin quote
$quoteItems = $quote->getAllVisibleItems();
foreach ($quoteItems as $item) {
    $productId = $item->getProductId(); 
    $productName = $item->getProductName();   
}

Get Payment Method From Magento Quote Session

You can get Payment Detail as below –

Get Payment Method From Magento Quote Session

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); // use this for admin quote
$quote = Mage::getModel('sales/quote')->load($quote->getQuoteId());
$paymentCode = $quote->getPayment()->getMethodInstance()->getCode();
$paymentTitle = $quote->getPayment()->getMethodInstance()->getTitle();

Get Shipping Method From Magento Quote Session

You can get Shipping Method as below –

Get Shipping Method From Magento Quote Session

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); // use this for admin quote
$shippingMethod = $quote->getShippingAddress()->getShippingMethod();

Magento Get Shipping And Billing Address Quote Session

You can get Shipping And Billing Address as below –

Magento Get Shipping And Billing Address Quote Session

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); // use this for admin quote
$shippingAddress = $quote->getShippingAddress();
$billingAddress = $quote->getBillingAddress();

Magento get quote shipping amount

You can get Shipping Amount as below –

Magento get quote shipping amount

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); // use this for admin quote
$shippingAmount = $quote->getShippingAddress()->getShippingAmount();

Magento get Quote Grand Total

You can get Grand Total as below –

Magento get Quote Grand Total

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); // use this for admin quote
$grandTotal = $quote->getGrandTotal();

Magento get Quote Tax

You can get Tax as below –

Magento get Quote Tax

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); // use this for admin quote
$tax = $quote->getShippingAddress()->getData('tax_amount');

Magento get Quote Discount Amount

Magento get Quote Discount Amount

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); // use this for admin quote
$totals =  $quote->getTotals();
$totalDiscount = $totals["discount"]->getValue();
Note : From $totals = $quote->getTotals(); you can also get ‘subtotal’, ‘shipping’, ‘tax’, ‘discount’ and ‘grand_total’ .

For ‘subtotal’, ‘shipping’, ‘tax’, ‘discount’ and ‘grand_total’ You can use following syntax to get the values –

$quote = Mage::getSingleton('checkout/session')->getQuote();
//$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote(); // use this for admin quote
$totals =  $quote->getTotals();
$totalDiscount = $totals["discount"]->getValue();
$tax = $totals["tax"]->getValue();
$subtotal = $totals["subtotal"]->getValue();
$shipping = $totals["shipping"]->getValue();
$grandTotal = $totals["grand_total"]->getValue();

Magento get current store information


Magento get current store information : If you are looking about the current store information in magento you can use $store = Mage::app()->getStore(); to get current store instance and details such as –

  • Store Id
  • Store Name
  • Store Code
  • Store Url
  • Store Status
  • Store Categories
  • Store Language
  • Store Currency Symbol
  • Store Country
  • Store Website Id
  • Store Group Id

Magento get current store information

Here We are going to show the store information listed above-

Magento get current store

Get Current Store :

 $store = Mage::app()->getStore();

Magento get current store Id

Get Current Store Id:

 $storeId = Mage::app()->getStore()->getStoreId();

Magento get current store Name

Get Current Store Name:

 $storeName = Mage::app()->getStore()->getName();

Magento get current store Code

Get Current Store Code:

 $storeCode = Mage::app()->getStore()->getCode();

Magento get current store Url

Get Current Store Code:

 $storeUrl = Mage::app()->getStore()->getHomeUrl();

Magento get current store Status

Get Current Store Status:

 $storeStatus = Mage::app()->getStore()->getIsActive();

Magento get current store Categories

You Can Use following method to get store categories – first get store id, get root category id then load category collection as below –

Get Current Store Categories:

            $storeId = Mage::app()->getStore()->getStoreId();


            $rootCategoryId = Mage::app()->getStore($storeId)->getRootCategoryId();


            $categoriesCollection = Mage::getModel('catalog/category')
                ->getCollection()
                ->setStoreId($storeId)
                ->addFieldToFilter('is_active', 1)
                ->addAttributeToFilter('path', array('like' => "1/{$rootCategoryId}/%"))
                ->addAttributeToSelect('*');
             foreach($categoriesCollection as $cat)
                {
                    $id = $cat->getId();                   
                    $name = $cat->getName();             
                }

Magento get current store Locale

Get Current Store Locale:

 $storeStatus = Mage::app()->getStore()->getLocaleCode();

Magento get current Currency code And Symbol

First get currency code then get corresponding symbol.

Get Current Store Currency Code And Symbol:

 $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
 $currencySymbol = Mage::app()->getLocale()->currency( $currencyCode )->getSymbol();

Magento get current Country Code

Get Current Country Code:

 $countryCode = Mage::getStoreConfig('general/country/default');

Magento get Current Store website Id

You can get website Id as below –

Get Current Store Website Id:

 $storeWebsiteId = Mage::app()->getStore()->getWebsiteId();

Magento get Current Store Group Id

You can get website Id as below –

Get Current Store Group Id:

 $storeGroupId = Mage::app()->getStore()->getGroupId();

Html Intro


Html Intro: Html stands for “Hypertext Markup Language” . Markup language is set of tags. Each html tags describes a different document in the page.


HTML Introduction

Lets understand the html base structure with the following example

Example





Heading

Paragraph.

Try it »

Codeigniter Load Model


Codeigniter load model : $this->load->model(‘Your_model_name’); is used to load models in Codeigniter.


Codeigniter Load Model Syntax

$this->load->model('Your_model_name');

Note if you are using subfolders in models. Example your model file is within the “application/models/users”
folder then in this case you need to load the models in this way :

$this->load->model('your_sub_foler_name/your_model_name');

For Example : load model users_model which is inside the users folder.

$this->load->model('users/users_model');
Codeigniter Load Model Example

Codeigniter Load Model Example

If you want to load model in library Read – http://tutorialsplane.com/codeigniter-load-model-in-library/

Codeigniter Load Model Example

1. Create Model :
place it in application/models folder

db->get('users',10);
     return $query->result_array();

  }

}
?>

2. Create Controller :
place it in application/controllers folder

Now Load model from and get data from users table.

load->model('My_first_model');
     // now call model method 
     $data['users'] = $this->My_first_model->getData();
     $this->load->view('MyUsers_view', $data);

  }

}
?>

3. Create view :
place it in application/views folder

Now We are going to print user data from users table.






0){
  foreach($users as $user){
  ?>

Now Access the url “http://localhost/MyUsers/users”

Demo»

Install laravel 5 on windows Xampp or Wamp


Install laravel 5 on windows Xampp or Wamp It is very simple to install laravel On windows Xampp. Here in this tutorial we are going to explain how you can install Laravel 5 on windows.


Steps to Install laravel 5 on windows Xampp or Wamp

You can install laravel 5 on windows by following the steps given below –

1. First you need to Download laravel 5 from https://github.com/laravel/laravel

2. After completion of download Unzip it in folder[xampp\htdocs\laravel or wampp\www\laravel] named as : laravel Which Will Look Like

Install laravel 5 on windows Xampp or Wamp
3.Now download Composer-Setup.exe from https://getcomposer.org/download/ And Install it.

4. After Successful installation of composer right click on laravel folder go to > Use Composer Here . When You click on it a terminal will be opened. Type the below command :

Command to Install Laravel 5.4

composer create-project --prefer-dist laravel/laravel test-laravel-5-project

Command to Install Laravel Lower Versio(< 5.4)

If you want to install lower version run the below command-

composer create-project laravel/laravel test-laravel-5-project –prefer-dist

Install-laravel-using-composer

5. Wait For a minute while your project is being installed……

6.After Successful installation you will see successful message at the end of terminal.

7. Now You can access your first project as :

http://localhost/laravel/test-laravel-5-project/public/
Which will look like with welcome page.
Install laravel 5 on windows Xampp or Wamp

How to import database using command line in MySQL

How to import database using command line in MySQL

Use the following command to import database using command line in MySQL :

mysql -u username -p password database_name < physical location of the file

Another very simple example :

mysql > Use database_name;

mysql> source C:\Users\mydatabase.sql(path of the file you want to import);

IdNameEmailPhone
No User Found.