Cecko's Lab

Custom Magento Development

Zend Framework 2 – The Next Revolution in the World of PHP

7 Apr 2013

When I first encountered the Zend Framework I was blind-sighted by the high level of abstraction, the clean code and the rich library. I was 18 years old then, and my OOP knowledge was limited to developing simple websites that utilized a couple of classes + Smarty. In theory, I knew everything about OOP but I had no conceptual idea how to take advantage of the power of this technology – I had only heard using classes and objects was cool. Zend Framework has played a major role in my professional development and has managed to completely shift my worldview, transforming my then idea of coding into something quite different. Zend Framework has taught me to think object-oriented.

Every coder, who is familiar with OOP in theory (but not, for instance, with design patterns), has the illusion that they have no need for community-wide approaches, that they are great and have no need to learn from anyone else. This is what I see in almost every PHP coder nowadays. Before I came across ZF, I too was a bone-headed beginner.

Let me describe а project which does not utilize a framework: it has a single class, often named either Main or Core, and contains various methods – from database connections to product information retrieval, to as far as user registration. This is the Mothership. It is thus often the case that the Mothership includes over 10,000 lines of code, and is the author’s ultimate pride. Some programmers measure their… lines of code, but in the source code, quantity != quality.

The transition from this obsolete style to object-oriented thinking can be very difficult (utilizing a couple of classes does not make your project object-oriented but rather an object-disoriented one).

When I found out a year ago that a new version of my favorite platform was under way, I was more than sure that there’d be a ton of new stuff to learn and I had the feeling that Zend was going to change the world of PHP once again.

So, what was wrong with Zend Framework 1?

Although I have very sentimental feelings toward ZF, I cannot ignore the fact that there are a lot of things in it that I dislike.

A clumsy module system

The module system inside Zend Framework was added at a later time. In earlier ZF versions no attention had been paid to modules, which meant that the module option was fitted in afterwards. Many important options had been omitted such as module configuration and a configured classes-loader. All these things were not that difficult to mend but they did get on people’s nerves.

Read more

Can’t Imagine Life without Dependency Injection – Part One

9 Feb 2013

There are two types of programmers in the world of PHP. The first is the curious, the knowledge-seeking type attempting the most elegant and clean solutions of development issues, who strive to create a harmonic picture of code that evokes admiration, and not an infinite torture of the soul. The second is the indolent type, always pressed for time, who experience coding as if it were a sort of mining activity. In the source code, however, quantity != quality. In time, I have realized that in this realm the moment never comes when you can say “I am ready! There’s nothing more I can learn!” New methods and approaches are continuously developed that aim to make life easier for the programmer.

Recently, there’s been more and more talk in the PHP community about Dependency Injection (DI) – and there’s a reason why. In my own judgment, the development of Zend Framework 2 and Symfony 2 has significantly increased the popularity of Dependency Injection (in PHP) and has shed light on the importance and great advantages of this design pattern. Despite the numerous blog articles, PHP coders still seem to shun this approach. Below, I will try to explain my understanding and implementation of DI.

So, what exactly is Dependency Injection?

Dependency Injection is a design pattern. A lot of people are unable to tell the difference between Dependency Injection and Dependency Injection Container. Now I will try to elucidate DI, and I will discuss DI Containers further down.

Read more

Magento: Check if product is already in cart

8 Aug 2012

This morning I was looking for some new and interesting articles and I found one titled Are You Giving Your Users Positive Feedback? In this article I’ve found one very simple and elegant solution of something that always bothered me while shopping online. As I’m impatient person I always have problems with clicking more than once on the add to cart button and few times I’ve purchased items in bigger quantity that I’ve intended. I’ve never seen a web shop, that offers this simple solution presented in the article I’ve read – adding message for items that are already in the shopping cart.

 grid view  mockup showing added to cart products
Read more

Magento: Free shipping for registered customers in combination with OneStepCheckout

14 Feb 2012

In my last project, I had to deal with the following task: All registered customers and all guest customers who tick the “Create an account for later use” option on the checkout page to get free shipping in combination with the OneStepCheckout extension of Magento. This was the first time I had to manage a task of the kind, and in situations like this, I first decided to ask Google for help.

