/**
  * Creates the cache key for this widget.
  * 
  * @param SilvercartWidget_Controller $widget Widget to get cache key for
  *
  * @return string
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 15.11.2014
  */
 public static function ProductWidgetCacheKey($widget)
 {
     $key = '';
     if ($widget->Elements() instanceof SS_List && $widget->Elements()->exists()) {
         $map = $widget->Elements()->map('ID', 'LastEditedForCache');
         if ($map instanceof SS_Map) {
             $productMap = $map->toArray();
         } else {
             $productMap = $map;
         }
         if (!is_array($productMap)) {
             $productMap = array();
         }
         if ($widget->Elements()->exists() && (empty($productMap) || count($productMap) == 1 && array_key_exists('', $productMap))) {
             $productMap = array();
             foreach ($widget->Elements() as $page) {
                 $map = $page->Elements->map('ID', 'LastEditedForCache');
                 if ($map instanceof SS_Map) {
                     $productMapToAdd = $map->toArray();
                 } else {
                     $productMapToAdd = $map;
                 }
                 $productMap = array_merge($productMap, $productMapToAdd);
             }
         }
         $productMapIDs = implode('_', array_keys($productMap));
         sort($productMap);
         $productMapLastEdited = array_pop($productMap);
         $groupIDs = '';
         if (Member::currentUserID() > 0) {
             $groupIDs = implode('-', SilvercartCustomer::currentUser()->getGroupIDs());
         }
         $keyParts = array(i18n::get_locale(), $productMapIDs, $productMapLastEdited, $widget->LastEdited, $groupIDs);
         $key = implode('_', $keyParts);
     }
     return $key;
 }