Linux Usefull Command

Check the space

-> df -h

check the memory

->free -m,-l

Change permission

chmod 644 $(find folder -type f)

find /vendor -type f -name \*.php | xargs chmod 644


Git Command

Create from existing project

git remote add origin "url"

git push -u origin master


Fetch files  from repository

git pull origin master

Replace local files

git fetch -all

Add single file on git

git add 'filename'

git commit -m "Add testing file"

git push

LF will be replaced by CRLF Error while adding file.

git config --global core.autocrlf false

Add Discount Coupon in Magento One Page Checkout at review step

Step 1: Add following method on checkout controller

function couponAction() {

	$this->couponCode = (string) $this->getRequest()->getParam('coupon_code');
	$codeLength = strlen($this->couponCode );

	Mage::getSingleton('checkout/cart')->getQuote()->setCouponCode(strlen($this->couponCode) ?
	$this->couponCode : ' ')->collectTotals()->save();
	if ($codeLength) {
        if ( $this->couponCode == Mage::getSingleton('checkout/cart')->getQuote()->getCouponCode()) {
                $result['error'] = false;
	        $result['message']=$this->__('Coupon code "%s" was applied.', Mage::helper('core')->escapeHtml($this->couponCode));
	        } else {
	       // $result['error']=true;
	        $result['error_message']=$this->__('Coupon code "%s" is not valid.', Mage::helper('core')->escapeHtml($this->couponCode));
	    } else {
	    $result['message']=$this->__('Coupon code was canceled.');
	$result['goto_section'] = 'review';
	$result['update_section'] = array( 'name' => 'review', 'html' => $this->_getReviewHtml() );


Step 2: Add Js script to phtml file
Open file: app/design/frontend/base/default/template/checkout/onepage.phtml

function updateCoupon(reqid) {

var reqid;

if(reqid == 2) { $(‘coupon_code’).setValue(”); }


method: ‘post’,

onComplete: payment.onComplete,

onSuccess: payment.onSave,

onFailure: checkout.ajaxFailure.bind(checkout),




Step 3: Adding form to phtml file



$CouponCode = Mage::getSingleton(‘checkout/cart’)->getQuote()->getCouponCode(); ?>
<form id=”discount-coupon-form” action=”<?php echo Mage::getBaseUrl()?>/checkout/onepage/coupon/” method=”post”>
<label for=”coupon_code”> <?php echo $this->__(‘Enter your coupon code if you have one.’) ?></label><br />

<input id=”coupon_code” name=”coupon_code” value=”<?php echo $CouponCode; ?>”/>

<?php if(strlen($CouponCode)) { ?>

<button type=”button” onclick=”updateCoupon(2);” value=”<?php echo $this->__(‘Remove Coupon’)?>”><span><?php echo $this->__(‘Remove Coupon’) ?></span></button>

<?php } ?>

<button type=”button” onclick=”updateCoupon(1);” value=”<?php echo $this->__(‘Apply Coupon’)?>”><span><?php echo $this->__(‘Apply Coupon’) ?></span></button>


How to create plugin in wordpress?

To create plugin in wordpress follow below steps

Create folder with your plugin name. Create php file with your plugin name. Now put blank index.php file for folder security.

Write down plugin name in your plugin file as below.
Plugin Name: Your plugin name
Description: Your demo plugin
Author: Shailesh
Check your admin side and see plugin is listed on plugin page.

You need to avtivate the plugin.