Posts Tagged ‘php’

Magento – get at $_POST inside module Observer.php

March 18, 2010 1 comment

Interesting dilemma, the module observer is getting triggered off a _before_save event, so the $observer passes in the save event that is internal to magento, not off a controller action. So how to get at the $_REQUEST variables? Well… the right way, I mean, of course we could go over Magento’s head to the global vars. But let’s keep things nice and neat.

To get at the request variable use this:

Mage::app()->getFrontController()->getRequest()->getParam('default_shipping', false);

Needless to say, I’ve been playing around, customizing the address book feature of magento.

Categories: magento Tags: ,

favorite php function – shuffle()

May 13, 2008 Leave a comment

How awesome is that. I know I’m a doof.. but having the shuffle() function to randomize elements in an array is just great. It’s not even array_shuffle() or array_randomize() — it’s just plain shuffle(). Cute.

Categories: Uncategorized Tags: