Posted on

Magento Imagine 2012: Making the most of APIs

Just finished up with my API presentation at Magento Imagine 2012, thanks to those who came along, and for the interesting questions and discussions afterwards. Great conference so far and looking forward to more interesting tech topics.

As promised here are the PDF slides, links to code examples and the blog post I mentioned that runs through the new Magento 1.7 REST API and oAuth. If any one has some comments or questions please do not hesitate to ask.

Update: Videos of all the tech talks are up on the Imagine site, here’s mine.

Also, if you’re a merchant, or an agency with merchants on board who might be interested, please check out our mobile sales dashboard, OrderPipe.com

Thanks to everyone who twittered and took pictures during the talk, given the temporal nature of twitter, I’ll post a few tweets below for the archive.


Posted on

Introduction to the Magento REST APIs with oAuth in Version 1.7

The latest version of Magento (1.7rc1 right now) has support for oAuth authenticated REST APIs, yippee! In this post I’m going to run through the technical aspects of setting up the Magento oAuth and making your first Magento REST API call.

I’m presenting on APIs during the technology track at the Magento Imagine conference on Tuesday (If you’re reading this, and you’re at the conference, I hope to see you there!). In my talk I’ll cover interesting uses and benefits of the REST API but won’t have time for a big fully worked example. This post details the finer points of actually using these APIs which is a bit too low-level to cover, so this will be extra-for-experts homework for those that want to have a play around with REST after the talk.

There are basically 3 steps to running your first REST API call in Magento.
Continue reading Introduction to the Magento REST APIs with oAuth in Version 1.7

Posted on

OrderPipe.com Multi-channel Sales Dashboard for Magento, Amazon and Shopify

There’s been a distinct lack of new Magento content here for the last few months. That’s because I’ve been busily beavering away on our latest internal project which I’d like to share with you. It’s only partly Magento related, so bear with me. We’ve created a multi-channel mobile sales dashboard on Google App Engine called OrderPipe, and it’s now been made publicly available. It aggregates order data from multiple online sales channels for consumption on mobile and desktop.

OrderPipe.com screenshot

We launched a private beta trial at the end of September, and are nearing a point where we’ll be making it generally available (albeit initially free) to everyone.

I thought I’d take this opportunity to tell you about it, what it does (technically), and why it may interest you.
Continue reading OrderPipe.com Multi-channel Sales Dashboard for Magento, Amazon and Shopify

Posted on

Magento Cloud Backup 0.3 RC – new features and an end to the beta program in sight

We now have over 300 downloads of our Magento Cloud Backup extension, with users storing over 300GB of their store data safe offsite using Amazon S3. As we near a post-beta release I thought it might be worth announcing an early RC, for both initial feedback from other developers/admins and because some of the features in this RC have been asked for, and I’d like to allow those users to gain early access to features they need.

What’s new in CloudBackup?

Auto-cleanup of old backups
Probably the single biggest feature request is the ability to delete old backups automatically. I have implemented a simple, delete backups older than 3 months process. However if you want more or less backup storage, it’s easy to change like so:

Edit Backup.php and change private $NUM_MONTHS = 3; on line 31 to your desired number of months.

(I’ll probably make this a fully fledged configuration option for the actual RC when it goes live on Magento Connect.)

You need to enable the setting as shown in the screenshot above. Once enabled a nightly cron job will look for backups that are older than the specified threshold, and delete them from S3.

Native Database backup support

This is a MySQL only, power-user only feature that allows you to skip the Core backup if it takes too long on large stores (>2GB of database data).

It’s important to note a couple of things with regard to running native Database backups. The first is that while it’s running the mysqldump will take a lock over the database, for really really big databases that could be a problem as it may block checkouts/new accounts, for example.

The second is that mysqldump is run via a system() call this means you need security setting on PHP to allow this. It also means the mysqldump binary needs to be accessible to the PHP webserver user. To help that I have added a simple variable in Native.php (the native equivalent to Db.php provided in Magento core).

