Resource on writing Magento plugins

Galeon Posted in Note to myself, PHP
1

I’ve poked around the web for while to find some good resource about how to add my own controller to Magento and this turned out very usful:

http://www.about-magento.com/magento-developper-guide-howto-tutorial-5

Thanks to Pierre! =)

Magento cookie fuckup in chrome/safari (webkit-engine stuff)

Galeon Posted in PHP
0

Short version

Having session/cookie problems with webkit browsers (e.g. Chrome) in Magento? Go to System -> Configuration -> Web -> Session Cookie Management and set “Use HTTP Only” to no. Have fun.

Long version

Recently I’ve to work a lot with Magento, which is indeed a very nice webshop solution once you’ve gotten over this huge API and how themes etc. work.

But there was one problem driving me nuts. It started with me not being able to log into the backend. It worked in Firefox, thus it was a minor problem until today. I needed to store some information in the session using Magentos API

Mage::getSingleton('core/session')->setImageData($imgData);

But no matter what I tried,

Mage::getSingleton('core/session')->getImageData();

always gave me NULL instead of the data I expected. Ok, time is limited and cookies will work for the temporarily stuff too. So, same game, but with cookies instead of session:

Setting stuff:

Mage::getModel('core/cookie')->set('imageData', $imgData);

Reading stuff:

Mage::getModel('core/cookie')->get('imageData');

Same result: NULL

Magento session settings

Magento session cookie settings (german)

This was the moment when I realized that this behaviour was linked to my problem not being able to log into the backend using Chrome. Long story short, yes it was!
Magento has this place where you can set your settings for cookies System -> Configuration -> Web -> Session Cookie Management or in german System -> Konfiguration -> Web -> Sitzungscookie Verwaltung). If you read the settings for this page up, you’ll find that these settings are directly linked to PHPs setcookie-function. And precisely there (screenshot in german) is the setting “Use HTTP Only” which is, for some reason, set to “yes” by default. You already guess it, one browser engine currently doesn’t support this feature, it’s webkit. Thus change this setting to “no” and for some magical reason you’ll be able to login and work with sessions in Chrome.

Grails & Hibernate Persistence Context

Galeon Posted in Groovy & Grails, PHP
0

Comming from PHP I had some rough time to get into such a complex persistence-framework as Hibernate is one.
Anyway, this blog-series here is def. great to read:

http://andresteingress.wordpress.com/2010/03/23/getting-the-persistence-context-picture-part-i/
http://andresteingress.wordpress.com/2010/04/08/getting-the-persistence-context-picture-part-ii/
http://andresteingress.wordpress.com/2010/04/20/getting-the-persistence-context-picture-part-iii/

phpMyAdmin alternative

Galeon Posted in General Stuff, Javascript, PHP,Tags: ajax, mysql, tool
0

For some reason (and I guess that some of my changes to the apache-config are the reason) pma stopped working today. It just won’t let me log in, which is really annoying and contra productive.
What to do, search for an fast and easy to set up alternative and hunt the bug when there is time for it.
Anyway, I found this tiny little app called sqlbuddy.
It’s a small zipfile with no initial setup, just extract, browse to it and log in into your mysql-server. Love it!

I guess pma can stay in its grave, sqlbuddy just won my heart.