Search

shamjascp

This WordPress.com site is the bee's knees

Month

April 2015

Laravel setting up multi language

step 1 : app/routes.php
create a route file in routes.php
Route::match(array(‘GET’,’POST’),’lang/{alias}’, ‘HomeController@multi_lang’);
step 2 : app/controller/HomeController.php
create a function in home controller named as multi_lang
public function multi_lang($lang){
/   /echo $lang;exit();
Session::put(‘my.locale’, $lang);
//return Redirect::to(‘/’);
return Redirect::back();//RETURN TO SAME DIRECTORY
}

step 3 : in base controller call this function in constructor as

$this->set_multi_language();

        public function set_multi_language(){
$lang = Session::get(‘lang’);
/ / echo $lang;exit();
if(empty($lang)){ $lang=’en’;}
Session::put(‘lang’, $lang);
App::setLocale($lang);
$this->data[‘lang’] = $lang;
// return Redirect::to(‘/’);
// echo $lang;
}
step 4 : app/start/global.php
App::setLocale(Session::get(‘my.locale’, Config::get(‘app.locale’))); or App::setLocale(Session::get(‘my.locale’));
step 5: in view page we need to write like
<a href=”<?php echo asset(‘lang/’.((Session::get(‘my.locale’)==’fr’)?’en’:’fr’)); ?>”><?php echo                                                    ((Session::get(‘my.locale’)==’fr’)?’english’:’français’);?></a>
step 6 :for fetching multi language variable
we need to create
app/lang
en
message.php
fr
message.php

for viewing variable {{ Lang::get(‘messages.join_us’); }} we need to call like this

Advertisements

Magento Remove My account links easy way

Step 1: Go to ( yourPackage/YourTemplate/customer/account/navigation.phtml )

eg:-    app/design/frontend/base/default/template/customer/account

Step 2: Replace the below line

<?php $count = count($links); ?>
        **With**
<?php $_count = count($_links); /* Add or Remove Account Left Navigation Links Here -*/
      unset($_links['account']); /* Account Info */     
      unset($_links['account_edit']); /* Account Info */            
      unset($_links['tags']); /* My Tags */
      unset($_links['invitations']); /* My Invitations */
      unset($_links['reviews']);  /* Reviews */
      unset($_links['wishlist']); /* Wishlist */
      unset($_links['newsletter']); /* Newsletter */
      unset($_links['orders']); /* My Orders */
      unset($_links['address_book']); /* Address */
      unset($_links['enterprise_customerbalance']); /* Store Credit */
      unset($_links['OAuth Customer Tokens']); /* My Applications */
      unset($_links['enterprise_reward']); /* Reward Points */
      unset($_links['giftregistry']); /* Gift Registry */
      unset($_links['downloadable_products']); /* My Downloadable Products */
      unset($_links['recurring_profiles']); /* Recurring Profiles */
      unset($_links['billing_agreements']); /* Billing Agreements */
      unset($_links['enterprise_giftcardaccount']); /* Gift Card Link */
?>
simply just add the above line and link will not show in the front end ie link is unsetting

The above code snippet contains the way to remove all the navigation links. Hope this will help all.

Reference Link: https://github.com/Aproducktion/Magento-Remove-Dashboard-Links

Create a free website or blog at WordPress.com.

Up ↑