Debugging

How to translate form labels in Magento’s Admin Area

Since Magento has built in functionality for translations, you can ask yourself why Magento doesn’t want to translate my labels… and everything is set up correctly!
For all of you who work on Magento for a while and you didn’t yet needed to translate everything in Magento admin area here is a short “howto” on what you can do:
go to app/code/core/Mage/Adminhtml/Block/Widget/Form.php
and find protected function _setFieldset($attributes, $fieldset, $exclude=array())
Instead of this line

//'label'     => $attribute->getFrontend()->getLabel(),
//put this:
'label'     => Mage::helper('core')->__($attribute->getFrontend()->getLabel()),

Of course you will not change Magento’s core file in this way 🙂 (more below).

Read more

Adding related products problem

© by gerard79/sxc.hu

Today I had a problem when I want to add related product to Magento Professional 1.9.0.0., it did not work. After some tracing thrown errors and comparing files with other Magento versions I found missing part. Magento Professional has missing lines of code in Related.php. So, if someone stuck on the same problem, here is the solution!

Read more

Problems with Contact form

Couple of days ago I had a problem with contact form not working in Magento Professional 1.9.0.0. Magento was throwing error “Unable to submit your request. Please, try again later” after submitting form. Of course all requested fields was filled. Here I will explain what needs to be done if you have same problems.

Read more

Automated testing of Magento with Watir

Few months ago I was attending this web conference where among various topic one covered the “Automated testing”. To be honest I never looked into any “automated testing” tools until then. This was the first time I heard about this tool called Watir. Shortly put, Watir (pronounced water), is an open-source (BSD) family of Ruby libraries for automating web browsers.

Read more

Keeping your Magento fit with built in profiler

Default Magento installation has this great feature called “Profiler” that can play important role with your custom Magento development. This feature is meant to be be used for developer only. If used properly it can help you get valuable information of certain code parts during development.

Read more

Handling intensive Magento tasks in the background, simulating AJAX via CRON

For those of a weak hart, please skip this article. Before I start presenting the idea, please note that this is just an idea. So what’s it about? In our everyday Magento development there are numerous examples/tasks where we need to import some data into Magento or programmatically create some entries like products, orders, customers, etc. When dealing with larger scale of things, importing/creating 50000 of products can turn out to be a real challenge. Usually we (the developers) strive to a simplest possible solution, which in this case ideally would be to make simple foreach loop where we would have our code handling product creation in each iteration of the loop. Technically this works, but with extreme PHP/environment configurations only.

Read more

Magento Enterprise 1.9.0.0 redirects to home page instead of 404 error page

If you have installed and working on latest Magento’s Enterprise Edition 1.9.0.0, you could find some strange behavior with 404 error page and landing page. People say there is a patch for this, but I would like to present a quick fix for those of you who need an urgent solution. Issue is that you’ll get status 200 OK for each non-existing CMS page or controller and you will be redirected to home page.

Read more

A Better Maintenance Mode in Magento?

Magento 1.4+ includes a nice feature that allowed you to throw the store into “maintenance mode” if you need to do/work or make changes. Which is great, freeze people out of the store while you work or make changes. The only problem with this, is it also freezes YOU out of the store so you can’t make the changes you need to. So here is a little bit of code, that allows you and other you set to work on the site while everyone else sees its maintenance mode.

Read more

Magento FirePHP extension

FirePHP is Firefox add-on that enables you to log to your Firebug Console, which makes it great debugging tool for any web developer. I’m using it, like it and can’t live without it for some time now 😉 So here’s nicely packed Magento FirePHP extension, I believe you’ll be seeing it at Magento Connect in a while.

Read more