/** * Returns the cache key parts for this product group * * @return string * * @author Sebastian Diel <*****@*****.**> * @since 23.11.2012 */ public function CacheKeyParts() { if (is_null($this->cacheKeyParts)) { parent::CacheKeyParts(); $this->cacheKeyParts[] = sha1($this->getSearchQuery()) . md5($this->getSearchQuery()); } return $this->cacheKeyParts; }
/** * All products of this group * * @param int $numberOfProducts The number of products to return * @param string $sort An SQL sort statement * @param bool $disableLimit Disables the product limitation * @param bool $force Forces to get the products * * @return DataList|false all products of this group * * @author Roland Lehmann <*****@*****.**>, Sebastian Diel <*****@*****.**> * @since 06.06.2012 */ public function getProducts($numberOfProducts = false, $sort = false, $disableLimit = false, $force = false) { $cacheKey = md5($numberOfProducts . '-' . $sort . '-' . $disableLimit . '-' . $force); if (!array_key_exists($cacheKey, $this->cachedProducts)) { if (Controller::curr() instanceof SilvercartProductGroupPage_Controller && Controller::curr()->data()->ID === $this->ID) { $controller = Controller::curr(); } else { $controller = new SilvercartProductGroupPage_Controller($this); } $this->cachedProducts[$cacheKey] = $controller->getProducts($numberOfProducts, $sort, $disableLimit, $force); } return $this->cachedProducts[$cacheKey]; }