/** * returns the required CartFormName required by the decorators owner in * dependence on the active group view. * * @return string */ public function getCartFormName() { return SilvercartGroupViewHandler::getCartFormNameFor(SilvercartGroupViewHandler::getActiveGroupView()); }
/** * Returns the cache key parts for this product group * * @return string * * @author Sebastian Diel <*****@*****.**> * @since 15.11.2014 */ public function CacheKeyParts() { if (is_null($this->cacheKeyParts)) { $product = singleton('SilvercartProduct'); $products = $this->getProducts(); $productMapIDs = ''; $productMapLastEdited = ''; $groupIDs = ''; if ($products instanceof SS_List && $products->count() > 0) { $productMap = $this->getProducts()->map('ID', 'LastEditedForCache')->toArray(); if (!is_array($productMap)) { $productMap = array(); } $productMapIDs = implode('_', array_keys($productMap)); sort($productMap); $productMapLastEdited = array_pop($productMap); if (Member::currentUserID() > 0) { $groupIDs = implode('-', SilvercartCustomer::currentUser()->getGroupIDs()); } } $cacheKeyParts = array(i18n::get_locale(), $this->LastEdited, $productMapIDs, $productMapLastEdited, $groupIDs, $this->getProductsPerPageSetting(), $this->getSqlOffset(), SilvercartProduct::defaultSort(), SilvercartGroupViewHandler::getActiveGroupView(), $product->getDefaultSort()); $this->extend('updateCacheKeyParts', $cacheKeyParts); $this->cacheKeyParts = $cacheKeyParts; } return $this->cacheKeyParts; }
/** * returns, wether the group view is active or not * * @return bool */ public function getActive() { if (is_null($this->active)) { $this->setActive($this->Code == SilvercartGroupViewHandler::getActiveGroupView()); } return $this->active; }