Programming

Track validation errors on Magento forms using Google Analytics

Track

A couple of weeks ago one of my colleagues from Inchoo wrote a very nice article about Tracking Onepage Checkout abandonment using Google Analytics. We will go a bit further now and expand the set of data that we are tracking in order to try to pinpoint the exact cause of checkout abandonment, if possible. You will also see that this code is re-usable on any form in frontend, which is something that I’m sure you will find a use for.

Read more

Custom router in Magento

router hab with ethernet cables computer network

Creating the custom router could be very useful thing when we want to separate some business logic that can be applied on same route (url) without redirecting to different routes inside the controller.

Why don’t we create separate route for different logic and we are done?

Read more

New way to search through Magento administration grids – using *s

guzzle1 © hugoslv@sxc.hu

Why Magento can’t use indexes on columns in admin grid when you are searching for some value e.g. order#?

This article will be really short but extremely useful in case if you have a Magento website that have “several” administrators. I’ve worked on project that have more than 2.000 administrators with different roles (that number constantly grows). You probably can imagine how slow things can be when lots of administrators use administration, specially when they are searching or sorting some data (order# or first_name, etc.).

Read more

Print message in all languages using single store, date on specified localization

screen

Did you maybe try to print one message in “all” languages on a single page?

First, let me tell you when I needed to do that. Recently I needed to develop functionality that will send some “custom” emails. You already know that we can set transactional emails for each website / store view and have those emails translated in administration/db. Challenge in my case was that I needed to translate some “random” sentences in one transactional email so using predefined email template wasn’t possible. Sure that we can inject variables and/or objects into email templates, but that didn’t help in my case.

If you have installed any version of Magento community edition >= 1.4.2.0 we can start with our translate module.

Read more

Adding “Customer Group” column to sales grid in Magento

add-new-column

Surprisingly Magento admin area does not have a “customer group” column under the “Sales > Orders” grid, or under the “Sales > Orders > Create New Order” grid (which is a grid of customers). Why would we need this in a first place? Well, maybe you want to be able to list/filter all the orders in a grid which are purchased by customers from lets say “Dealers” group.
Maybe you want to be able to filter the “Sales > Orders > Create New Order” grid by customer group prior to the actual order creation just to see the total of “Dealers” group customers?

Read more

Injecting Variables into a Magento CMS static block

Featured Image

In this tutorial i’ll show you how to inject any custom variable you need into a cms static block in place of a {{var variable_name}} tag. You’ve seen this in the email templates if you were working on them (in the matter of fact the model (filter) we’re calling is extending the same filter the email templates are using for injecting the variables).

Read more

Validate your input, Magento style

Featured Image

I’m sure most fo you will agree that Magento’s frontend validation for form input fields is a nice feature. All it takes is for you to add some CSS classes to the input fields and then upon form submission validation is triggered that outputs, by default, red colored messages that point the possible validation failures etc. This validation is done on the client side via Java Script.

Read more

Magento with xDebug, web services API and testUnit

Featured Image © Merreper@sxc.hu

Using xDebug from NetBeans is pretty straightforward and after installing xDebug from their website does not require some special configuration in order to make it work.
If you visit the link above, you will notice that it’s enough to paste the source code of your phpinfo() and you will get directions what xDebug binary to download and how to set it.

Read more

Magento unit testing basic setup

Featured Image © 123dan321@sxc.hu

In my first Magento post I mentioned importance of using unit testing during development.
Somebody will say: ‘Hello, I don’t have a time to make some weird unit tests, and why should I need them anyway?’
I will not try to explain why this is necessary here, because any good experienced developer that wants to follow best practice rules will know what I am talking about….

Read more

Extending Magento web services API v2

Featured Image

In some of previous posts on inchoo.net, colleague of mine – Branko Ajzele wrote about extending Magento API – v1.

Let say that mine extension is called: Inchoo Mapy and I will extend the customer API V2 first.

Although Magento has pretty rich set of API calls, in my project I found that some of the API calls should be extended to fit our project needs. In later posts I will write about that specific needs and possibilities, but now let’s concentrate to extending core API V2 first.

Read more