Last active
December 21, 2015 06:09
-
-
Save amacgregor/6262552 to your computer and use it in GitHub Desktop.
_initModel function for the frontend indexController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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