Blog

A Quick Side Project – MagentoVersion.com

While working at my day job I was reminded of another project that I wanted to accomplish. I know that any good Magento developer is capable of looking up their Magento version, but I wanted an easier way for the average user to figure out which version of Magento they were using. That is why I took a little bit of time out of this project to complete MagentoVersion.com. MagentoVersion.com is an easy way to check which version of Magento you are using online. I knew that there were other solutions on the market that involve installing a Firefox or Chrome plugin, but I feel that the average user has no need to install an entire plugin when they rarely check their Magento version. Now that I am done with that project I plan on getting back in to the integration with Magento and Salesforce.

Magento REST API Multiple “IN” GET Filters

Since it took me a little while to figure out how to do this I figured I would pass on what I learned. My goal was to make a single request to the Magento’s REST API to return orders with specific order statuses. Looking through the GET filters documentation page wasn’t really helpful until I saw the very last line. Here is the request that I came up with that worked:

http://magentohost.com/api/rest/orders?filter[1][attribute]=status&filter[1][in][1]=pending&filter[1][in][2]=processing

The above request will get you a list of all orders with a status of “pending” or “processing”.

Deciding on Features and Functionality

Progress is being made on the core of the application. I have OAuth functioning, thanks to some help from the SFDC OAuth Playground project. With the exclusion of some error handling I already have a library communicating with Magento’s REST API. Lastly, I’ve proven the concept of transferring data between Magento and Salesforce. Now the difficult questions are starting to pop up:

  • What to use as a trigger for the synchronization?
    • Button (Manual)
    • Scheduled Task (Automated)
    • Both
  • What data to synchronize and in which direction?
    • Orders / Opportunities
    • Customers / Accounts
    • Contacts
    • Products
    • Inventory Values
  • How dynamic to make the integration?
    • Allow the user to select which fields are mapped
    • Allow the user to enable and disable certain functionality
    • How resilient to make each function?
      • For example, if you are trying to import an order from Magento in to Salesforce and a product from the order does not yet exist in Salesforce should it be automatically created or fail?

As much as I would like to accommodate all of the features listed above I feel that I may never complete the project if I try to take on everything.

Getting Google AdSense Setup

I know this topic doesn’t necessarily relate to Magento or Salesforce specifically, yet I feel that it is important to this overall project. As I am making progress on this project I would like to see how effective Google ads can be at possibly paying for my hosting fees. Since I already have Google AdSense setup for youtube monetization I started to look in to setting up this wordpress site with at least one ad. Here is what I’ve done so far:

  1. Logged in to Google AdSense
  2. Clicked on the gear in the upper right corner and went to settings
  3. Clicked on Access and Authorization in the side menu
  4. Entered in “MagentoForce.com”
  5. Submitted for approval

After about 15 hours I got an email saying that my site has been approved.

Unfortunately I seem to have ran in to a roadblock though. When i log in to my Google AdSense account I get a message saying:


Your account is just one step away from being fully activated.
Click the button below and you’ll be guided through these last actions on your end:
  • You’ve successfully created an ad unit
  • Place the ad code on http://www.youtube.com/user/xxxx
Place the ad code
We’ll take it from here.
Once you’ve completed your last steps, you can sit back and relax. We’ll get to work on the last step on our end for full activation of your account. When we’re done, we’ll send you an email to let you know.

This seems to be a problem since you obviously cannot add code to youtube.com. After searching around on the internet it appears that the best thing you can do is to be patient.  For now I am just going to wait and see what happens. I will be revisiting this blog with any updates as I feel that other people might benefit from my experience.

Update August 15th 2014

I am still waiting for my approval to go through. After a week of nothing happening I went on to the Adsense forums to look for help. It turns out that this is a fairly common issue. I posted a new thread to see if I could get any help.  It seems as though Google has some internal employees who monitor the forums. A day later I had a Google employee say that they would escalate my issue to their support team. It has been almost a week now and I am still waiting.

Update August 19th 2014 – Success!

