Using Magento Custom Store Config values

Sometimes in Magento I need to store a value for retrieval later but I don’t want to create a new table just for one or two settings.  This is good for setting flags, storing settings or for small text blurbs.

By storing the value in core_config_data in a custom path, a variable can be re-written and retrieved as much as needed.  It’s a very simple process and I’ve found it be incredibly useful.

Create the new config path:

Replace “path/to/your/variable” with your own path and put this in a file. Run it once to create your custom path with the initial value of “value to store“.  Alternatively, you can run the $query directly in mysql.

<?php  

$resource = Mage::getSingleton('core/resource');  
$writeConnection = $resource->getConnection('core_write');
$query = "INSERT INTO `core_config_data` ( `config_id` , `scope` , `scope_id` , `path` , `value` ) VALUES ( NULL , 'default', '0', 'path/to/your/variable', 'value to store')";
$writeConnection->query($query);
echo 'Added.';

Save data to your new config path:

$value = "123";
Mage::getModel('core/config')->saveConfig('path/to/your/variable', $value);

Read data from your new config path:

$value = Mage::getStoreConfig('path/to/your/variable');
echo $value;

Gurk III, the 8-bit RPG

Screenshot_2013-08-17-11-14-22

 

Title: Gurk III, the 8-bit RPG
Developer: Larva Labs LTD
Platform: Android
Cost: $1.99

Gurk III is the newest release in the Gurk series from Larva Labs. I’m a big fan of Gurk and Gurk II and I would have been satisfied if Gurk III was exactly the same as II with more levels. I was pleasantly surprised to find that III is faster with smoother gameplay, more monsters, interesting new magic items, a smarter AI and a new huge map.

Screenshot_2013-08-17-11-15-44 Screenshot_2013-08-17-11-14-56 Screenshot_2013-08-17-11-14-32

If you like 8-bit RPGs then it’s the best $1.99 you’ll spend on a game. If I had a device that was the size of my phone and the only thing it did was run Gurk III then I’d be satisfied.

My overall rating: 10/10

I hope Larva Labs continues their Gurk series after this. I look forward to playing Gurk IV!

You can buy it for $1.99 through the Google Play store here: https://play.google.com/store/apps/details?id=com.larvalabs.gurk3

Magento Certified Developer Facebook Group

mcd-fb-group

 

I started this Facebook group several years ago to discuss becoming a Magento Certified Developer. Since then I’ve passed the exam and there have been over 1,700 people added to the group.

If you’re interested in one of Magento’s certifications or if you’re already certified then you should join today!

https://www.facebook.com/groups/magentocertifieddevelopers/