Пример #1
0
 /**
  * The getEmotion method for the emotion landing page
  *
  * @param \Shopware\Models\Emotion\Repository $repository
  * @return array
  */
 public function getEmotion($repository)
 {
     /**@var $repository \Shopware\Models\Emotion\Repository */
     $emotionId = (int) $this->Request()->getParam('emotionId');
     $query = $repository->getEmotionById($emotionId);
     $emotion = $query->getQuery()->getArrayResult();
     $emotion['rows'] = $emotion['grid']['rows'];
     $emotion['cols'] = $emotion['grid']['cols'];
     $emotion['cellHeight'] = $emotion['grid']['cellHeight'];
     $emotion['articleHeight'] = $emotion['grid']['articleHeight'];
     $emotion['gutter'] = $emotion['grid']['gutter'];
     return $emotion;
 }
Пример #2
0
 /**
  * @param array $element
  * @param Repository $repository
  * @param int $categoryId
  * @return array
  */
 protected function handleElement(array &$element, Repository $repository, $categoryId)
 {
     $component = $element['component'];
     $elementQuery = $repository->getElementDataQuery($element['id'], $element['componentId']);
     $componentData = $elementQuery->getArrayResult();
     $data = array();
     $data["objectId"] = md5($element["id"]);
     //we have to iterate the component data to decode the values.
     foreach ($componentData as $entry) {
         switch (strtolower($entry['valueType'])) {
             case "json":
                 if ($entry['value'] != '') {
                     $value = Zend_Json::decode($entry['value']);
                 } else {
                     $value = null;
                 }
                 break;
             case "string":
             default:
                 $value = $entry['value'];
                 break;
         }
         $data[$entry['name']] = $value;
     }
     $data = Enlight()->Events()->filter('Shopware_Controllers_Widgets_Emotion_AddElement', $data, array('subject' => $this, 'element' => $element));
     if (!empty($component['convertFunction'])) {
         $convertFunction = $component['convertFunction'];
         $data = $this->{$convertFunction}($data, $categoryId, $element);
     }
     return $data;
 }