And I came across this page: Free shipping only for registered users where Srdjan Bajic had provided a solution. As I mentioned at the start, this should work with OneStepCheckout and now I am going to show you how I implemented it in OneStepCheckout.
Read more

Magento: Check if object is new after save – isObjectNew

21 Jan 2012

In Magento If you have case when you need to check if some object is new ( just created ) in after save callback, in some function where you use $object->save() or somewhere else, you can use next method:

$object->isObjectNew();

This function is available in all Magento CE releases >= 1.4.0.0
Read more

PDF Font embedding problem in Magento / Zend Framework

4 Jan 2012

Have you ever had problems with custom fonts embedding, while trying to generate PDF ducoments in Magento or using Zend Framework. May be I found solution for you, If you get next error message:

This font cannot be embedded in the PDF document. If you would like to use it anyway, you must pass Zend_Pdf_Font::EMBED_SUPPRESS_EMBED_EXCEPTION in the $options parameter of the font constructor.

As a result of my research I decided, that the problem comes from Zend Framework core and seems, that it doesn’t recognize correctly if your custom font can be embedded if has some embedding permissions.

What I mean, when say embedding permissions:

  • Licensed for print and preview embedding
  • Licensed for editable embedding
  • Licensed for modification

Read more

1 year Cecko’s Lab

11 Aug 2011

Really busy 3 weeks for me. I had no day off, even in the weekend I worked hard, some sleepless nights, but found time to prepare something for the 1 – st birth day of domain name ceckoslab.com ( That’s the way to enjoy Palma de Mallorca ) :P

Let me summarize what happened in the past year:

Evolution:

Thanks to @tomislavbilic who reminded me, that I don’t have favicon.
@ceckoslab has faviconless website :) ;P
Read more

Magento: Translate untranslatable labels in admin area

1 Apr 2011

During the last 3 weeks I’ve had to write a couple of modules that work in the Magento admin section. From here, I got the idea to write a series of short articles about the things I learned during this period.

Quick Overview

I’ll begin with an article that describes one way of translating the labels of some of the form fields in the admin section, which are generally not subject to translation from a CSV file or the Magento inline translation system. I decided to pack my idea into a module that, if you want, you can download and use for your own purposes.

Download: CeckosLab_UntranslatableAdmin

I found another approach, that solves the same problem. You can check it on Inchoo.net blog and the articles is written by Ivan Galambos: How to translate form labels in Magento’s Admin Area …. check it, because it is possible this approach to be more useful for your needs ;)

Personally, when working in the admin section, I prefer to have the interface translated into the default language, i.e. English. My client, however, said he’d like the interface translated into his own language.
Read more

Magento Developers Paradise 2010 and Me

8 Mar 2011

This article discusses the experiences, impressions and conclusions of the Magento Developer Conference held between October 10th – October 12th in Palma de Mallorca.

MDP 2010 – My viewpoint

It’s been several months after the Conference but I can say that I am still enthusiastic and still keep the positive spirit of the event.

Personally, I value MDP 2010 more as a social than as a professional experience. In fact, one of the reasons why I attended the conference was sheer curiosity – to see the community, all gathered at the same place. I wanted to prove to myself that behind the nicknames and the forum threads there were real people. It was a pleasant surprise to meet the people thanks to whose articles I made my first steps in the field of Magento.

Read more

Is Magento for you?

24 Feb 2011

This article draws on my own impressions. The conclusions in it are the result of decisions I have made, which could be interpreted to mean that it is a subjective article. Please read carefully and take everything for what it is worth; this, after all, is my own opinion. I would hate to kill someone’s hopes. If you feel you have any criticism about what’s said in here, please send me your comments.

I was provoked by the fact that there are companies, which recommend Magento to their clients without realizing the need to know the architecture and capabilities of the system in advance. It also seems like Magento have made quite an impressive marketing campaign and the owners of online stores have gone crazy about the platform. I’ve noticed that some of the owners of online stores choose Magento as a platform with no preliminary examination of the system; they’ve simply heard somewhere that it’s great!
Read more

Contact us
Email
ceckoslab [at] gmail.com
Phone number
+359 883 33 58 44