How to Get the Full Action Name in Magento

In Magento, we will be able to get the full action name of an action object with the help of Action object. So the first step in getting the parameter is to get the Action, which triggered it.

$action = Mage::app()->getFrontController()->getAction();

Next step is to get the full name of the action. You can implement the following code.

$acionName = $action->getFullActionName();

Upgrading WooCommerce

Automatic Upgrade
After you backup your site go to Plugins > Installed Plugins within WordPress to view a list of plugins you’ve previously installed. If an upgrade to WooCommerce is available you will see a notice beneath the plugin listing which states the point release which is now available as well as links to view the details of that version and to upgrade automatically.
To upgrade simply click the ‘Upgrade Automatically’ link. You may be asked for your webservers FTP details, if that’s the case fill them in to complete the upgrade.
Manual Upgrade
To manually upgrade WooCommerce: First, backup your site then download the latest version of the plugin from our WordPress plugin page and uploade it to the wp-content/pluginsdirectory on your web server overwriting the old files.

Installing and Uninstalling WooCommerce in WordPress

Automatic installation
Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t even need to leave your web browser. To do an automatic install of WooCommerce log in to your WordPress admin panel and go to: Plugins > Add New.
In the search field type “WooCommerce” and click Search Plugins. Once you’ve found the plugin you can view details about it such as the the point release, rating and description. Most importantly of course, you can install it by simply clicking Install Now. After clicking that link you will be asked if you’re sure you want to install the plugin. Click “yes” and WordPress will automatically complete the installation.
Manual installation
1. Download the plugin to your computer.
2. Unzip the file.
3. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation’s wp-content/plugins directory.
4. Activate the plugin from the Plugins menu within the WordPress admin.
After you’ve installed and activated the plugin, be sure to select ‘Install WooCommerce Pages‘ to get started.

Uninstall WooCommerce
If you are wanting to uninstall WooCommerce there are a couple things to understand.
If you deactivate and delete the plugin from the WordPress admin you will delete the WooCommerce settings, database tables, and trash the pages created when first installed.
If you need to remove ALL WooCommerce data, including products, order data, etc… Head into WooCommerce > System Status > Tools, then enable the Remove post types on uninstall. Then when you deactivate and delete the pugin from the WordPress plugin admin, it will delete all WooCommerce data.

Magento Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000] [2002] No such file or directory

