public function index()
 {
     $categoryID = (int) $this->request->get('id');
     $category = Category::getInstanceByID($categoryID, ActiveRecord::LOAD_DATA);
     // get lists
     $f = new ARSelectFilter();
     $f->setOrder(new ARFieldHandle('ProductList', 'position'));
     $lists = $category->getRelatedRecordSetArray('ProductList', $f);
     $ids = array();
     foreach ($lists as $list) {
         $ids[] = $list['ID'];
     }
     // get list items
     $f = new ARSelectFilter(new INCond(new ARFieldHandle('ProductListItem', 'productListID'), $ids));
     $f->setOrder(new ARFieldHandle('ProductList', 'position'));
     $f->setOrder(new ARFieldHandle('ProductListItem', 'productListID'));
     $f->setOrder(new ARFieldHandle('ProductListItem', 'position'));
     $items = ActiveRecordModel::getRecordSetArray('ProductListItem', $f, array('ProductList', 'Product', 'ProductImage'));
     $items = ActiveRecordGroup::mergeGroupsWithFields('ProductList', $lists, $items);
     $response = new ActionResponse();
     $response->set('ownerID', $categoryID);
     $response->set('items', $items);
     return $response;
 }
Exemple #2
0
 public function getSpecFieldsWithGroupsArray()
 {
     return ActiveRecordGroup::mergeGroupsWithFields('SpecFieldGroup', $this->getSpecificationFieldGroupArray(), $this->getSpecificationFieldArray(false, true));
 }
 public static function mergeGroupsWithFields($className, $groups, $fields)
 {
     return ActiveRecordGroup::mergeGroupsWithFields($className, $groups, $fields);
 }
Exemple #4
0
 public function getSpecFieldsWithGroupsArray()
 {
     $groups = ActiveRecordModel::getRecordSetArray('EavFieldGroup', $this->getGroupFilter());
     $fields = ActiveRecordModel::getRecordSetArray('EavField', $this->getFieldFilter(), array('EavFieldGroup'));
     return ActiveRecordGroup::mergeGroupsWithFields('EavFieldGroup', $groups, $fields);
 }