Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Last active December 21, 2015 06:09
Show Gist options
  • Save amacgregor/6262552 to your computer and use it in GitHub Desktop.
Save amacgregor/6262552 to your computer and use it in GitHub Desktop.
_initModel function for the frontend indexController
<?php
...
public function _initModel($param = 'id')
{
$model = Mage::getModel('mdg_giftregistry/entity');
$model->setStoreId($this->getRequest()->getParam('store', 0));
if( $modelId = $this->getRequest()->getParam($param))
{
$model->load($modelId);
if(!$model->getId())
{
Mage::throwException($this->__('There was a problem initializing the gift registry.'));
}
}
return $model;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment