Force SSL redirection in cakephp

Step 1. use Security component.

 public $components = array('Security');

Step 2. use the below code to post data.

//Use the below code in parent controller's beforeFilter action
$this->Security->validatePost=false;
$this->Security->unlockedActions = array('action_1','action_2'); // unlock actions which you want to call in ajax without ssl 
$this->Security->blackHoleCallback = 'forceSSL'; //call forceSSL action to redirect http:// uri to https:// 
$this->Security->requireSecure();

// Defination of forceSSL function 
public function forceSSL() {
		if(json_decode($_SERVER['HTTP_CF_VISITOR'])->scheme=="http"){
			return $this->redirect('https://' . env('SERVER_NAME') . $this->here);
		}

	}
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  

Add existing project on Github by using commands

Simple steps to add existing project on github

//<strong>Step 1</strong> Initialize the local directory as a Git repository
$ git init

//<strong>Step 2</strong> Adds the files in the local repository and stage them for commit.
$ git add .
//to unstage a file use 'git reset HEAD YOUR-FILE'

//<strong>Step 3</strong> Commit the staged files of local repository.
$ git commit -m "First commit"

//<strong>Step 4</strong> Sets the new remote repository.
$ git remote add origin remote repository URL
//<strong>Step 4</strong> Verifies the new remote URL.
$ git remote -v

//<strong>Step 5</strong> Push the staged files of local repository in remote repository.
$ git push origin master
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  

How to get woocommerce page urls

Shop Url

$aUrl = get_permalink( woocommerce_get_page_id( 'shop' ) );

Cart Url

global $woocommerce;
$aUrl = $woocommerce->cart->get_cart_url();

Checkout Url

global $woocommerce;
$aUrl = $woocommerce->cart->get_checkout_url();

Account Url

$aAccountPageId = get_option( 'woocommerce_myaccount_page_id' );
$aUrl = get_permalink( $aAccountPageId );
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  

How to create wordpress theme woocommerce supportable

(1) Add following code in functions.php file

function your-theme-name_setup() {
   add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'your-theme-name_setup' );

(2)Create a folder “woocommerce” in your theme
(3)Copy template file from “wp-content\plugins\woocommerce\templates” and paste into “wp-content\themes\your-theme-name\woocommerce”

Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  
Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.