Exemplo n.º 1
0
 /**
  * @param StoreFrontBundle\Struct\Category $category
  * @return string
  */
 private function getCategoryLink(StoreFrontBundle\Struct\Category $category)
 {
     $viewport = $category->isBlog() ? 'blog' : 'cat';
     $params = http_build_query(['sViewport' => $viewport, 'sCategory' => $category->getId()], '', '&');
     return $this->config->get('baseFile') . '?' . $params;
 }
Exemplo n.º 2
0
 /**
  * @param Category $category
  * @param $childrenCounts
  * @return array
  */
 private function convertCategory(Category $category, $childrenCounts)
 {
     $childrenCount = 0;
     if (isset($childrenCounts[$category->getId()])) {
         $childrenCount = $childrenCounts[$category->getId()];
     }
     $url = $category->isBlog() ? $this->blogBaseUrl : $this->baseUrl;
     $attribute = array();
     foreach ($category->getAttributes() as $struct) {
         $attribute = array_merge($attribute, $struct->toArray());
     }
     $media = array();
     if ($category->getMedia()) {
         $media = array('id' => $category->getMedia()->getId(), 'name' => $category->getMedia()->getName(), 'description' => $category->getMedia()->getDescription(), 'path' => $category->getMedia()->getFile(), 'type' => $category->getMedia()->getType(), 'extension' => $category->getMedia()->getExtension());
     }
     $path = $category->getPath() ? '|' . implode('|', $category->getPath()) . '|' : '';
     return array('id' => $category->getId(), 'name' => $category->getName(), 'metaKeywords' => $category->getMetaKeywords(), 'metaDescription' => $category->getMetaDescription(), 'cmsHeadline' => $category->getCmsHeadline(), 'cmsText' => $category->getCmsText(), 'active' => true, 'template' => $category->getTemplate(), 'blog' => $category->isBlog(), 'path' => $path, 'external' => $category->getExternalLink(), 'showFilterGroups' => $category->displayPropertySets(), 'hideFilter' => !$category->displayFacets(), 'hideTop' => !$category->displayInNavigation(), 'hidetop' => !$category->displayInNavigation(), 'noViewSelect' => !$category->allowViewSelect(), 'attribute' => $attribute, 'media' => $media, 'description' => $category->getName(), 'link' => $category->getExternalLink() ?: $url . $category->getId(), 'flag' => false, 'subcategories' => array(), 'childrenCount' => $childrenCount);
 }