Finally I got confirmation over the Adsense forums that the Google technical team had resolved any issues with my account. Unfortunately, I’m not sure if it was just time that resolved this issue or me posting on the forums, but it took exactly three weeks to get approved.

Back to Magento 1.9

In my last blog post (Getting Started) I noted that I switched from Magento 1.9 to Magento 1.8. The reason for this is because I was getting inconsistent problems with Magento 1.9.  After browsing the admin panel or hitting API endpoints for a couple minutes it would either go to a blank page or continuously put me back at the Installation Wizard. After attempting to troubleshoot the problem for a couple hours I decided to switch back to version 1.8. Although I didn’t get these random problems with Magento 1.8 I was having a hard time trying to get the REST API to function.  Long story short, I am back on Magento Community 1.9 and have figured out what was wrong with the random issues as well as why I was having problems with the REST API.

Magento pulls up Installation Wizard or Blank Pages at Random

Running Magento Community 1.9 on an Amazon AWS micro instance has turned out to be a challenge.  Although I don’t know the exact fix to this problem I have an idea as to what is going on. My theory is that the server is running out of memory after multiple requests. When the server runs out of memory it corrupts the Magento cache files. This is what is causing the frequent blank pages, redirects to the installation wizard or even the admin page loading without any styling. If you log in to your Magento server and delete the cache folder (<Magento Install Directory>/var/cache) it resolves the issue temporarily. At this point I am going to place blame on the resources of the micro instance.

Magento REST Endpoint Returns 404 or “Invalid webservice adapter specified”

This was actually a silly problem on my part. When installing Magento on to my development server I was using the linux unzip command. What I didn’t realize about this command is that it does not extract hidden files without adding a command parameter. Even though I had Apache ModRewrite turned on and the
“Use Web Server Rewrites” setting turned on in the Magento admin panel, I was missing the stock .htaccess file in the root directory. After adding in the stock .htaccess file the REST API started functioning properly.

Getting Started

What’s Happened so far

Things are just getting started with MagentoForce. I have already taken many steps to get to this point. Just to keep everyone involved in all aspects of the project I am going to cover what I have done so far:

  • Purchased the domain name MagentoForce.com
  • Setup a new server on Amazon AWS for hosting and development work
  • Downloaded and installed Magento 1.9.0.1
    • Uninstalled Magento 1.9.0.1 (I will have a followup post explaining why)
  • Downloaded and installed Magento 1.8.1.0
  • Downloaded and installed WordPress
  • Setup a Salesforce developer account
  • Setup a gmail account
  • Various security tweaks

Throughout this project I will do my best to explain every detail of what I have done to make MagentoForce happen.  Please post a comment if you have any specific questions regarding a process. To keep everything very straight forward, I will not be doing any theming on Magento nor this WordPress.

Next Steps

Now that I officially have a web presence I will be focusing more on the project itself and getting Salesforce and Magento talking. I have already decided on the high-level design on the project and will explain that in a later blog post. I am currently trying to decided whether I would like to use the Magento REST API or the Magento SOAP API. Although I am more familiar with the Magento SOAP API, I would really like to utilize the latest technologies of Magento’s REST API. The only downside I see so far is that the Magento REST API is going to require that I use OAuth. Over the next week or two I am going to start looking in to getting OAuth functioning in APEX.

Welcome to MagentoForce

What is MagentoForce?

MagentoForce is a personal project that I am going to share with the world. The overall goal of MagentoForce is to see how the public responds to a very commercial integration that is written by a single developer and distributed free of charge. MagentoForce as a product is an integration between Salesforce CRM and the Magento eCommerce platform. Many companies are looking to integrate all of their business systems and expect to pay a large amount of money to do so. My goal is to place an integration on the market at no cost and see what the public reaction is like.

Why Magento and Salesforce?

Magneto and Salesforce are two of the leading applications in their respective fields. Both offer services ranging from the small to large business market and are known internationally.

Who am I?

My name is Zack. I am a professional developer with over four years of experience. For the past two and a half years I have been focusing primarily on integrating eCommerce solutions with inventory management systems.