Skip to content

Instantly share code, notes, and snippets.

@Gerhard-Kanzler
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save Gerhard-Kanzler/4063e04f752bcfcbdd6c to your computer and use it in GitHub Desktop.

Select an option

Save Gerhard-Kanzler/4063e04f752bcfcbdd6c to your computer and use it in GitHub Desktop.
Pimcore Objects not Published show some error...
<?php
$object = Object_Abstract::getById(intval($this->getParam('id')));
if( !$object || ( !$object->getO_Published() && !$this->editmode && !$this->getParam('pimcore_object_preview') && !$_COOKIE['pimcore_admin_sid'] ) ) {
throw new Zend_Controller_Router_Exception("the requested object doesn't exist anymore");
}
?>

Do not show Unpublished Objects in frontend. Show the Objects only if i am logged in in Pimcore or click in objects on the Preview Button.

<?php
//Place this Warning in the frontend. Only a simple help for the user to see this is not yet published (Bootstrap Style)
if( $_COOKIE['pimcore_admin_sid'] && !$this->detailObject->getO_Published() ){ ?>
<div class="col-xs-12">
<div>
<div class="alert alert-danger">
OBJECT NOT PUBLISHED
</div>
</div>
</div>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment