Magento Themes and Magento Extensions

USPS fix for Magento CE 1.4.x

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

If you are a Magento store owner or Magento developer, you probably already noticed that USPS shipping method instantly stopped working few days ago. There was no clear announcement or whatsoever to prepare us for this outcome.

Reason

The reason for this sudden malfunction is that USPS updated (probably) their API in a manner not compatible to the previous version and all relying applications, as Magento, had to be updated also.

Magento Commerce took care of this for Magento CE 1.4.2 for which patch has been created along with instructions to guide you through the patching process.

The problem is that there is a number of stores still on Magento CE 1.4.x for which, by my recent experience, the patch doesn’t work and crashes the store.

Solution

Here’s a quick fix I made just for these situations. It could be done better, but it’l serve the purpose and allow you’re store (or your client’s) to function properly. All you have to do is unpack contents of the zip file to Magento store root folder and that’s it :)

Source: http://inchoo.net/ecommerce/magento/usps-fix-for-magento-ce-1-4-x/

Adding extra security to the Magento’s admin “Forgot your password?”

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

For those of you interested in adding a little extra security to your Magento’s admin “Forgot your password?” feature, you might find this module useful. The thing about current Magento (1.4.2.0) “Forgot your password?” feature is that it immediately resets your password and sends it to you in an email. Unlike many other systems, Magento won’t send you a “Password change confirmation” email first with some randomly generated key/url which you need to visit in order to actually change your password. It will reset you password immediately.

Although useful this can soon turn into stressful behaviour if you got someone trying to mess with you. Where that someone, just by knowing your email can initiate password reset each time he wishes just by visiting http://magento-demo.ajzele.net/index.php/admin/index/forgotpassword/ url and writing down your email address.

To pass by this, I wrote a little Magento extension that sends you a sort of “Forgotten password confirmation email” before changing the password.

“Remember Me” checkbox extension in Magento

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

Hello everyone! I’ve created a small and simple module that creates “Remember Me” functionality to any Magento website. Its currently in testing phase, so I’d say it’s an alpha release.

Never mind the alpha release (v 0.1.0), if someone is willing to try it and trace possible bugs, I’ll do my best to fix them. :D

Module doesn’t have any admin functionality. Though it can be disabled through admin at any time. There’s a small change on customer/form/login.phtml file (added checkbox with input name set), and besides that, only thing is that this module will save hashed and salted Magento customer’s password hash in a cookie, so it is safe as it can be (if I’m wrong, I’m opened for suggestions).

There’s nothing else to say besides it’s placed on login form for Magento customers. It looks like this:

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.