Magento: Configuring Orbital Chase Paymentech Gateway

May 23, 2009 15:52 by Rafeek

Magento Commerce, is a direct response to the emerging new needs of today's online merchants. More than any feature or functionality what our clients really needs is "flexibility" is done through the magento.

We have a lot of payment gateways today to integrate with our e-commerce application. Here we see how to integrate one of the leading Gateway providers CHASE Payment Tech Gateway with Magento Commerce.

 

1. Creating CHASE Payment Module

The CHASE Payment Module is included as Magento Commerce Extension, by using Magento Module Creator. Using Module Creator the Payment Module template for both Administrator and Client Section will get added.

Magento Module Creator Orbital Chase Paymentech Gateway

The module will get created and integrated into our existing magento site by specifying the parameters properly as mentioned above. The parameters are Name Space, Module, Magento Root Directory, Design Interface and Design.

 

1.1 Installing Module Creator

In order to download, visit Module Creator page in Magento Wiki.

After dowloading, to install the Module Creator, copy the index.php file into a Blank folder on your webserver. You have to put it in it’s own folder so that the index file does not conflict with other index files. Example: mysite.com/module_creator/

Open the module creator index page in your web browser, and fill in the desired module information. If you enter your Magento directory, the module creator will attempt to install the module directly into Magento, so file permissions must be set correctly for this to happen. If your file permissions are incorrect, or you do not want the module installed right away, you can leave the Magento Directory blank, and the module creator will create the module in a folder called 'new', and place it under module creator’s folder.

Please note that if you enter in your magento directory to install to you must have the correct path. Let’s say that you have Magento installed here:
http://www.my_site.com/magento/
And you have the Module Creator installed here:
http://www.my_site.com/module_creator/
This means that the path that you would need to enter in the Module Creator is this:
../magento
The ‘..’ signifies one directory up.

The new payment gateway gets installed in the /App/Core/Code/local folder with default folder right permission without disturbing the existing payment gateways. 

For more information on Module Creator visit,
http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

Note:
Once the new payment module installed properly, go to the /var/cache folder and delete all the files inside the folder and then run the application, now the new changes get reflected.

 

2. CHASE Module in Administrator Section

Now we will add the Chase Paymentech Module to the administration section, so that we can update the Merchant ID, Terminal ID and Gateway URL as seen in the below screen.

The fields configured in administration section can be customized in the system.xml file located at the /App/Core/Code/Local/Mage/newmodule/etc folder.

Magento Orbital Chase Paymentech Configuration

 

3. CHASE Module in Client Section

After the payment module is integrated in the Magento application using the Module Creator, the Orbtiz Chase Module on the Client Section will look like in the below screen.

Client section Payment Information fields can be modified directly at, App/design/frontend/default/example-module/template/payment/form/cc.phtml

 

4. Payment Processing with CHASE

Once the Chase module payment process is integrated in the client section, the paymentmethod.php will do the backend process like checking the card details by sending to the Chase Paymentech and return the response from the Chase.

The paymentmethod.php is located in the new module created by Module Creator, at /app/local/CHASE_Paymentech/Orbitz/Model/PaymentMethod.php,

You can download the code from the below link.

PaymentMethod.zip (2.95 kb)

The PHP code will explain you the process of reading the card information from the payment page and post it to the Chase using the payment gateway and receive the response back from the Chase.

 

4.1. Specifing the Payment Gateway URL

In the code we are using CURL to receive payment gateway response so we need to enable the extension=php_curl.dll in php.ini. Update the php.ini as per the requirement and restart the server.

Payment Gateway URL for Production –
'https://orbital1.paymentech.net'
'https://orbital2.paymentech.net'
 
Payment Gateway URL for Test –
'https://orbitalvar2.paymentech.net/authorize'

$value = Mage::getStoreConfig('payment/ Orbitz_Paymentech/cgi_url');
if (!$value || $value === false) {
  return 'https://orbital1.paymentech.net';
}
return $value;

The Authorize and Capture event is done on the each order process. The Credit Card is get processed the specified amount sent as XML Request. The xml request was constructed as below,

