iFUEL INTERACTIVE

A NY Interactive Agency and a Division of Agency212

See you on Flickr See you on Twitter See you on FaceBook Subscribe
Magento and Authorize.net CIM – Perfect Together
March 12th, 2012  |  NO COMMENTS  |  Magento
Tags: , , ,

Well, we all know Magento is the best e-commerce platform around. And Authorize.net has to be the most popular payment gateway around. So it came as a real surprise that there’s no support in Magento for the (not so new) service from Authorize.net called CIM (Customer Information Manager) that lets you save customer credit cards at Authorize.net safely and in a PCI compliant way. Not only is there no support in Magento for CIM, but the available extensions are very limited in functionality.

So when a customer asked for saved credit cards where they could add/edit and delete saved cards as well as save multiple cards, it became clear that the only thing to do was to build an extension ourselves. The result? Pure fun. I know – geeky as all you know what. But using the Authorize.net API and building out the Magento functionality was a blast. All functionality was created without saving any credit card numbers or CVC codes to the local Magento database. Here are some highlights of what we’ve come up with:

Read more

Using console.log in Later Versions of Magento Under Chrome
February 17th, 2012  |  NO COMMENTS  |  Magento Moments
Tags: , ,

Later versions of Magento have added javascript code to /js/varien/js.js to “stub out” the console if it’s not available. This is no doubt to prevent a javascript crash if errant console.log statements get left in throughout the project. The problem is, it prevents console.log from working in Chrome – which I increasingly use just because it’s so much faster.

But there’s a fix (thanks to AlexB in this post http://stackoverflow.com/questions/8080610/javascript-console-log-in-magento for this fix):

Find this block of code in /js/varien/js.js:


if (!("console" in window) || !("firebug" in console))
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {}
}

And change it to:


var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;</HL>

if (!("console" in window) || !("firebug" in console) && !is_chrome)
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {}
}
Magento Caching
February 2nd, 2012  |  NO COMMENTS  |  Magento Moments
Tags: ,

Magento uses caching extensively. If you also want to be able to save something to cache rather than reading from the database or some more expense resource like that, it’s simple:

$value = Mage::app()->loadCache(‘my_cache_key’);

If the key isn’t found, $value will be null.

To store a value in the cache is almost as easy:

Mage::app()->saveCache($data_to_store, ‘my_cache_key’, array(), $duration_in_seconds);

(The empty array in the call above is standing in for a parameter called “tags” which, to my knowledge, is not used. Someone please correct me on that if I’ve got it wrong.)

Loading Blocks
February 1st, 2012  |  NO COMMENTS  |  Magento Moments
Tags: , ,

Sometimes I’m banging my head against the wall trying to figure out why my block isn’t loading right or some other layout element isn’t rendering.  And I’ve always wished I could just see the layout as Magento is seeing it.  So I finally dug in to see and it’s actually incredibly simple to output the layout for a given page in xml format.

echo Mage::app()->getLayout()->getNode()->asNiceXml('', 0);

The layout is just a Varien_Simplexml_Config.  getNode buys you access to the private $_xml variable that holds the root node of the xml document.  Then asNiceXml formats it nicely for the screen.  If you’d rather output to a file (they can be large chunks of xml) supply a file name for the first parameter of asNiceXml and the xml will be written there, too.

Now back to why my block isn’t loading…

Logging Database Queries in Magento
February 1st, 2012  |  NO COMMENTS  |  Magento Moments
Tags: , , ,

Sometimes Magento does something and it’s just not obvious why.  We’ve all heard “why aren’t my products showing up?” more times than we can count.  Magento’s object model for building queries is great, but sometimes you just need to see the sql that’s being run on the database in order to know what’s really going on.

In the past I’ve used the general log in mysql.  That can be a great source of information, but, depending on the version of mysql, it can be a pain to set up.  Other times I’ve inserted logging code into various db classes in order to print out queries that are being run, but I always have to find the right place again.  But today I stumbled on this blog entry - http://blog.nexcess.net/2011/04/15/logging-database-queries-in-magento/ that spells out exactly how you can turn on some (as far as I know) undocumented logging functionality that is built right in to the Magento data access layer.  Kudos to the author and thanks for sharing!

CSS Awards – 20 Fabulous New Websites For Your Inspiration
January 6th, 2012  |  NO COMMENTS  |  Creative
Tags: , , ,

Here at iFuel, we are very excited to be featured again for our design work for Giutzy.com.

We were recognized as one of the 20 Fabulous New Websites For Your Inspiration.

We’re very excited to share this news with you all!

Getting the Text Value of a Category Attribute of Type Select
December 30th, 2011  |  NO COMMENTS  |  Magento Moments
Tags: , , , , ,

As shown elsewhere, you can add an attribute to the category entity in Magento.  If the attribute is of type select, getting the text value of an option is a bit of a pain:

$category = Mage::getModel(‘catalog/category’)->load(10);

$attribute = Mage::getSingleton(‘eav/config’)->getAttribute(‘catalog_category’, ‘myattribute_code’);

$text = $attribute->getSource()->getOptionText($category->getMyattributeCode());

RIP Water Cooler
December 28th, 2011  |  2 COMMENTS  |  iFuel Interactive
Tags: , ,

It was a sad morning here at iFuel Interactive. We got into the office today, and noticed that out beloved water cooler was making an odd noise. Rick went to go get some water for the coffee pot, and noticed that the entire machine was very hot, and water that was being dispensed out was boiling hot (even from the cold dispenser). He quickly unplugged the water cooler, and took out the 5 gallon water jug. Something must have happened to the heating coils, as it even started to melt the mouth of the jug. Thank goodness this didn’t happen over the weekend, or who knows what could have happened.

Read more

Best. YouTube. Video. Ever.
December 8th, 2011  |  NO COMMENTS  |  Creative, iFuel Interactive
Tags: , , ,

The holiday season is in full swing, and I’m slowly getting into the spirit of things. I listen to my holiday radio station on Pandora, and changed my desktop wallpaper to that of various festive winter scenes. Plus, I just bought a lovely dress to wear to my holiday parties, and I’m almost done with all my shopping.

After all the hard work that goes into preparing for the holidays, it is important to sit back, relax, and enjoy the time-honored tradition of putting up Christmas lights on one’s home.

(This is my absolute favorite YouTube video ever!)

Happy Holidays!

iAM THANKFUL
November 22nd, 2011  |  NO COMMENTS  |  Uncategorized, iFuel Interactive
Tags: ,

As the holiday season quickly approaches, lest we forget all that we have to be thankful for:

“I have too much to be thankful for. I can’t take anything for granted.”
-RN

“Family, friends, food and a new Muppets movie.”
-BS

“Thankful for the people at iFuel (seriously!), a new home, awesome wife, baby on the way and God’s many blessings this year.”
-RW

“I am thankful for my Mom and Dad, they raised me and they tried all their best to make me the guy that I am now. Mom and Dad- thank you very much.”
-NM

“I am thankful for my family, my Lobster, my friends, and my sisters. No matter what hardships we may face, it is important to remember all that we still have.”
-JD

Categories
Archives
Tags
From Our Twitter (@ifuel)
Our Interactive Agency on Facebook
Copyright iFuel Interactive © 2010. All Rights Reserved.
Going up? Click here.A NY INTERACTIVE AGENCY