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();

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 Bulk Update Product Image to Show First Image by Default

In Magento, if, you want to show the first image of your product by default then, run these SQL queries:

Step 1: Get the attribute_ids for base image, small image and thumbnail
select * from eav_attribute where attribute_code IN (‘image’, ‘thumbnail’, ‘small_image’) AND frontend_model is not null and backend_model = ”;

Step 2: Use the attribute_id got from the above query to execute this query. In my db, the attribute_id were 74, 75, 76. Please note, you should get a minimum of 3 ids from the above query.

UPDATE catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
SET ev.value = mg.value
WHERE mg.value_id = mgv.value_id
AND mg.entity_id = ev.entity_id
AND ev.attribute_id IN (74, 75, 76)
AND mgv.position = 1;

Step 3: Via Magento Admin clear all cache and re-index all indexes.

That’s it!

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.

Advantages Of Beginning An Online Business Using Magento

Advantages Of Beginning An Online Business Using Magento

Likely to start an online business? You have to be searching at multiple options and weighing the benefits and drawbacks of every, before determining. Exactly what the experts suggest after searching at several choices may be the Magento eCommerce Platform. I have recently been certified by Magento on the Magento Developer Plus Certification(2012 at http://schogini.in).

Magento uses breakthrough and very flexible and have-wealthy technology to help you setup your whole eCommerce store and procedures rapidly thus allowing you to achieve your Return on investment faster.

Using Magento can help you save lots of money. Since its a totally free-to-use free solution, you don’t need to pay for any type of monthly or yearly costs, when using the community version. Its very well designed and comprehensive it includes every feature that the great eStore would ever require a condition-of-the-art shopping cart software, easy catalog management, search, checkout, mix selling and lots of features within the after sales admin panel. Magento also provides marketing and marketing tools which help you accrue business.

Magentos best feature may be the highly user-friendly admin interface where the various benefits from the eStore could be handled effortlessly and convenience. An additional advantage is the fact that multiple online retailers could be handled in the same panel.

Why is Magento very popular is that certain doesn’t have to become a technical i.e., a programmer or developer to function this. But when you’re a technical, its more beneficial, because you could develop your personal custom Magento modules to really make it much more effective.

Magento has built-in Search engine optimization-friendly features, which will help you receive better Search engine optimization ratings and therefore pulls increased traffic to your web page. Magentos versatility enables us to change existing features or include brand new ones. Which means you can certainly modify styles and items to satisfy periodic business demands. Additionally, you will have the ability to benefit from the benefits that always only large companies get for eg., sales monitoring.

A great Magento web design clients are worth the weight in gold! The Magento Web-developers will comprehend the character of the business and evaluate it and style the very best Magento site which will attract lots of traffic.

There’s an excellent scope for Magento Database Integration which may increase the value of your website as well as generate a larger feeling of loyalty. A competent Magento web design company should have the ability to create personalized programs that won’t only keep the existing clients engaged together with your business but additionally pull in start up business.

The greatest secret of online success is to maintain your choices fresh and novel. Nothing can delay a web-based buyer a lot more than seeing stale stuff again and again again. So for the greatest from your Magento eCommerce store 24X7, keep altering your styles, offers and merchandise frequently. This really is the easiest method to keep your traffic growing and unpredictable-minded online clients returning for you over and over.

Schogini has a large collection of payment modules for Magento Modules at (http://schogini.biz). Modules approved by Magento and Firstdata Global Gateway e4 are some of the very popular payment options in the world.

Gayatri S Ajith a Magento Developer Plus Certified Professional (2012 at http://schogini.in).

Magento Modules (http://schogini.biz)

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

How to enable error reporting on Magento – developers only

If, you a Magento developer you definitely know that Magento debugging is something of an art in itself.

This edit is for developers who need to see the Magento errors directly on their browser (developer mode)

versions before 1.4
In the Magento root folder index.php uncomment the line (around line #60):
#Mage::setIsDeveloperMode(true);

versions after 1.4
Open the .htaccess file in the Magento root folder and add a line like this to the end of the file:
SetEnv MAGE_IS_DEVELOPER_MODE “”

NOTE: If, you want to enable PHP error reporting too then, open index.php in the Magento root folder and uncomment the line (around line #70):
#ini_set(‘display_errors’, 1);

What does the .htaccess line do?

The .htaccess line that you add will create a server environment variable MAGE_IS_DEVELOPER_MODE which you can set when you want to enable developer mode. Hence, you do no need to have 2 versions of index.php for staging and live shop.

When you do not want developer mode just delete this line from the .htaccess file!

This statement in index.php will give you a better explanation:

<pre  class=”  brush:c”>

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
// This is the variable you define in .htaccess
    Mage::setIsDeveloperMode(true);
}
</pre>

Magento XML errors

You see an XML error either on your screen or in your system.log but, you do not know which XML file has caused it? These tips should help you get started:

  • Edit this file on line 432
    [magento root]/app/code/core/Mage/Core/Model/Layout/Update.php
    add this code:

    if (!$fileXml instanceof SimpleXMLElement) {
        // add this log statement - ensure to enable error logging on your shop Mage::log(print_r($filename, true));
        continue;
    }
  • Edit this file on line 515
    [magento root]/lib/Varien/Simplexml/Config.php

    if ($xml instanceof Varien_Simplexml_Element) {
        $this->_xml = $xml;
        return true;
    } else { // add this else statement to the if - ensure to enable error logging on your shop Mage::log(print_r($string, true)); }
  • Clear the Magento cache and reload the page you are working on
  • Now check your /var/lib/system.log file – you should see the XML filename or the XML string that is causing the error.

Additional Help:
As you must have guessed from the file names of the above files:

  • If the error is from this file:
    [magento root]/lib/Varien/Simplexml/Config.php on line 510
    then it, means there is an error in one of your module config files. Check one of these config.xml files:

    • [magento root]/app/etc/modules/config.xml
    • [module path]/etc/config.xml
  • If the error is from this file:
    [magento root]/app/code/core/Mage/Core/Model/Layout/Update.php on line 431
    then, there is an error in your theme layout XML file.

Hope, this helps you debug faster.

How show more order statuses on the admin order details page

As of 1.4.2 it is deprecated to define order statues and states via config.xml. Then, how will you get more order statuses in the admin order details page?

Consider for example you have an order in ‘Pending Payment’ state and you want to change it to ‘Processing’. If, you go to the order details page in the admin you will find only one option in the order status drop down (which is ‘Pending Payment’ itself!)
What if you want to show ‘Processing’ too in the drop down?
You will need to make changes in the Magento sales_order_status_state table like this:

INSERT INTO `sales_order_status_state` (`status`, `state`, `is_default`) VALUES ('processing', 'pending_payment', '0');

[EDIT] Just for your info:
Before 1.4.2 you would need to override the Mage/Sales/etc/config.xml file and modify the <global><sales><order><states> section to look like this:

<global>
.....
.....
	<sales>
.....
.....
		<order>
.....
.....
			<states>
.....
.....
				<pending_payment translate="label">
					<label>Pending Payment</label>
					<statuses>
						<pending_payment default="1"/>
						<processing default="0"/>
					</statuses>
				</pending_payment>
.....
.....
			</states>
.....
.....
		</order>
.....
.....
	</sales>
.....
.....
</global>

How to add static blocks to a CMS page

You have created a static block and now you want to add it to your CMS page.
You can do it in 2 ways. Assume you have created a block called sch_myblock:

1. CMS Page “Content” tab:
// In the CMS page “content” you can include a custom static block like this

{{block type="cms/block" block_id="sch_myblock" template="cms/content.phtml"}}

2. CMS Page “Design” tab:
// In the “Page layout” section you can add a custom block like this

// In the "Page layout" section you can add a custom block like this
<reference name="left">
	<block type="cms/block" name="sch_myblock" before="-">
		<action method="setBlockId"><block_id>sch_myblock</block_id></action>
	</block>
</reference>