I’ll just let the code/comments do the talking with regard to configuration:

// if mysqldump binary is not on the webserver user's path
private $PATH_TO_MYSQLDUMP = ""; 
 
// For example on a MAMP based OSX install you might use: 
// private $PATH_TO_MYSQLDUMP = "/Applications/MAMP/Library/bin/";

This feature should really only be used by people who see it and think ‘great the answer to my prayers’ anybody else is likely to get themselves in to difficulty – it requires fairly deep access to your server environment – For example; if you’re on GoDaddy hosting, I’d be very surprised if you could run a native backup from PHP!

Trying the new features

You can get early access to the code over at Github, we’re using Github pages, it’s really quite a nice feature.

Once you have the code, you can install it manually in whatever manner you like, here’s some suggestions I wrote up a while back.

If you’re patient, I’ll have the RC release up on Magento Connect within the next few weeks. It needs a little more polishing before I’ll be happy with it though.

The End of the Beta Program

We’ve been running the beta program for over 12 months and I consider it a great success from a technical point of view – the software has matured gradually and with plenty of testers I feel comfortable about the quality of the backups being created, and the consistency with which they’re being made. It probably doesn’t take much business savvy though, to realize that with 300 downloads, and a bit over 300GB of data in a first-GB-of-data-free beta program, we’ve been shouldering quite a burden for everyone’s backup storage.

As I’ve said before, we would never take anything away from those that have been helping us test, so I’d assure everyone upfront that the initial GB of free storage will remain for those already using the extension. What will most likely happen once the extension is released as a 1.0 stable, is the extension will cost some small amount to buy, or the first GB won’t be completely subsidized. I’ll be sure to update everyone once we are clear on which direction the extension will go.

Anyone who has had a beer with me and endured my rant about the folly of selling not-scarce digital copies of things (including software) will know where I stand philosophically on the matter.

In any case, if you are considering offsite backups for your Magento store, or your client’s – now would be a pretty good time to jump on the bandwagon.

So that’s pretty much the update on our Magento Cloud Backup extension, if you have any questions/gripes, please don’t hesitate to comment below!

Posted on

Using SMTP Pro and Ebizmarts’ MailChimp extension in Magento

This is just a quick blog post that will hopefully help people facing the clash in Magento between my SMTPPro email extension and Ebizmarts’ MailChimp extension.

The clash occurs only in one class Mage_Core_Model_Email_Template which we both override to extend the default Magento email sending capability.

Because it only makes sense to use either SMTPPro or MailChimp as your ESP if you want to use SMTP Pro you can safely disable the MailChimp core class override and then SMTPPro will send the store emails using whichever method you have configured.

Update July 2013: I have since released a premium extension for sending email using Amazon SES called MageSend, if you’re having toruble sending email with Magento, please check it out, it was created to solve many common Magento email issues.

To remove the core override edit code/local/Ebizmarts/Mailchimp/etc/config.xml and remove the following XML:

<core>
    <rewrite>
        <email_template>Ebizmarts_Mailchimp_Model_Email_Template</email_template>
    </rewrite>
</core>

When/Why is this safe to do?

You can do this when you are not using the MailChimp STS capability and want to use SMTPPro to send your emails. If you don’t want to send via SMTPPro, just uninstall it to resolve the conflict.

You can see in the first lines of the override class Ebizmarts_Mailchimp_Model_Email_Template why this is safe:

if(!Mage::helper('mailchimp')->isStsActivated()){
    return parent::send($email, $name, $variables);
}

This means that if you are not using STS, then the whole override is basically a noop.

One caution I have for you though, once you modify an extension, you have to remember to apply the same patch each time you upgrade it, otherwise the clash will creep back in!

Update: I missed some emails notifying me of comments, I missed this fairly important one from Ebizmarts with basically this fix in it… On a related note, if I didn’t reply to your comment for the last few weeks, that’s why.