Skip to content

Instantly share code, notes, and snippets.

@WaximeA
Last active May 23, 2018 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WaximeA/520074f885bfbfedefc55b7801ec2177 to your computer and use it in GitHub Desktop.
Save WaximeA/520074f885bfbfedefc55b7801ec2177 to your computer and use it in GitHub Desktop.

Retrive model data

    const MODEL_PATH = 'path in init of the construct method in Module/Model/Modelname.php';

    /**
     * @param null $storeId
     *
     * @return string
     */
    public function getModelData($storeId = null)
    {
        $model = Mage::getModel(self::MODEL_PATH);      
        $collection = $model->getCollection();       

        foreach($collection as $item){
            if ($item->getStoreIds() == $storeId){
                $item->getData();
                $item->getTitle();
            }
        }

        return 'what u want';
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment