public function getDetail($id) { $data = parent::getDetail($id); $data['data']['conditions'] = json_decode($data['data']['conditions'], true); $data['data']['sorting'] = json_decode($data['data']['sorting'], true); return $data; }
/** * Adds a pseudo format, tp prevent 'LIKE' search for a foreign key. * * @param string $value * @param array $field * * @return int|string */ protected function formatSearchValue($value, array $field) { if ($field['type'] == 'foreignKey') { return (int) $value; } return parent::formatSearchValue($value, $field); }
protected function getDetailQuery($id) { $builder = parent::getDetailQuery($id); $builder->leftJoin('product.tax', 'tax')->leftJoin('product.attribute', 'attribute'); $builder->addSelect(array('tax', 'attribute')); return $builder; }
public function loadAction() { parent::loadAction(); /** @var Repository $repo */ $repo = Shopware()->Models()->getRepository('Shopware\\CustomModels\\SwagDynamicEmotion\\Store'); // this will make our emotion id available in the (smarty) template of our backend application $this->View()->assign('storeTemplateEmotionId', $repo->getStoreEmotionId()); }
/** * The getList function returns an array of the configured class model. * The listing query created in the getListQuery function. * The pagination of the listing is handled inside this function. * * @param int $offset * @param int $limit * @param array $sort Contains an array of Ext JS sort conditions * @param array $filter Contains an array of Ext JS filters * @param array $wholeParams Contains all passed request parameters * @return array */ protected function getList($offset, $limit, $sort = array(), $filter = array(), array $wholeParams = array()) { if (!isset($wholeParams['shopId'])) { $wholeParams['shopId'] = $this->getDefaultShopId(); } $data = parent::getList(null, null, $sort, $filter, $wholeParams); /**@var $shop Shop */ $shop = $this->getManager()->find('Shopware\\Models\\Shop\\Shop', $wholeParams['shopId']); foreach ($data['data'] as &$theme) { /**@var $instance Template */ $instance = $this->getRepository()->find($theme['id']); $theme['screen'] = $this->container->get('theme_util')->getPreviewImage($instance); $theme['path'] = $this->container->get('theme_path_resolver')->getDirectory($instance); if ($theme['version'] >= 3) { $theme = $this->get('theme_service')->translateTheme($instance, $theme); } if ($shop instanceof Shop && $shop->getTemplate() instanceof Template) { $theme['enabled'] = $theme['id'] === $shop->getTemplate()->getId(); } } $data = $this->get('events')->filter('Shopware_Theme_Listing_Loaded', $data, array('shop' => $shop)); return $data; }
protected function getList($offset, $limit, $sort = array(), $filter = array(), array $wholeParams = array()) { $result = parent::getList($offset, $limit, $sort, $filter, $wholeParams); $this->addParentPath($result['data']); return $result; }