Pages

Monday, March 21, 2011

Joomla Password generation

Use the below code for generating joomla password.

        $new_password = "Your password";
       $salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($new_password, $salt);
        $password = $crypt.':'.$salt;

I hope it will help you.. 

Monday, March 7, 2011

Generate Moodle password

For generating a moodle password , first of all include the the configuration page then use the script given below
$password = “new password”;
$moodle_password = md5($password.$CFG->passwordsaltmain);
$password is the actual password and the passwordsaltmain is a hash key generated at moodle installation.

Avactis : Tax value is not displayed on checkout step 4

In avactis the 4th step of the checkout process that is
the landing page after payment the vat not displayed.
To solve this issue please, replace the following part of code:
default:
break;
}

foreach ($tax['TaxSubtotalAmountView'] as $taxView)
{
$this->_Tax_Item['Local_TaxName']=prepareHTMLDisplay($taxView['view']);

with this one:

default:
break;
}
$lastPlacedOrderID = modApiFunc('Checkout','getLastPlacedOrderID');
if ($lastPlacedOrderID !== NULL)
{
$oi = modApiFunc('Checkout', 'getOrderInfo', $lastPlacedOrderID,
modApiFunc('Localization',
'whichCurrencyToDisplayOrderIn',
$lastPlacedOrderID));
$tax['TaxSubtotalAmountView'] = array();
foreach($oi['Price']['tax_dops'] as $tax_info)
$tax['TaxSubtotalAmountView'][] = array(
'view' => preg_replace("/:$/", '', $tax_info["name"]),
'value' => $tax_info['value']
);
}
foreach ($tax['TaxSubtotalAmountView'] as $taxView)
{
$this->_Tax_Item['Local_TaxName']=prepareHTMLDisplay($taxView['view']);

in the"avactis-system/modules/checkout/views/checkout-order-cz.php" 
file.

Add new fields in joomla registration form

Let us add a custom field phone and mobile in registration form
libraries\joomla\database\table\user.php it’s the class file tor user table/user object
function __construct( &$db )
//add new field
var $phone = null;
var $mobile= null;
after that open
libraries\joomla\libraries\joomla\user\user.php
//add this code
var $phone = null;
var $mobile= null;
Add two fields in users table
ALTER TABLE jos_users ADD phone varchar(255) DEFAULT '' 
AFTER password;
ALTER TABLE jos_users ADD mobile varchar(255) DEFAULT '' 
AFTER phone;

Now go to Now go to administrator\components\com_users\views\
user\tmpl

<tr>
<td width="150">
<label for="phone">
 <?php echo JText::_( 'Phone' ); ?>
</label>
</td>
<td>
<input type="text" name="phone" id="phone" size="40"
 value="<?php echo $this->user->get('phone'); ?>" />
</td>
</tr>
<tr><td width="150">
<label for="mobile">
<?php echo JText::_( 'Mobile' ); ?>
</label>
</td>
<td>
<input type="text" name="mobile" id="mobile" size="40"
value="<?php echo $this->user->get('mobile'); ?>" />
</td>
</tr>
Also in components\com_user\views\register\tmpl
<tr>
<td height="40">
<label id="phonemsg" for="phone">
<?php echo JText::_( 'Phone' ); ?>:
</label>
</td>
<td>
<input type="text" name="phone" id="phone" size="40"
 value="<?php echo $this->escape($this->user->get( 'phone' ));?>" 
maxlength="50" /> *
</td>
</tr>
<tr>
<td height="40">
<label id="websitemsg" for="mobile">
<?php echo JText::_( 'Mobile' ); ?>:
</label>
</td>
<td>
<input type="text" name="mobile" id="mobile" size="40"
value="<?php echo $this->escape($this->user->get( 'mobile' ));?>" 
maxlength="50" /> *
</td>
</tr>