Friday 20 March 2015

Calling Custom Field Filter function outside of a form in Joomla 3+

This can be bit daunting to call the Custom Field function outside of a form.
Please refere here to find how to Create a Custom Field function in Joomla.

//Get GenreTypes from Custom Field Class
JFormHelper::addFieldPath(JPATH_COMPONENT_ADMINISTRATOR . '/models/fields');
// works only if you set your field getOptions on public!!
$genre_types = JFormHelper::loadFieldType('myComponentGenreTypes', false);
$genre_types = $genre_types->getOptions()

The above method may not work sometimes, to resolve it, I have called a new helper function which pulled the same list (however we will have a function duplication which is not really ideal).
The help can be called as below but make sure that you have include the helper class path prior to call.

To include the helper class, add the below code on your com_mycomponent/mycomponent.php file.
// require helper files
JLoader::register('MyComponentHelper', dirname(__FILE__) . DS . 'helpers' . DS . 'mycomponent.php');

Then, call the helper function as following:
$genre_types = MyComponentHelper::getGenreTypes();

MySQL Upper Case, Lower Case, First Word Capital (similar to UCFirst())

The UCASE() Function 

The UCASE() function converts the value of a field to uppercase. 

MySQL UCASE() Syntax
SELECT UCASE(column_name) FROM table_name;
Syntax for SQL Server 
SELECT UPPER(column_name) FROM table_name;

The LCASE() Function

The LCASE() function converts the value of a field to lowercase.

MySQL LCASE() Syntax 
SELECT LCASE(column_name) FROM table_name;
Syntax for SQL Server 
SELECT LOWER(column_name) FROM table_name;

The First Letter Capital sntax (UCFirst() alternative):

The below script converts the selected column field value to First Letter Capital with rest to lower case.
MySQL Syntax 
SELECT CONCAT(LCASE(SUBSTRING(a_column_name, 1, 1)), 
LCASE(SUBSTRING(a_column_name, 2))) as a_column_name FROM table_name;
Syntax for SQL Server 
SELECT CONCAT(LCASE(SUBSTRING(a_column_name, 1, 1)), 
LCASE(SUBSTRING(a_column_name, 2))) as a_column_name FROM table_name;

Friday 6 March 2015

Integration of Global IRIS (HSBC) payment


Integration the Global IRIS (HSBC) payment system into your website can be kinda daunting, however following below steps may make your life easier.

In fact, I have recently went through the process and thought would be helpful if you looking to work on it as well.

1. First of ally, please ask to Global IRIS (GI) technical team to configure the Sandbox account and live account into their system with below detail. You can contact them via direct number +44 845 702 3344 (Option 6)* or email;

Developer documention can be found here, pdf here.., I have found the documentation is bit outdated, but please contact & confirm with them if necessary.

In fact, you have to ask them to provide below details (including login info) for both environment (sandbox and live) :
Modes Live Test
Action URL https://hpp.globaliris.com/pay https://hpp.sandbox.globaliris.com/pay
Merchant ID - -
Secret hash string: - secret
Account: internet internet
Below is the login detail to for HSBC reporting system
Reportin URL: https://reporting.globaliris.com/login https://reporting.sandbox.globaliris.com
Username: - -
Password: - -

Then, use create the request form page, response page and confirmation page.
For more detail, please refere here including documentation and codes @GitHub