If you get an error like this in Magento shell prompt:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Abstract.php:129
Stack trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Abstract.php(129): PDO->__construct('mysql:host=loca...', 'root', '', Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Mysql.php(109): Zend_Db_Adapter_Pdo_Abstract->_connect()
#2 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Varien/Db/Adapter/Pdo/Mysql.php(320): Zend_Db_Adapter_Pdo_Mysql->_connect()
#3 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#4 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#5 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstr in /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Abstract.php on line 144

Then, it means Zend cannot find the socket for PDO connection. What you need to do is create an alias to your MySQL socket (you may need to login as a root user in terminal to execute these commands)

On XAMPP:
sudo mkdir /var/mysql
cd /var/mysql
sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock

On MAMP:
sudo mkdir /var/mysql
cd /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock

Magento Amazon Payments Login and Pay – Installation & Configuration

Amazon Payments provides a Magento Amazon Login and Pay module for free. They already hav a pretty neat installation guide for it but, their configuration guide could use further details. I will be tackling only the confusing areas of the configuration process here and link directly to Amazon for the rest.

Step 1: Register for an Amazon Seller Account
https://payments.amazon.com/sp/magento/resources#register-account

Step 2: Download the module from Git-hub & Install
https://payments.amazon.com/magento/resources#install-extension

Step 3: Get your API Access Key ID & Secret Key ready
Login into your Amazon Seller Account
On the top left you will see 2 links: “Orders” and “Integration”
Mouse over on “Integration” and you will see a popup menu. Click “MWS Access Key”.
Here you will get your API Access Key ID & your Secret Access Key (click on “+show” to see the secret key)
Magento Amazon Login and Pay Module - Get your API Access Key ID  and Secret Key ready

Step 4: Get your Merchant/Seller ID ready
Login into your Amazon Seller Account
Ensure that “Amazon Payments Advanced” is selected from the drop down menu on top.
Mouse over on the “Settings” link on the top left corner and click “Integration Settings”.
You will find your Merchant ID here.
Magento Amazon Login and Pay Module - Get your Merchant or Seller ID ready

Step 5: Get your Client ID & Secret Key ready
This is the section that gets most people confused. These are the steps that worked for me.

  • Login into your Amazon Seller Account
  • Select “Login with Amazon” from the drop down menu on top.
    Magento Amazon Login and Pay Module - Select Login with Amazon from the drop down menu on top.
  • Click on the big yellow color (Amazon calls it golden color) button on the right top “Register new application”.
    Magento Amazon Login and Pay Module - Click on the Register new application button
  • Fill in the details of your shop here and submit.
    Magento Amazon Login and Pay Module - Register your application
  • You will see that your application name has appeared in the “Applications” box on the left side.
  • Click on it to go to the details page. Here you will see 2 tabs “Settings” and “Metrics”
  • Under the “Settings” tab, in the “Web Settings” section, you will find your “Client ID” and “Client Secret” (click on the “show secret” button to see it)

IMPORTANT NOTE: If, you enable the “Login with Amazon” feature on your shop then, you need to configure the “Allowed JavaScript Origins” field. To do this, click on the “Edit” button in the “Web Settings” section and enter the SECURE URLS to your shop. It is very important that you enter a secure URL. Amazon will not let you store a non secure URL in this field.
Magento Amazon Login and Pay Module - Get client ID and Secret Key

Step 6: Login into your Magento Admin.

  • To configure the Login with Amazon section go to System > Configuration > Customers > Login with Amazon.
  • To configure the Pay with Amazon section go to System > Configuration > Sales > Payment Methods > Amazon Payments / Login and Pay with Amazon

Step 7: Setup test buyer accounts
Amazon lets you create test buyer accounts. If, you are developer, you need to ensure the seller has given you admin rights, to be able to see this option. Remember, you are use these test accounts only in Sandbox Mode. That means, these accounts will work only if, all the other credentials (client ID, key etc) are all from the sandbox too!

  • Login into your Amazon Seller Account
  • Ensure that “Amazon Payments Advanced” is selected in the drop down menu on top.
  • Mouse over on “Integration” link on the top left and you will see a popup menu. Click “Test Accounts”.
  • Click “Create a new test account” and fill in the details. The payment methods will be auto populated by Amazon and you cannot edit it.

Magento Amazon Login and Pay Module - Create Test Accounts

Magento for Beginners: How to install Magento

Magento has a pretty good guide for beginners on how to install Magento still, I find many customers coming back to us with common questions like “Which is my Magento root folder”, “Where are my Magento files?”, “Where should I upload Magento?”. I hope to answer some of these common questions along with explaining how to install Magento from scratch.

Point 1: Decide what do you want your shop URL to look like.

Answer this question and you will know exactly where to upload the Magento files.
If, you want your Magento shop to appear as soon as you browse your domain name – for example, http://www.myshop.com – then, upload your Magento files to your public_html or www or httpdocs folder depending on your web-host’s naming rules.
If, you want your Magento shop to appear as soon as your browse something like this – http://www.myshop.com/buyhere – then, upload your Magento files to public_html/buyhere/ folder (remember, for some web-hosts it will be www or httpdocs instead of public_html).

Point 2: Decide whether you want to install the sample products or not

Answer to this question is very important. If, you want to populate your shop with some default products, so that you can get a clear idea of all the built in features of Magento, then, you need to import the products BEFORE YOU INSTALL MAGENTO. It is very important that you do this before you start the installation.

Point 3: Get your FTP & MySQL credentials ready.

You will need to upload the Magento files to your shop. Generally, FTP is used for this. If, you are not sure what FTP is then, please contact your web-hosting company and they will give you the credentials and help you get started with it.

Point 4: Do you have URL re-write enabled on your server.

Apache has a plugin called “mod_rewrite” which allows you to decide nice looking (meaning SEO optimized) URLs for your products and categories. Again, if, you are not sure what this is contact your web-host and they will be able to help you.

Point 5: Ensure that you have the right to change the permissions of the files and folders.

After copying the files, before you start the installation process you will need to change the permissions of certain files and folders. Ensure that you have the necessary rights to do it.

Now, lets start with the installation process. Please note that, these steps are valid even on localhost!

  1. Download the Magento files and sample data (if, you want it) from this URL: http://www.magentocommerce.com/download
  2. Unzip the files into the appropriate folder in your web-server (see point #1 for more details)
  3. Ensure that these folders are write-able: media, var, app/etc
  4. Create a new database for your shop. Remember the credentials. You will need them later.
  5. At this stage, if, you want to install the sample products then,
    1. extract the sample data zip and import the SQL file into your new database
    2. over-write the media folder in your Magento root with the media folder extracted from the zip.
  6. Browse your shop URL to start the installation process
  7. Follow the wizard, answering all the questions
  8. In the “Configuration” step, enter your database credentials and keep these points in mind
    1. If, you are on localhost or a test server then, ensure that you check “Skip Base URL Validation Before the Next Step”
    2. If, you do not have mod_rewrite or you are not sure then, ensure that “Use Webserver (Apache) Rewrites” is unchecked
    3. If, you are on localhost or do not have a secure URL (https://) URL for your shop then, ensure that “Use Secure URLs(SSL)” is unchecked
  9. In the “Create Admin Account” step, it is best to leave the “Encryption Key” field blank unless you are absolutely sure about what you are doing!
  10. Make a note of the encryption key generated in the “You are all set!” step and that is it! You are all ready to work with Magento.

Magento – Fatal error: Class ‘Zend_Log’ not found

As a Magento developer if, you ever encounter an error like this “Fatal error: Class ‘Zend_Log’ not found….” then, enable developer mode in Magento to see the actual error.

To enable developer mode, open your index.php file and fine this section (approx line num: 73)
if (isset($_SERVER[‘MAGE_IS_DEVELOPER_MODE’])) {
Mage::setIsDeveloperMode(true);
}

Just above this if add a line like this:
$_SERVER[‘MAGE_IS_DEVELOPER_MODE’] = true;

Now, refresh the page where you saw the fatal error message and the complete details of the error will appear on your screen. Remember to comment the line you added when you are done.

Additional Information:
Magento catches all PHP errors, processes it and re-formats it for display. This is done with the help of the Zend_Log class. In case your script throws an error before this class can be instantiated then, you will see such a fatal error.
Developer mode will stop Magento from catching PHP errors and you will see the error details directly on the browser.

Magento – The requested Payment Method is not available.

As a Magento developer if, you get an error like this:
The requested Payment Method is not available.
then, check these:

  1. Ensure that there are no spelling mistakes in your config.xml file – especially the tags that have your module name in it.
  2. Check the allowed countries
  3. Check the error logs
  4. Debug the Mage_Payment_Model_Method_Abstract::isAvailable() method
  5. Debug the Mage_Payment_Model_Info::getMethodInstance() method
  6. Debug the Mage_Payment_Helper_Data::getMethodInstance() method – if you have a typo in your config.xml you will most likely find that the $class variable in this method is empty!

What is First Data Virtual Terminal, Global Gateway e4 and Linkpoint!

You have an online shop, a merchant account with First Data and just need the right payment module to integrate First Data Global Gateway into your shop – that’s it your ready to go online!

Wait a minute – you see First Data Global Gateway Virtual Terminal, First Data Global Gateway e4 Hosted Payment Page and First Data Global Gateway e4 Web-services modules. What is the difference? Which one to choose?

First Data Global Gateway Virtual Terminal (previously known as LinkPoint), is one of the oldest and the most reliable merchant services to process payments online. When you register for a First Data Global Gateway Virtual Terminal account you will get a PEM file which is a security file that helps your website talk to the First Data server.

Recently, First Data has launched a new payment solution called First Data Global Gateway e4 which has both hosted payment pages and a web services methods. First Data strongly recommends the use of First Data Global Gateway e4 over First Data Global Gateway Virtual Terminal. Login into your First Data account and go to Support > Download Center. If, you see a link to download your PEM file then, you have a FDGG Virtual Terminal account. Click here to learn more about setting up your FDGG Virtual Terminal module.

Then, what is First Data Global Gateway e4 Hosted Payment Pages & Web-services API?
FDGG e4 Hosted Payment Pages protects the user from handling sensitive customer payment data by hosting the payment pages and forms on their servers. The flow in this method will redirect the buyer from the users site to the First Data server to enter their payment details and complete the payment. Once the payment is successful the buyer is redirected back to the users site with the payment details. This method not only protects the user but, also reduces the steps for PCI compliance.

FDGG e4 Web-services API on the other hand allows users to provide a seamless process for their buyers by processing the payment directly on their website without any redirection. In this method the buyer will remain on the shop – the user will collect the payment data via their website and send it to First Data through web-service calls and get the response. This method the payment information passes through the merchants shop server.

So if, you are a new customer of First Data then most probably you will have the First Data Global Gateway e4 account. Or if, you are an existing user and have not heard about a PEM file or your bank (like Bank of America) says that you do not have a PEM file then you are a First Data Global Gateway e4 account holder.

How to use FirstData Global Gateway on your online shop?

FirstData (previously known as LinkPoint) is currently one of the most popular payment gateways on the internet; with small to enterprise business trusting it to process transactions.
Schogini has been working with FirstData for over 10 years now both as a merchant and as a developer.
Our FirstData payment modules are currently being used in over 2000 shops world wide – Magento, OpenCart and PrestaShop.
Based on our experience these are some of the common issues or questions that FirstData payment gateway users have:

  1. What is all the fuss about PEM!?
    A PEM file is unique digital file which FirstData issues to each merchant.Every time your shop tries to talk to FirstData servers, FirstData will first check the validity of the PEM file.If, its not valid or corrupted or cannot be read by FirstData (that is wrong file permissions) then all further processing with stop and FirstData will return an error like this:”Error: unable to use client certificate (no key found or wrong pass phrase?)”You can download your PEM file by logging into your FirstData account > Support > Download Center.

    If, you do not see it there then, raise a support ticket with FirstData and they will get you in.

    These 3 points are basic & quick ways to check the validity of your PEM file. Open the PEM file and check:

    • It should have at least 30 to 31 lines
    • It should have 2 sections Private Key and Certificate
    • The PEM file format should look somethings like this:
      —–BEGIN RSA PRIVATE KEY—–
      ……….
      ……….
      —–END RSA PRIVATE KEY—–
      —–BEGIN CERTIFICATE—–
      ……….
      ……….
      —–END CERTIFICATE—–

    If your PEM file fails any of these points then, it is most probably corrupted and you will need to download it again.

  2. The difference between Live & Test modes?
    It is always advisable to test the payment gateway in TEST mode before going LIVE.For FirstData, test and live accounts are 2 separate accounts and hence there are 2 separate PEM files!You need you register separately for a test account, login into the test account and download the test PEM file – just like you would do for a live account.You can register for a FirstData test account here:https://www.firstdata.com/gg/apply_test_account.htm

    REMEMBER: If you use a LIVE pem file in test mode or the other way round then, you will get the error:

    “Error: unable to use client certificate (no key found or wrong pass phrase?)”

    Yes, this is the same error that you get when FirstData cannot intepret your PEM file – and it is correct since the live and test servers are different and hence, they cannot understand each others PEM files!

  3. The port 1129 mystery.
    For security and convenience, FirstData communicates with your shop ONLY through port 1129 of your web server.On most hosts, this port is closed since, this is not a common port for communication.If, port 1129 on your server is closed then, FirstData will not be able to talk to your shop at all and you will see an error like this:”Error saying: couldn’t connect to host.”Ask your host to open port 1129 for outbound traffic. They should be able to handle it.

    If, your hosts says that they can open the port only for a specific IP then, request them to open outbound traffic on port 1129 for secure.linkpt.net.

  4. FirstData vs. LinkPoint.
    LinkPoint is now called FirstData Global Gateway. This basically means that your LinkPoint account should work absolutely fine with FirstData!

Summarizing, to use FirstData on your shop you will need 3 things:

  1. A merchant account with FirstData. You will get a store ID when you register. Remember it.
  2. PEM file. This is a unique digital file that FirstData assigns to you to identify you securely.
  3. Port 1129 open for outbound traffic on your web server

You can get more information on FirstData’s online payment solutions here:
http://www.firstdata.com/en_us/products/merchants/online-and-telephone-payments.html

Hope this has helped clear some of the doubt clouds around FirstData payment gateway.

If, you are Schogini payment module user then, this FAQ is more specific to the module and should definitely guide you better: http://schogini.biz/firstdata-linkpoint-faq

If, you need to purchase the FirstData Payment Module you can go to http://schogini.biz