$xml="";
$xml .= "";
$xml .= "";
$xml .= "EC";
$xml .= "AC";
$xml .= "".htmlentities(trim($this->getConfigData('bin_no')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($this->getConfigData('merchant_id')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($this->getConfigData('terminal_id')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($payment->getCcType()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($payment->getCcNumber()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($exp),ENT_QUOTES, 'UTF-8')."";
if(($payment->getCcType()=='VI') || ($payment->getCcType()=='DI')) {
  $xml .= "1";
}
$xml .= "".htmlentities(trim($payment->getCcCid()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getPostcode()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getStreet(1)),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getCity()),ENT_QUOTES, 'UTF-8')."";
$xml .= "CA";
$xml .= "".htmlentities(trim($billing->getFirstname()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($order->getIncrementId()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($amt),ENT_QUOTES, 'UTF-8')."";
$xml .= "AC";
$xml .= "";
$xml .= "";
$xml .= "";

The request is sent as CURL post to Chase is as follows,

$http = new Varien_Http_Adapter_Curl();
$config = array('timeout' => 30);
$http->setConfig($config);

$header= "POST /AUTHORIZE HTTP/1.0\r\n"; // HTTP/1.1 should work fine also
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-type: application/PTI40\r\n";
$header.= "Content-length: " .strlen($xml) . "\r\n";
$header.= "Content-transfer-encoding: text\r\n";
$header.= "Request-number: 1\r\n";
$header.= "Document-type: Request\r\n";
$header.= "Interface-Version: Test 1.4\r\n";
$header.= "Connection: close \r\n\r\n";
$header.= $xml;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->getApiGatewayUrl());
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

The Chase response will get parsed from xml to array format and validate the response by each parameter as per the Chase Certification_WS document.

Chase will request you the code to scrutinize before approval. They will look through the parameters that you are sending in the Request, and how you are parsing their Response & its error codes.

 


Magento: Configuring Orbital Chase Paymentech Gateway

May 23, 2009 09:52 by admin

Magento Commerce, is a direct response to the emerging new needs of today's online merchants. More than any feature or functionality what our clients really needs is "flexibility" is done through the magento.

We have a lot of payment gateways today to integrate with our e-commerce application. Here we see how to integrate one of the leading Gateway providers CHASE Payment Tech Gateway with Magento Commerce.

 

1. Creating CHASE Payment Module

The CHASE Payment Module is included as Magento Commerce Extension, by using Magento Module Creator. Using Module Creator the Payment Module template for both Administrator and Client Section will get added.

Magento Module Creator Orbital Chase Paymentech Gateway

The module will get created and integrated into our existing magento site by specifying the parameters properly as mentioned above. The parameters are Name Space, Module, Magento Root Directory, Design Interface and Design.

 

1.1 Installing Module Creator

In order to download, visit Module Creator page in Magento Wiki.

After dowloading, to install the Module Creator, copy the index.php file into a Blank folder on your webserver. You have to put it in it’s own folder so that the index file does not conflict with other index files. Example: mysite.com/module_creator/

Open the module creator index page in your web browser, and fill in the desired module information. If you enter your Magento directory, the module creator will attempt to install the module directly into Magento, so file permissions must be set correctly for this to happen. If your file permissions are incorrect, or you do not want the module installed right away, you can leave the Magento Directory blank, and the module creator will create the module in a folder called 'new', and place it under module creator’s folder.

Please note that if you enter in your magento directory to install to you must have the correct path. Let’s say that you have Magento installed here:
http://www.my_site.com/magento/
And you have the Module Creator installed here:
http://www.my_site.com/module_creator/
This means that the path that you would need to enter in the Module Creator is this:
../magento
The ‘..’ signifies one directory up.

The new payment gateway gets installed in the /App/Core/Code/local folder with default folder right permission without disturbing the existing payment gateways. 

For more information on Module Creator visit,
http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

Note:
Once the new payment module installed properly, go to the /var/cache folder and delete all the files inside the folder and then run the application, now the new changes get reflected.

 

2. CHASE Module in Administrator Section

Now we will add the Chase Paymentech Module to the administration section, so that we can update the Merchant ID, Terminal ID and Gateway URL as seen in the below screen.

The fields configured in administration section can be customized in the system.xml file located at the /App/Core/Code/Local/Mage/newmodule/etc folder.

Magento Orbital Chase Paymentech Configuration

 

3. CHASE Module in Client Section

After the payment module is integrated in the Magento application using the Module Creator, the Orbtiz Chase Module on the Client Section will look like in the below screen.

Client section Payment Information fields can be modified directly at, App/design/frontend/default/example-module/template/payment/form/cc.phtml

 

4. Payment Processing with CHASE

Once the Chase module payment process is integrated in the client section, the paymentmethod.php will do the backend process like checking the card details by sending to the Chase Paymentech and return the response from the Chase.

The paymentmethod.php is located in the new module created by Module Creator, at /app/local/CHASE_Paymentech/Orbitz/Model/PaymentMethod.php,

You can download the code from the below link.

PaymentMethod.zip (2.95 kb)

The PHP code will explain you the process of reading the card information from the payment page and post it to the Chase using the payment gateway and receive the response back from the Chase.

 

4.1. Specifing the Payment Gateway URL

In the code we are using CURL to receive payment gateway response so we need to enable the extension=php_curl.dll in php.ini. Update the php.ini as per the requirement and restart the server.

Payment Gateway URL for Production –
'https://orbital1.paymentech.net'
'https://orbital2.paymentech.net'
 
Payment Gateway URL for Test –
'https://orbitalvar2.paymentech.net/authorize'

$value = Mage::getStoreConfig('payment/ Orbitz_Paymentech/cgi_url');
if (!$value || $value === false) {
  return 'https://orbital1.paymentech.net';
}
return $value;

The Authorize and Capture event is done on the each order process. The Credit Card is get processed the specified amount sent as XML Request. The xml request was constructed as below,

$xml="";
$xml .= "";
$xml .= "";
$xml .= "EC";
$xml .= "AC";
$xml .= "".htmlentities(trim($this->getConfigData('bin_no')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($this->getConfigData('merchant_id')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($this->getConfigData('terminal_id')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($payment->getCcType()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($payment->getCcNumber()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($exp),ENT_QUOTES, 'UTF-8')."";
if(($payment->getCcType()=='VI') || ($payment->getCcType()=='DI')) {
  $xml .= "1";
}
$xml .= "".htmlentities(trim($payment->getCcCid()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getPostcode()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getStreet(1)),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getCity()),ENT_QUOTES, 'UTF-8')."";
$xml .= "CA";
$xml .= "".htmlentities(trim($billing->getFirstname()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($order->getIncrementId()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($amt),ENT_QUOTES, 'UTF-8')."";
$xml .= "AC";
$xml .= "";
$xml .= "";
$xml .= "";

The request is sent as CURL post to Chase is as follows,

$http = new Varien_Http_Adapter_Curl();
$config = array('timeout' => 30);
$http->setConfig($config);

$header= "POST /AUTHORIZE HTTP/1.0\r\n"; // HTTP/1.1 should work fine also
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-type: application/PTI40\r\n";
$header.= "Content-length: " .strlen($xml) . "\r\n";
$header.= "Content-transfer-encoding: text\r\n";
$header.= "Request-number: 1\r\n";
$header.= "Document-type: Request\r\n";
$header.= "Interface-Version: Test 1.4\r\n";
$header.= "Connection: close \r\n\r\n";
$header.= $xml;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->getApiGatewayUrl());
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

The Chase response will get parsed from xml to array format and validate the response by each parameter as per the Chase Certification_WS document.

Chase will request you the code to scrutinize before approval. They will look through the parameters that you are sending in the Request, and how you are parsing their Response & its error codes.

 


Magento: Configuring Orbital Chase Paymentech Gateway

May 23, 2009 09:52 by admin

Magento Commerce, is a direct response to the emerging new needs of today's online merchants. More than any feature or functionality what our clients really needs is "flexibility" is done through the magento.

We have a lot of payment gateways today to integrate with our e-commerce application. Here we see how to integrate one of the leading Gateway providers CHASE Payment Tech Gateway with Magento Commerce.

 

1. Creating CHASE Payment Module

The CHASE Payment Module is included as Magento Commerce Extension, by using Magento Module Creator. Using Module Creator the Payment Module template for both Administrator and Client Section will get added.

Magento Module Creator Orbital Chase Paymentech Gateway

The module will get created and integrated into our existing magento site by specifying the parameters properly as mentioned above. The parameters are Name Space, Module, Magento Root Directory, Design Interface and Design.

 

1.1 Installing Module Creator

In order to download, visit Module Creator page in Magento Wiki.

After dowloading, to install the Module Creator, copy the index.php file into a Blank folder on your webserver. You have to put it in it’s own folder so that the index file does not conflict with other index files. Example: mysite.com/module_creator/

Open the module creator index page in your web browser, and fill in the desired module information. If you enter your Magento directory, the module creator will attempt to install the module directly into Magento, so file permissions must be set correctly for this to happen. If your file permissions are incorrect, or you do not want the module installed right away, you can leave the Magento Directory blank, and the module creator will create the module in a folder called 'new', and place it under module creator’s folder.

Please note that if you enter in your magento directory to install to you must have the correct path. Let’s say that you have Magento installed here:
http://www.my_site.com/magento/
And you have the Module Creator installed here:
http://www.my_site.com/module_creator/
This means that the path that you would need to enter in the Module Creator is this:
../magento
The ‘..’ signifies one directory up.

The new payment gateway gets installed in the /App/Core/Code/local folder with default folder right permission without disturbing the existing payment gateways. 

For more information on Module Creator visit,
http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

Note:
Once the new payment module installed properly, go to the /var/cache folder and delete all the files inside the folder and then run the application, now the new changes get reflected.

 

2. CHASE Module in Administrator Section

Now we will add the Chase Paymentech Module to the administration section, so that we can update the Merchant ID, Terminal ID and Gateway URL as seen in the below screen.

The fields configured in administration section can be customized in the system.xml file located at the /App/Core/Code/Local/Mage/newmodule/etc folder.

Magento Orbital Chase Paymentech Configuration

 

3. CHASE Module in Client Section

After the payment module is integrated in the Magento application using the Module Creator, the Orbtiz Chase Module on the Client Section will look like in the below screen.

Client section Payment Information fields can be modified directly at, App/design/frontend/default/example-module/template/payment/form/cc.phtml

 

4. Payment Processing with CHASE

Once the Chase module payment process is integrated in the client section, the paymentmethod.php will do the backend process like checking the card details by sending to the Chase Paymentech and return the response from the Chase.

The paymentmethod.php is located in the new module created by Module Creator, at /app/local/CHASE_Paymentech/Orbitz/Model/PaymentMethod.php,

You can download the code from the below link.

PaymentMethod.zip (2.95 kb)

The PHP code will explain you the process of reading the card information from the payment page and post it to the Chase using the payment gateway and receive the response back from the Chase.

 

4.1. Specifing the Payment Gateway URL

In the code we are using CURL to receive payment gateway response so we need to enable the extension=php_curl.dll in php.ini. Update the php.ini as per the requirement and restart the server.

Payment Gateway URL for Production –
'https://orbital1.paymentech.net'
'https://orbital2.paymentech.net'
 
Payment Gateway URL for Test –
'https://orbitalvar2.paymentech.net/authorize'

$value = Mage::getStoreConfig('payment/ Orbitz_Paymentech/cgi_url');
if (!$value || $value === false) {
  return 'https://orbital1.paymentech.net';
}
return $value;

The Authorize and Capture event is done on the each order process. The Credit Card is get processed the specified amount sent as XML Request. The xml request was constructed as below,

$xml="";
$xml .= "";
$xml .= "";
$xml .= "EC";
$xml .= "AC";
$xml .= "".htmlentities(trim($this->getConfigData('bin_no')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($this->getConfigData('merchant_id')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($this->getConfigData('terminal_id')),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($payment->getCcType()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($payment->getCcNumber()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($exp),ENT_QUOTES, 'UTF-8')."";
if(($payment->getCcType()=='VI') || ($payment->getCcType()=='DI')) {
  $xml .= "1";
}
$xml .= "".htmlentities(trim($payment->getCcCid()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getPostcode()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getStreet(1)),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($billing->getCity()),ENT_QUOTES, 'UTF-8')."";
$xml .= "CA";
$xml .= "".htmlentities(trim($billing->getFirstname()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($order->getIncrementId()),ENT_QUOTES, 'UTF-8')."";
$xml .= "".htmlentities(trim($amt),ENT_QUOTES, 'UTF-8')."";
$xml .= "AC";
$xml .= "";
$xml .= "";
$xml .= "";

The request is sent as CURL post to Chase is as follows,

$http = new Varien_Http_Adapter_Curl();
$config = array('timeout' => 30);
$http->setConfig($config);

$header= "POST /AUTHORIZE HTTP/1.0\r\n"; // HTTP/1.1 should work fine also
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-type: application/PTI40\r\n";
$header.= "Content-length: " .strlen($xml) . "\r\n";
$header.= "Content-transfer-encoding: text\r\n";
$header.= "Request-number: 1\r\n";
$header.= "Document-type: Request\r\n";
$header.= "Interface-Version: Test 1.4\r\n";
$header.= "Connection: close \r\n\r\n";
$header.= $xml;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->getApiGatewayUrl());
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

The Chase response will get parsed from xml to array format and validate the response by each parameter as per the Chase Certification_WS document.

Chase will request you the code to scrutinize before approval. They will look through the parameters that you are sending in the Request, and how you are parsing their Response & its error codes.

 


Knowing which PORT is using by which APPLICATION

April 20, 2009 07:49 by Ramana

Recently for a client need to install our SilverLight application on his laptop for demo over GotoMeeting. The laptop is having Vista 64 bit Windows OS. After installing IIS 7 on it, the webserver's Default Website was not starting. So checked everything - Services, Installed Apps in Programs & Features etc, to see whether Apache or Tomcat or any other webserver is running and blocking 80 port. But couldn't see any of those applications.

Then started hunting to know who is blocking 80 port on that machine. Did little googling and found following 2 commands to know which app is listening to the 80 port.

Through these commands you can know easily which application is listening to a particular port. As well you can see all ports that are exposed and applications that are using them. This is a 2 step process. First we will see ,what are the ports that are listening by different Process Ids. Next using that PID we will get the Application name.

To know the listening ports on your machine type the following command in CMD prompt

netstat -ano | find /i "listening"

Fist column will show you the protocol TCP or UDP, next IP & PORT numbers of Source, next IP & PORT numbers of Destination machine, next State (that we needed to filter the list), and finally the Process Id (PID).

From the last column we will take the Process Id and find the Application of it.

So for that lets Google and download a small application named PUList. The Windows 2000 Resource Kit Tool needs you to go through Genuine OS check, and then you can download the PULIST.EXE. After downloading & installing PUList, navigate to the installed directory in CMD prompt. Run the following command in there,

pulist |find /I "6372"

or just

pulist 

will list all the processes that are running.

Finally we found that Skype is using the port 80. So after exiting it the IIS Default website started working. 


Knowing which PORT is using by which APPLICATION

April 20, 2009 01:49 by admin

Recently for a client need to install our SilverLight application on his laptop for demo over GotoMeeting. The laptop is having Vista 64 bit Windows OS. After installing IIS 7 on it, the webserver's Default Website was not starting. So checked everything - Services, Installed Apps in Programs & Features etc, to see whether Apache or Tomcat or any other webserver is running and blocking 80 port. But couldn't see any of those applications.

Then started hunting to know who is blocking 80 port on that machine. Did little googling and found following 2 commands to know which app is listening to the 80 port.

Through these commands you can know easily which application is listening to a particular port. As well you can see all ports that are exposed and applications that are using them. This is a 2 step process. First we will see ,what are the ports that are listening by different Process Ids. Next using that PID we will get the Application name.

To know the listening ports on your machine type the following command in CMD prompt

netstat -ano | find /i "listening"

Fist column will show you the protocol TCP or UDP, next IP & PORT numbers of Source, next IP & PORT numbers of Destination machine, next State (that we needed to filter the list), and finally the Process Id (PID).

From the last column we will take the Process Id and find the Application of it.

So for that lets Google and download a small application named PUList. The Windows 2000 Resource Kit Tool needs you to go through Genuine OS check, and then you can download the PULIST.EXE. After downloading & installing PUList, navigate to the installed directory in CMD prompt. Run the following command in there,

pulist |find /I "6372"

or just

pulist 

will list all the processes that are running.

Finally we found that Skype is using the port 80. So after exiting it the IIS Default website started working. 


Knowing which PORT is using by which APPLICATION

April 20, 2009 01:49 by admin

Recently for a client need to install our SilverLight application on his laptop for demo over GotoMeeting. The laptop is having Vista 64 bit Windows OS. After installing IIS 7 on it, the webserver's Default Website was not starting. So checked everything - Services, Installed Apps in Programs & Features etc, to see whether Apache or Tomcat or any other webserver is running and blocking 80 port. But couldn't see any of those applications.

Then started hunting to know who is blocking 80 port on that machine. Did little googling and found following 2 commands to know which app is listening to the 80 port.

Through these commands you can know easily which application is listening to a particular port. As well you can see all ports that are exposed and applications that are using them. This is a 2 step process. First we will see ,what are the ports that are listening by different Process Ids. Next using that PID we will get the Application name.

To know the listening ports on your machine type the following command in CMD prompt

netstat -ano | find /i "listening"

Fist column will show you the protocol TCP or UDP, next IP & PORT numbers of Source, next IP & PORT numbers of Destination machine, next State (that we needed to filter the list), and finally the Process Id (PID).

From the last column we will take the Process Id and find the Application of it.

So for that lets Google and download a small application named PUList. The Windows 2000 Resource Kit Tool needs you to go through Genuine OS check, and then you can download the PULIST.EXE. After downloading & installing PUList, navigate to the installed directory in CMD prompt. Run the following command in there,

pulist |find /I "6372"

or just

pulist 

will list all the processes that are running.

Finally we found that Skype is using the port 80. So after exiting it the IIS Default website started working. 


Magento Menu Customization with Product List

February 3, 2009 06:02 by Rafeek

Magento main menu is construed based on the hierarchy like,

 Root Category → Category → Sub-Category

We will customise the menu to show the Products of a category/su-bcategory along with its hierarchy in dropdown menu as seen below.

    

This is a good feature if you have less products in a website.

In order to implement the above structure, we need to modify the navigation.php file of drawItem() function like below. The navigation.php is available in the following location,

app/code/core/Mage/Catalog/Block/Navigation.php

The code is,

Public function drawItem($category, $level=0, $last=false){
 $html = '';
 if (!$category->getIsActive()) {
  return $html;
 }
 $children = $category->getChildren();
 $hasChildren = $children && $children->count();
 /***** Getting Product List Start ******/
 $cur_category = Mage::getModel('catalog/category')->load($category->getId());
 $_productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($cur_category)->setOrder('position', 'ASC');
 $cnt=1;
 $hasProduct1=$_productCollection->count();
 $phtmlChildren='';
 if($hasProduct1>=1){
  $l=$level+1;
  foreach ($_productCollection AS $_product){
   $cur_product = Mage::getModel('catalog/product')->load($_product->getId());
   if ($cur_product->getStatus()){
    $phtmlChildren.= '<li';
    if($cnt==$hasProduct1) {
     $phtmlChildren.= ' class="level'.$l;
     $phtmlChildren.= ' nav-'.$this->htmlEscape($cur_product->getName()).' last';
    }
    else {
     $phtmlChildren.= ' class="level'.$l;
     $phtmlChildren.= ' nav-'.$this->htmlEscape($cur_product->getName());
    }
    $phtmlChildren.= '">'."\n";
    $phtmlChildren.= ' <a href="/'.$cur_product->getUrlPath() . '.html">'. $this->htmlEscape($cur_product->getName()) . '</a>'."\n";
    $phtmlChildren.= '</li>';
    $cnt=$cnt+1;
   }
  }
 }
 /***** Getting Product List End ******/
 $html.= '<li';
 if ($hasChildren || (!empty($phtmlChildren)))
  $html.= ' onmouseover="toggleMenu(this,1)" onmouseout="toggleMenu(this,0)"';
 $html.= ' class="level'.$level;
 $html.= ' nav-'.str_replace('/', '-', $category->getRequestPath());
 if ($this->isCategoryActive($category))
  $html.= ' active';
 if ($last)
  $html .= ' last';
 if ($hasChildren || (!empty($phtmlChildren))) {
  $cnt = 0;
  foreach ($children as $child)
   if ($child->getIsActive())
    $cnt++;
  $html .= ' parent';
 }
 $html.= '">'."\n";
 $html.= '<a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'."\n";
 $htmlChildren = '';
 if ($hasChildren) {
  $j = 0;
  foreach ($children as $child)
   if ($child->getIsActive())
    $htmlChildren.= $this->drawItem($child, $level+1, ++$j >= $cnt);
 }
 if ((!empty($htmlChildren)) || (!empty($phtmlChildren)))
  $html.= '<ul class="level' . $level . '">'."\n" .$htmlChildren .$phtmlChildren .'</ul>';
 $html.= '</li>'."\n";
 return $html;
}

The below lines in drawItem() function will fetch the current sub-category's product list based on the sub-category id. The $_productCollection has the list of product of selected subcategory by getting the id as $category->getId() function.

 $cur_category = Mage::getModel('catalog/category')->load($category->getId());
 $_productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($cur_category)->setOrder('position', 'ASC');

We will loop through them and generate the menu structure using <li></li> tag.

 


Magento Menu Customization with Product List

February 3, 2009 00:02 by admin

Magento main menu is construed based on the hierarchy like,

 Root Category → Category → Sub-Category

We will customise the menu to show the Products of a category/su-bcategory along with its hierarchy in dropdown menu as seen below.

    

This is a good feature if you have less products in a website.

In order to implement the above structure, we need to modify the navigation.php file of drawItem() function like below. The navigation.php is available in the following location,

app/code/core/Mage/Catalog/Block/Navigation.php

The code is,

Public function drawItem($category, $level=0, $last=false){
 $html = '';
 if (!$category->getIsActive()) {
  return $html;
 }
 $children = $category->getChildren();
 $hasChildren = $children && $children->count();
 /***** Getting Product List Start ******/
 $cur_category = Mage::getModel('catalog/category')->load($category->getId());
 $_productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($cur_category)->setOrder('position', 'ASC');
 $cnt=1;
 $hasProduct1=$_productCollection->count();
 $phtmlChildren='';
 if($hasProduct1>=1){
  $l=$level+1;
  foreach ($_productCollection AS $_product){
   $cur_product = Mage::getModel('catalog/product')->load($_product->getId());
   if ($cur_product->getStatus()){
    $phtmlChildren.= '<li';
    if($cnt==$hasProduct1) {
     $phtmlChildren.= ' class="level'.$l;
     $phtmlChildren.= ' nav-'.$this->htmlEscape($cur_product->getName()).' last';
    }
    else {
     $phtmlChildren.= ' class="level'.$l;
     $phtmlChildren.= ' nav-'.$this->htmlEscape($cur_product->getName());
    }
    $phtmlChildren.= '">'."\n";
    $phtmlChildren.= ' <a href="/'.$cur_product->getUrlPath() . '.html">'. $this->htmlEscape($cur_product->getName()) . '</a>'."\n";
    $phtmlChildren.= '</li>';
    $cnt=$cnt+1;
   }
  }
 }
 /***** Getting Product List End ******/
 $html.= '<li';
 if ($hasChildren || (!empty($phtmlChildren)))
  $html.= ' onmouseover="toggleMenu(this,1)" onmouseout="toggleMenu(this,0)"';
 $html.= ' class="level'.$level;
 $html.= ' nav-'.str_replace('/', '-', $category->getRequestPath());
 if ($this->isCategoryActive($category))
  $html.= ' active';
 if ($last)
  $html .= ' last';
 if ($hasChildren || (!empty($phtmlChildren))) {
  $cnt = 0;
  foreach ($children as $child)
   if ($child->getIsActive())
    $cnt++;
  $html .= ' parent';
 }
 $html.= '">'."\n";
 $html.= '<a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'."\n";
 $htmlChildren = '';
 if ($hasChildren) {
  $j = 0;
  foreach ($children as $child)
   if ($child->getIsActive())
    $htmlChildren.= $this->drawItem($child, $level+1, ++$j >= $cnt);
 }
 if ((!empty($htmlChildren)) || (!empty($phtmlChildren)))
  $html.= '<ul class="level' . $level . '">'."\n" .$htmlChildren .$phtmlChildren .'</ul>';
 $html.= '</li>'."\n";
 return $html;
}

The below lines in drawItem() function will fetch the current sub-category's product list based on the sub-category id. The $_productCollection has the list of product of selected subcategory by getting the id as $category->getId() function.

 $cur_category = Mage::getModel('catalog/category')->load($category->getId());
 $_productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($cur_category)->setOrder('position', 'ASC');

We will loop through them and generate the menu structure using <li></li> tag.

 


Magento Menu Customization with Product List

February 3, 2009 00:02 by admin

Magento main menu is construed based on the hierarchy like,

 Root Category → Category → Sub-Category

We will customise the menu to show the Products of a category/su-bcategory along with its hierarchy in dropdown menu as seen below.

    

This is a good feature if you have less products in a website.

In order to implement the above structure, we need to modify the navigation.php file of drawItem() function like below. The navigation.php is available in the following location,

app/code/core/Mage/Catalog/Block/Navigation.php

The code is,

Public function drawItem($category, $level=0, $last=false){
 $html = '';
 if (!$category->getIsActive()) {
  return $html;
 }
 $children = $category->getChildren();
 $hasChildren = $children && $children->count();
 /***** Getting Product List Start ******/
 $cur_category = Mage::getModel('catalog/category')->load($category->getId());
 $_productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($cur_category)->setOrder('position', 'ASC');
 $cnt=1;
 $hasProduct1=$_productCollection->count();
 $phtmlChildren='';
 if($hasProduct1>=1){
  $l=$level+1;
  foreach ($_productCollection AS $_product){
   $cur_product = Mage::getModel('catalog/product')->load($_product->getId());
   if ($cur_product->getStatus()){
    $phtmlChildren.= '<li';
    if($cnt==$hasProduct1) {
     $phtmlChildren.= ' class="level'.$l;
     $phtmlChildren.= ' nav-'.$this->htmlEscape($cur_product->getName()).' last';
    }
    else {
     $phtmlChildren.= ' class="level'.$l;
     $phtmlChildren.= ' nav-'.$this->htmlEscape($cur_product->getName());
    }
    $phtmlChildren.= '">'."\n";
    $phtmlChildren.= ' <a href="/'.$cur_product->getUrlPath() . '.html">'. $this->htmlEscape($cur_product->getName()) . '</a>'."\n";
    $phtmlChildren.= '</li>';
    $cnt=$cnt+1;
   }
  }
 }
 /***** Getting Product List End ******/
 $html.= '<li';
 if ($hasChildren || (!empty($phtmlChildren)))
  $html.= ' onmouseover="toggleMenu(this,1)" onmouseout="toggleMenu(this,0)"';
 $html.= ' class="level'.$level;
 $html.= ' nav-'.str_replace('/', '-', $category->getRequestPath());
 if ($this->isCategoryActive($category))
  $html.= ' active';
 if ($last)
  $html .= ' last';
 if ($hasChildren || (!empty($phtmlChildren))) {
  $cnt = 0;
  foreach ($children as $child)
   if ($child->getIsActive())
    $cnt++;
  $html .= ' parent';
 }
 $html.= '">'."\n";
 $html.= '<a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'."\n";
 $htmlChildren = '';
 if ($hasChildren) {
  $j = 0;
  foreach ($children as $child)
   if ($child->getIsActive())
    $htmlChildren.= $this->drawItem($child, $level+1, ++$j >= $cnt);
 }
 if ((!empty($htmlChildren)) || (!empty($phtmlChildren)))
  $html.= '<ul class="level' . $level . '">'."\n" .$htmlChildren .$phtmlChildren .'</ul>';
 $html.= '</li>'."\n";
 return $html;
}

The below lines in drawItem() function will fetch the current sub-category's product list based on the sub-category id. The $_productCollection has the list of product of selected subcategory by getting the id as $category->getId() function.

 $cur_category = Mage::getModel('catalog/category')->load($category->getId());
 $_productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($cur_category)->setOrder('position', 'ASC');

We will loop through them and generate the menu structure using <li></li> tag.

 


WebEx Meeting Integration Steps

November 5, 2008 12:18 by Madhu

In order to integrate WebEx into web application we need to complete the following steps:

  1. Create a developer account on WebEx developer community
    We need to create a developer account in the sandbox environment. The credentials identify and authenticate your web application request when you make an API call to WebEx.
  2. Request & Response
    Make the API calls, check the response and save to database or send the meeting details to participants via email

Creating WebEx Developer Account

You will have to create a Developer Account on the WebEx developer environment in order to test your application.  Following are the steps:

  1. Sign up at http://developers.webex.com/ with a valid email id to recieve your credentials to the WebEx system.
  2. After signing up, account information will be sent to your mail id. It may take more time, as each application will be manually reviewed by WebEx team.
  3. Email will have the SITE ID and PARTNER ID of your account.
  4. You have to use the above account information (USERNAME, PASSWORD, SITE ID, and PARTNER ID) in all the requests to authenticate your web application with WebEx.
  5. Check API Reference Guide to understand more on Parameter nodes and Key Words for the requests to be made to organise meetings.
    http://www.webex.com/pdf/white_paper_integration_APIs.pdf page number 14 onwards.

Creating Meeting (Sample Code)

In ASP.NET page, the following function will be called to schedule a meeting. The parameters will be Meeting Name, its Date and Time. In this example WebEx ID (Email Id), Password, Site Id, and Partner Id is hardcoded.

    protected void SendCreateMeetingRequestToWebEx(string MeetingName, string MeetingDate, string MeetingTime)
    {
        string strReq = @"<?xml version=""1.0"" encoding=""UTF-8""?>" +
                      "<serv:message xmlns:xsi=" + "\"" + 
                              "http://www.w3.org/2001/XMLSchema-instance" + "\"" + ">" +
                        "<header>" +
                            "<securityContext>" +
                                "<webExID>xxx@xxx.xxx</webExID>" +
                                "<password>xxxxxx</password>" +
                                "<siteID>000000</siteID>" +
                                "<partnerID>XXXX0000</partnerID>" +
                            "</securityContext>" +
                        "</header>" +
                        "<body>" +
                          "<bodyContent xsi:type=" + "\"" +
                             "java:com.webex.service.binding.meeting.CreateMeeting" + 
                             "\"" + ">" +
                            "<metaData>" +
                              "<confName>" + MeetingName + "</confName>" +
                            "</metaData>" +
                            "<schedule> " +
                              "<startDate>" + MeetingDate + " " + MeetingTime + ":00" + "</startDate> " +
                            "</schedule>" +
                          "</bodyContent>" +
                        "</body>" +
                      "</serv:message>";
        HttpWebRequest hwrRequest = ((HttpWebRequest)(HttpWebRequest.Create(" https://apidemoeu.webex.com/WBXService/XMLService")));

        hwrRequest.Method = "POST";
        hwrRequest.ContentType = "text/xml";
        UTF8Encoding encoding = new UTF8Encoding();
        byte[] postBytes = encoding.GetBytes(strReq);
        hwrRequest.ContentLength = postBytes.Length;
        Stream postStream = hwrRequest.GetRequestStream();
        postStream.Write(postBytes, 0, postBytes.Length);
        postStream.Close();
        HttpWebResponse hwrResponse = ((HttpWebResponse)(hwrRequest.GetResponse()));
        Stream responseStream = hwrResponse.GetResponseStream();
        StreamReader sr = new StreamReader(responseStream);
        string respString = sr.ReadToEnd();
        respString = respString.Trim();

        /*Here we are writing to a directory as XML file to check*/
        /*Instead you read the XML nodes and find, is it success or a failure*/
        /*If success, you will have Host meeting URL and Attendee meeting URL in the Response*/
        TextWriter res = new StreamWriter(Server.MapPath(@"WebExReqRes\CreateMeeting.xml"));
        res.WriteLine(respString.ToString(), true);
        res.Close();
    }

The response will have the MeetingKey, Host URL, and Attendee URL if it is success. Now you have to push them to database to show respective URL to your users based on profile. And also you can frame emails and send to them handy.

 

Further the MeetingKey you have to use to Update Meeting or Delete a Meeting or to create Join Meeting URL for each individual attendee seperately instead of common Attendee URL.