コード例 #1
0
 /**
  * Return the link that we should redirect to.
  * Only return a value if there is a legal redirection destination.
  * 
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 16.070.2014
  */
 public function redirectionLink()
 {
     $redirectionLink = false;
     if ($this->RedirectToProductGroup) {
         $linkTo = $this->LinkToID ? SilvercartProductGroupPage::get()->byID($this->LinkToID) : null;
         if ($linkTo instanceof SilvercartProductGroupPage && $linkTo->exists() && $linkTo->ID != $this->ID) {
             $redirectionLink = $linkTo->Link();
         }
     }
     return $redirectionLink;
 }
コード例 #2
0
 /**
  * Returns the cache key for the current configuration.
  *
  * @return string
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 16.06.2014
  */
 public function NavigationCacheKey()
 {
     $key = $this->SilvercartProductGroupPageID . '_' . $this->LastEdited . '_';
     $lastEditedPage = SilvercartProductGroupPage::get()->sort('LastEdited DESC')->first();
     if ($lastEditedPage) {
         $key .= '_' . $lastEditedPage->LastEdited;
     }
     $productGroupPage = SiteTree::get()->byID($this->SilvercartProductGroupPageID);
     if ($productGroupPage) {
         $key .= '_' . $productGroupPage->LastEdited;
     }
     $currentPage = Controller::curr();
     if ($currentPage) {
         $key .= '_' . $currentPage->ID;
     }
     return $key;
 }