Magento themes and extensions

Memory management in Zend framework

Share
Posted on July 11th, 2011 | Posted by admin

Hello everyone! Recently I’ve noticed that some developers don’t pay much attention to memory management in Zend framework. And here I’m not talking about Zend_Cache, but rather about object sizes. And if you’re thinking that I’m writing nonsenses, let me show you how to reduce memory usage by more than 100 times (in my example :D ).

First of all, I’m going to use PHP’s built in function memory_get_usage() to get difference. Just look at this example, and you’ll know what I’m talking about:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public static function findById($collectionId,$show_all=false) {
$result = new Application_Model_Collection();
$query_result = $result->queryById($collectionId);
$var1 = memory_get_usage();
//HERE I TOOK MEMORY USAGE BEFORE POPULATING THE RESULT
$result->populateFromQuery($query_result);
$var2 = memory_get_usage();
//AND HERE AGAIN AFTER POPULATING
echo ($var2 - $var1);
//ECHO THE DIFFERENCE IN BYTES
echo ' ';
$clean_result = Application_Model_Collection_Object::parseCollection($result);
return $clean_result;
}

And another snippet:

Debugging PayPal IPN in Magento

Share
Posted on July 11th, 2011 | Posted by admin

Probably one of the most used payment options (gateways) within Magento, and most likely every other cart system is the PayPal. This payment gateway is built into the default Magento installation. All you need to do is to punch in few configuration options under “System > Configuration > Payment methods“ and you are ready to go.

Great thing about the PayPal – Magento relation is the IPN feature of the PayPal itself. By definition IPN stands for Instant Payment Notification. Its a feature of PayPal that allows you to integrate your PayPal payments with your website’s back-end operations, so you get immediate notification and authentication of the PayPal payments you receive.

Luckily IPN itself is supoorted in Magento by default.

What’s new in Magento 1.4.2

Share
Posted on July 11th, 2011 | Posted by admin

This is a minor release but with a sizable bug fix, changes and improvement list. A few important changes that appeal to the store owners have been made. And some didn’t make it into this release.

This post is oriented towards the store owners busy with running their stores. I’ve compiled all of the useful changes I could find in this short period of time.

“TheFind” extension pre-installed

MySQL transactions in Zend framework

Share
Posted on July 9th, 2011 | Posted by admin

Hi! Today I’m going to explain a part of Zend framework DB functionality. Transactions in general are quite useful, like temporary tables, but in most of situations unnecessary. Because of that, I’m going to explain when and how to use them through Zend framework.

What is transaction?

A simple answer would be – a number of individual queries that are grouped together.

An example would be something like this:

1
2
UPDATE balance SET total = total - 100 WHERE account_id=1;
UPDATE balance SET total = total + 100 WHERE account_id=2;

Order statuses “improvement” in 1.5

Share
Posted on July 9th, 2011 | Posted by admin

I took some time to install and do the quick check on Magento 1.5.0.0-alpha1. There was one thing that is impossible to miss: Improved order statuses.
I remember the days when people requested that feature all over ther forum. Oh yes… what feature? Custom order statuses :)
So, we have it out of the box finally! Or do we? Let’s see…

No more configuration files! That’s cool. Everything is stored in database now.
Users are able to create their own statuses and assign those statuses to some predefined order state.
They can choose if they want it to be default status which is also cool.
Let’s see how it looks…