Social Icons

twitterfacebookgoogle pluslinkedinemail

Wednesday 12 June 2013

Validation BackEnd(Client Side) in Joomla


Using following code you can create a client side validation
<script>
  // our validation script
 function doValidate( f )
  {
  if(document.adminForm.task.value == 'gallarycat.cat_cancel')
  {
     return true;
  }
  if( document.formvalidator.isValid( f ) )
    {
                                alert('submit');
                    return true;
    }
    var form = document.adminForm;
    var validator = new myFormValidator();
    if( validator.isValid( form ) )
    {
                 alert("submit");
      submitform( pressbutton );
    }
    else
    {
      alert( 'Please correct any errors before submission.' );
    }

  }
</script>

Check user is login or not(Authentication) in joomla


you can check if user is login or not in joomla.
$user = JFactory::getUser();

if ($user->get('guest') == 1)
{
       echo “Not login”;
}
Else
{
   Echo “Loged user”;
}

use of session in joomla


use of session in joomla check following example

**********************
define session in joomla
**********************
$session = JFactory::getSession();

set session variable in joomla
---------------------------------
$session->set(‘name’,value); //set session

get session variable which set before in joomla
---------------------------------
$session->get(‘name’,value); // get session       

Hierarchy of Joomla component


You can see this example for Hierarchy of joomla component structure.
Example:
->com_gallary
                ->create Entry file same as component name like gallery.Php (Not optional)
                ->create Controller file like controller.php (Not optional)
                ->create models folder(optional if need model)(Create multiple models)
                                ->create model file  which name is same as controller name like gallery.php
                                   u can create multiple model in this folder with Controller name

Friday 7 June 2013

add yesno field in admin grid

this is way to add dropdown / select field in magento admin grid

file path : app\code\local\Module_Name\Company_Name\Block\Adminhtml\block_name\Grid.php


$yesnoOptions = array('0' => 'No','1' => 'Yes','' => 'No');

 $this->addColumn('is_vendor', array(
           'header'    => Mage::helper('customer')->__('Is Vendor'),
           'index'     => 'is_vendor',
'type'      => 'options',
'options'   => $yesnoOptions,
       ));

 

Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement