Example #1
0
 /**
  * @param Struct\Category $category
  * @param array $data
  */
 private function assignCategoryData(Struct\Category $category, array $data)
 {
     if (isset($data['__category_id'])) {
         $category->setId((int) $data['__category_id']);
     }
     if (isset($data['__category_path'])) {
         $path = ltrim($data['__category_path'], '|');
         $path = rtrim($path, '|');
         $path = explode('|', $path);
         $category->setPath(array_reverse($path));
     }
     if (isset($data['__category_description'])) {
         $category->setName($data['__category_description']);
     }
     $category->setParentId((int) $data['__category_parent_id']);
     $category->setPosition((int) $data['__category_position']);
     $category->setProductBoxLayout($data['__category_product_box_layout']);
     if (isset($data['__category_metakeywords'])) {
         $category->setMetaKeywords($data['__category_metakeywords']);
     }
     if (isset($data['__category_metadescription'])) {
         $category->setMetaDescription($data['__category_metadescription']);
     }
     if (isset($data['__category_cmsheadline'])) {
         $category->setCmsHeadline($data['__category_cmsheadline']);
     }
     if (isset($data['__category_cmstext'])) {
         $category->setCmsText($data['__category_cmstext']);
     }
     if (isset($data['__category_template'])) {
         $category->setTemplate($data['__category_template']);
     }
     if (isset($data['__category_noviewselect'])) {
         $category->setAllowViewSelect((bool) (!$data['__category_noviewselect']));
     }
     if (isset($data['__category_blog'])) {
         $category->setBlog((bool) $data['__category_blog']);
     }
     if (isset($data['__category_showfiltergroups'])) {
         $category->setDisplayPropertySets((bool) $data['__category_showfiltergroups']);
     }
     if (isset($data['__category_external'])) {
         $category->setExternalLink($data['__category_external']);
     }
     if (isset($data['__category_hidefilter'])) {
         $category->setDisplayFacets((bool) (!$data['__category_hidefilter']));
     }
     if (isset($data['__category_hidetop'])) {
         $category->setDisplayInNavigation((bool) (!$data['__category_hidetop']));
     }
     if (isset($data['__category_customer_groups'])) {
         $category->setBlockedCustomerGroupIds(explode(',', $data['__category_customer_groups']));
     }
 }